From 00659e8826c96f995dbbe920f3ef98c9da159cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Mon, 11 Aug 2025 18:39:34 +0800 Subject: [PATCH 01/88] CI:modify verfication.yaml --- .github/workflows/verification.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 65fb003c..ea60739e 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -43,6 +43,12 @@ jobs: repository: 'goplus/llcppg' path: .llcppg ref: ${{matrix.llcppg}} + - name: Check out LLPyg + uses: actions/checkout@v4 + with: + repository: 'goplus/llgo' + path: .llpyg + ref: ${{matrix.llgo}} - name: Set up Go uses: actions/setup-go@v4 with: @@ -74,8 +80,12 @@ jobs: - name: Pre setup Conan if: startsWith(matrix.os, 'ubuntu') run: | - sudo apt install -y python3 + sudo apt install -y python3 python3-pip python3 -m pip install conan + - name: Setup Python + run: | + python3 -m pip install --upgrade pip + python3 -m pip install pydump pysigfetch - name: Set up Conan run: | conan profile detect @@ -95,6 +105,10 @@ jobs: go install github.com/goplus/llcppg/cmd/llcppcfg@${{matrix.llcppg}} go install github.com/goplus/llcppg/cmd/gogensig@${{matrix.llcppg}} go install github.com/goplus/llcppg/cmd/llcppg@${{matrix.llcppg}} + - name: Setup LLPyg + working-directory: .llpyg + run: | + llgo install ./chore/llpyg/llpyg - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 From 9ea8705e27fd1e0bbd77327113f510c917f21da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Wed, 13 Aug 2025 17:10:32 +0800 Subject: [PATCH 02/88] ver --- .github/workflows/verification.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index ea60739e..ae46aadb 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -14,7 +14,7 @@ on: - '.gitignore' jobs: - llcppg-verification: + llpkg-verification: name: Verify Go Module strategy: matrix: @@ -52,10 +52,10 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.23.x + go-version: 1.24.x - name: Set up Tool run: | - go install -v github.com/goplus/llpkgstore/cmd/llpkgstore@latest + go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | @@ -77,15 +77,17 @@ jobs: libc++-${{matrix.llvm}}-dev \ pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH - - name: Pre setup Conan + - name: Pre setup Python and Conan if: startsWith(matrix.os, 'ubuntu') run: | sudo apt install -y python3 python3-pip - python3 -m pip install conan - - name: Setup Python + python3 -m pip install --upgrade pip + python3 -m pip install conan pydump pysigfetch + - name: Pre setup Python and Conan + if: startsWith(matrix.os, 'macos') run: | python3 -m pip install --upgrade pip - python3 -m pip install pydump pysigfetch + python3 -m pip install conan pydump pysigfetch - name: Set up Conan run: | conan profile detect @@ -97,7 +99,7 @@ jobs: echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV # https://github.com/goplus/llgo/issues/1135 echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV - - name: Setup LLCppg + - name: Setup LLCppg (for C/C++ packages) working-directory: .llcppg run: | llgo install ./_xtool/llcppsymg @@ -105,10 +107,15 @@ jobs: go install github.com/goplus/llcppg/cmd/llcppcfg@${{matrix.llcppg}} go install github.com/goplus/llcppg/cmd/gogensig@${{matrix.llcppg}} go install github.com/goplus/llcppg/cmd/llcppg@${{matrix.llcppg}} - - name: Setup LLPyg - working-directory: .llpyg + - name: Setup LLPyg (for Python packages) + working-directory: .llgo run: | llgo install ./chore/llpyg/llpyg + llgo install ./chore/llpygcfg/llpygcfg + - name: Set up Python environment + run: | + echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages" >> $GITHUB_ENV + echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 @@ -131,4 +138,4 @@ jobs: - name: Run demotest process env: LLPKG_PATH: ${{ env.LLPKG_PATH }} - run: llpkgstore demotest + run: llpkgstore demotest \ No newline at end of file From 8f993420da5f4a57ddae7d6d79b14f67530e9bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Wed, 13 Aug 2025 17:14:08 +0800 Subject: [PATCH 03/88] math3 --- math3/go.mod | 5 + math3/llpkg.cfg | 16 +++ math3/llpyg.cfg | 123 +++++++++++++++++ math3/math.go | 270 +++++++++++++++++++++++++++++++++++++ math3/math_autogen_link.go | 5 + 5 files changed, 419 insertions(+) create mode 100644 math3/go.mod create mode 100644 math3/llpkg.cfg create mode 100644 math3/llpyg.cfg create mode 100644 math3/math.go create mode 100644 math3/math_autogen_link.go diff --git a/math3/go.mod b/math3/go.mod new file mode 100644 index 00000000..7d6e6402 --- /dev/null +++ b/math3/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/math + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/math3/llpkg.cfg b/math3/llpkg.cfg new file mode 100644 index 00000000..dd565d41 --- /dev/null +++ b/math3/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "math", + "version": "builtin" + } + } +} \ No newline at end of file diff --git a/math3/llpyg.cfg b/math3/llpyg.cfg new file mode 100644 index 00000000..94275e92 --- /dev/null +++ b/math3/llpyg.cfg @@ -0,0 +1,123 @@ +{ + "name": "math", + "module": "math", + "python": true, + "symMap": { + "abs": "Abs", + "acos": "Acos", + "acosh": "Acosh", + "all": "All", + "any": "Any", + "asin": "Asin", + "asinh": "Asinh", + "atan": "Atan", + "atan2": "Atan2", + "atanh": "Atanh", + "bin": "Bin", + "bool": "Bool", + "cbrt": "Cbrt", + "ceil": "Ceil", + "chr": "Chr", + "comb": "Comb", + "copysign": "Copysign", + "cos": "Cos", + "cosh": "Cosh", + "degrees": "Degrees", + "dict": "Dict", + "dir": "Dir", + "dist": "Dist", + "enumerate": "Enumerate", + "erf": "Erf", + "erfc": "Erfc", + "exp": "Exp", + "exp2": "Exp2", + "expm1": "Expm1", + "fabs": "Fabs", + "factorial": "Factorial", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "fmod": "Fmod", + "format": "Format", + "frexp": "Frexp", + "frozenset": "FrozenSet", + "fsum": "Fsum", + "gamma": "Gamma", + "gcd": "Gcd", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "list": "List", + "locals": "Locals", + "log10": "Log10", + "log2": "Log2", + "map": "Map", + "max": "Max", + "min": "Min", + "modf": "Modf", + "next": "Next", + "nextafter": "Nextafter", + "oct": "Oct", + "open": "Open", + "ord": "Ord", + "perm": "Perm", + "pow": "Pow", + "print": "Print", + "prod": "Prod", + "radians": "Radians", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "str": "Str", + "sum": "Sum", + "sumprod": "Sumprod", + "tan": "Tan", + "tanh": "Tanh", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "ulp": "Ulp", + "vars": "Vars", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "math" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "e": "E", + "inf": "Inf", + "nan": "NaN", + "pi": "Pi", + "tau": "Tau" + } +} \ No newline at end of file diff --git a/math3/math.go b/math3/math.go new file mode 100644 index 00000000..e2808011 --- /dev/null +++ b/math3/math.go @@ -0,0 +1,270 @@ +package math + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.math" +// Return the arc cosine (measured in radians) of x. +// +// The result is between 0 and pi. +// +//go:linkname Acos py.acos +func Acos(x *py.Object) *py.Object +// Return the inverse hyperbolic cosine of x. +// +//go:linkname Acosh py.acosh +func Acosh(x *py.Object) *py.Object +// Return the arc sine (measured in radians) of x. +// +// The result is between -pi/2 and pi/2. +// +//go:linkname Asin py.asin +func Asin(x *py.Object) *py.Object +// Return the inverse hyperbolic sine of x. +// +//go:linkname Asinh py.asinh +func Asinh(x *py.Object) *py.Object +// Return the arc tangent (measured in radians) of x. +// +// The result is between -pi/2 and pi/2. +// +//go:linkname Atan py.atan +func Atan(x *py.Object) *py.Object +// Return the arc tangent (measured in radians) of y/x. +// +// Unlike atan(y/x), the signs of both x and y are considered. +// +//go:linkname Atan2 py.atan2 +func Atan2(y *py.Object, x *py.Object) *py.Object +// Return the inverse hyperbolic tangent of x. +// +//go:linkname Atanh py.atanh +func Atanh(x *py.Object) *py.Object +// Return the cube root of x. +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object) *py.Object +// Return the ceiling of x as an Integral. +// +// This is the smallest integer >= x. +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object) *py.Object +// Return a float with the magnitude (absolute value) of x but the sign of y. +// +// On platforms that support signed zeros, copysign(1.0, -0.0) +// returns -1.0. +// +// +//go:linkname Copysign py.copysign +func Copysign(x *py.Object, y *py.Object) *py.Object +// Return the cosine of x (measured in radians). +// +//go:linkname Cos py.cos +func Cos(x *py.Object) *py.Object +// Return the hyperbolic cosine of x. +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object) *py.Object +// Convert angle x from radians to degrees. +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object) *py.Object +// Return the Euclidean distance between two points p and q. +// +// The points should be specified as sequences (or iterables) of +// coordinates. Both inputs must have the same dimension. +// +// Roughly equivalent to: +// sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q))) +// +//go:linkname Dist py.dist +func Dist(p *py.Object, q *py.Object) *py.Object +// Error function at x. +// +//go:linkname Erf py.erf +func Erf(x *py.Object) *py.Object +// Complementary error function at x. +// +//go:linkname Erfc py.erfc +func Erfc(x *py.Object) *py.Object +// Return e raised to the power of x. +// +//go:linkname Exp py.exp +func Exp(x *py.Object) *py.Object +// Return 2 raised to the power of x. +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object) *py.Object +// Return exp(x)-1. +// +// This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x. +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object) *py.Object +// Return the absolute value of the float x. +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object) *py.Object +// Find n!. +// +// Raise a ValueError if x is negative or non-integral. +// +//go:linkname Factorial py.factorial +func Factorial(n *py.Object) *py.Object +// Return the floor of x as an Integral. +// +// This is the largest integer <= x. +// +//go:linkname Floor py.floor +func Floor(x *py.Object) *py.Object +// Return fmod(x, y), according to platform C. +// +// x % y may differ. +// +//go:linkname Fmod py.fmod +func Fmod(x *py.Object, y *py.Object) *py.Object +// Return the mantissa and exponent of x, as pair (m, e). +// +// m is a float and e is an int, such that x = m * 2.**e. +// If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0. +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object) *py.Object +// Return an accurate floating-point sum of values in the iterable seq. +// +// Assumes IEEE-754 floating-point arithmetic. +// +//go:linkname Fsum py.fsum +func Fsum(seq *py.Object) *py.Object +// Gamma function at x. +// +//go:linkname Gamma py.gamma +func Gamma(x *py.Object) *py.Object +// Greatest Common Divisor. +// +//go:linkname Gcd py.gcd +func Gcd(__llgo_va_list ...interface{}) *py.Object +// Return the integer part of the square root of the input. +// +//go:linkname Isqrt py.isqrt +func Isqrt(n *py.Object) *py.Object +// Least Common Multiple. +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// Return x * (2**i). +// +// This is essentially the inverse of frexp(). +// +//go:linkname Ldexp py.ldexp +func Ldexp(x *py.Object, i *py.Object) *py.Object +// Natural logarithm of absolute value of Gamma function at x. +// +//go:linkname Lgamma py.lgamma +func Lgamma(x *py.Object) *py.Object +// Return x**y (x to the power of y). +// +//go:linkname Pow py.pow +func Pow(x *py.Object, y *py.Object) *py.Object +// Convert angle x from degrees to radians. +// +//go:linkname Radians py.radians +func Radians(x *py.Object) *py.Object +// Difference between x and the closest integer multiple of y. +// +// Return x - n*y where n*y is the closest integer multiple of y. +// In the case where x is exactly halfway between two multiples of +// y, the nearest even value of n is used. The result is always exact. +// +//go:linkname Remainder py.remainder +func Remainder(x *py.Object, y *py.Object) *py.Object +// Return the sine of x (measured in radians). +// +//go:linkname Sin py.sin +func Sin(x *py.Object) *py.Object +// Return the hyperbolic sine of x. +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object) *py.Object +// Return the square root of x. +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object) *py.Object +// Return the tangent of x (measured in radians). +// +//go:linkname Tan py.tan +func Tan(x *py.Object) *py.Object +// Return the hyperbolic tangent of x. +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object) *py.Object +// Return the sum of products of values from two iterables p and q. +// +// Roughly equivalent to: +// +// sum(itertools.starmap(operator.mul, zip(p, q, strict=True))) +// +// For float and mixed int/float inputs, the intermediate products +// and sums are computed with extended precision. +// +//go:linkname Sumprod py.sumprod +func Sumprod(p *py.Object, q *py.Object) *py.Object +// Truncates the Real x to the nearest Integral toward 0. +// +// Uses the __trunc__ magic method. +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object) *py.Object +// Calculate the product of all the elements in the input iterable. +// +// The default start value for the product is 1. +// +// When the iterable is empty, return the start value. This function is +// intended specifically for use with numeric values and may reject +// non-numeric types. +// +//go:linkname Prod py.prod +func Prod(iterable *py.Object) *py.Object +// Number of ways to choose k items from n items without repetition and with order. +// +// Evaluates to n! / (n - k)! when k <= n and evaluates +// to zero when k > n. +// +// If k is not specified or is None, then k defaults to n +// and the function returns n!. +// +// Raises TypeError if either of the arguments are not integers. +// Raises ValueError if either of the arguments are negative. +// +//go:linkname Perm py.perm +func Perm(n *py.Object, k *py.Object) *py.Object +// Number of ways to choose k items from n items without repetition and without order. +// +// Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates +// to zero when k > n. +// +// Also called the binomial coefficient because it is equivalent +// to the coefficient of k-th term in polynomial expansion of the +// expression (1 + x)**n. +// +// Raises TypeError if either of the arguments are not integers. +// Raises ValueError if either of the arguments are negative. +// +//go:linkname Comb py.comb +func Comb(n *py.Object, k *py.Object) *py.Object +// Return the floating-point value the given number of steps after x towards y. +// +// If steps is not specified or is None, it defaults to 1. +// +// Raises a TypeError, if x or y is not a double, or if steps is not an integer. +// Raises ValueError if steps is negative. +// +//go:linkname Nextafter py.nextafter +func Nextafter(x *py.Object, y *py.Object) *py.Object +// Return the value of the least significant bit of the float x. +// +//go:linkname Ulp py.ulp +func Ulp(x *py.Object) *py.Object diff --git a/math3/math_autogen_link.go b/math3/math_autogen_link.go new file mode 100644 index 00000000..fd97955a --- /dev/null +++ b/math3/math_autogen_link.go @@ -0,0 +1,5 @@ +package math + +import _ "github.com/goplus/lib/py" + +const LLGoPackage string = "py.math" From 17adacc8786143c6946d550d8ebed692271644f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Wed, 13 Aug 2025 17:50:11 +0800 Subject: [PATCH 04/88] math3_new --- math3/_demo/go.mod | 10 ++++++++++ math3/_demo/go.sum | 2 ++ math3/_demo/main.go | 29 +++++++++++++++++++++++++++++ math3/go.sum | 2 ++ math3/math_autogen_link.go | 1 - 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 math3/_demo/go.mod create mode 100644 math3/_demo/go.sum create mode 100644 math3/_demo/main.go create mode 100644 math3/go.sum diff --git a/math3/_demo/go.mod b/math3/_demo/go.mod new file mode 100644 index 00000000..46f5f92f --- /dev/null +++ b/math3/_demo/go.mod @@ -0,0 +1,10 @@ +module test_math3 + +go 1.24.5 + +replace github.com/goplus/llpkg/math => ../ + +require ( + github.com/goplus/lib v0.2.0 + github.com/goplus/llpkg/math v0.0.0-00010101000000-000000000000 +) diff --git a/math3/_demo/go.sum b/math3/_demo/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/math3/_demo/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/math3/_demo/main.go b/math3/_demo/main.go new file mode 100644 index 00000000..023355a1 --- /dev/null +++ b/math3/_demo/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" + "github.com/goplus/llpkg/math" +) + +func main() { + // 初始化 Python + py.Initialize() + defer py.Finalize() + + // 测试 math.Sqrt + result1 := math.Sqrt(py.Float(4.0)) + std.Print(py.Str("sqrt(4) = "), result1) + + // 测试 math.Cos + result2 := math.Cos(py.Float(0.0)) + std.Print(py.Str("cos(0) = "), result2) + + // 测试 math.Pow + result3 := math.Pow(py.Float(2.0), py.Float(3.0)) + std.Print(py.Str("2^3 = "), result3) + + // 测试 math.Sin + result4 := math.Sin(py.Float(1.57)) // 接近 pi/2 + std.Print(py.Str("sin(1.57) = "), result4) +} diff --git a/math3/go.sum b/math3/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/math3/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/math3/math_autogen_link.go b/math3/math_autogen_link.go index fd97955a..23b6204c 100644 --- a/math3/math_autogen_link.go +++ b/math3/math_autogen_link.go @@ -2,4 +2,3 @@ package math import _ "github.com/goplus/lib/py" -const LLGoPackage string = "py.math" From 6f18f2afca8cb867c9ea3514d4316f171eaec2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Wed, 13 Aug 2025 17:57:53 +0800 Subject: [PATCH 05/88] new_math3 --- math3/math.go | 2 +- math3/math_autogen_link.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/math3/math.go b/math3/math.go index e2808011..4c3f0c8e 100644 --- a/math3/math.go +++ b/math3/math.go @@ -5,7 +5,7 @@ import ( _ "unsafe" ) -const LLGoPackage = "py.math" +//const LLGoPackage = "py.math" // Return the arc cosine (measured in radians) of x. // // The result is between 0 and pi. diff --git a/math3/math_autogen_link.go b/math3/math_autogen_link.go index 23b6204c..767d62b8 100644 --- a/math3/math_autogen_link.go +++ b/math3/math_autogen_link.go @@ -2,3 +2,4 @@ package math import _ "github.com/goplus/lib/py" +const LLGoPackage string = "py.math" \ No newline at end of file From 00f2038e3dd387c20eadba50f21f5ed109b4bd3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Wed, 13 Aug 2025 18:39:25 +0800 Subject: [PATCH 06/88] new_ver --- .github/workflows/verification.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index ae46aadb..6ce255da 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -86,8 +86,8 @@ jobs: - name: Pre setup Python and Conan if: startsWith(matrix.os, 'macos') run: | - python3 -m pip install --upgrade pip - python3 -m pip install conan pydump pysigfetch + python3 -m pip install --upgrade pip --break-system-packages + python3 -m pip install conan pydump pysigfetch --break-system-packages - name: Set up Conan run: | conan profile detect From 4d0cc78a7792f875568be7a83da81cec8341bff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 11:22:25 +0800 Subject: [PATCH 07/88] verfi --- .github/workflows/verification.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 6ce255da..f24eadd7 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -82,12 +82,14 @@ jobs: run: | sudo apt install -y python3 python3-pip python3 -m pip install --upgrade pip - python3 -m pip install conan pydump pysigfetch + python3 -m pip install conan pydump + go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - name: Pre setup Python and Conan if: startsWith(matrix.os, 'macos') run: | python3 -m pip install --upgrade pip --break-system-packages - python3 -m pip install conan pydump pysigfetch --break-system-packages + python3 -m pip install conan pydump --break-system-packages + go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - name: Set up Conan run: | conan profile detect From 331bf6c2eb97cb7ebf19d86651d9ad65195f2479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 11:09:53 +0800 Subject: [PATCH 08/88] math4 --- math4/_demo/go.mod | 10 ++ math4/_demo/go.sum | 2 + math4/_demo/main.go | 29 ++++ math4/go.mod | 5 + math4/llpkg.cfg | 16 +++ math4/llpyg.cfg | 123 ++++++++++++++++ math4/math.go | 280 +++++++++++++++++++++++++++++++++++++ math4/math_autogen_link.go | 5 + 8 files changed, 470 insertions(+) create mode 100644 math4/_demo/go.mod create mode 100644 math4/_demo/go.sum create mode 100644 math4/_demo/main.go create mode 100644 math4/go.mod create mode 100644 math4/llpkg.cfg create mode 100644 math4/llpyg.cfg create mode 100644 math4/math.go create mode 100644 math4/math_autogen_link.go diff --git a/math4/_demo/go.mod b/math4/_demo/go.mod new file mode 100644 index 00000000..46f5f92f --- /dev/null +++ b/math4/_demo/go.mod @@ -0,0 +1,10 @@ +module test_math3 + +go 1.24.5 + +replace github.com/goplus/llpkg/math => ../ + +require ( + github.com/goplus/lib v0.2.0 + github.com/goplus/llpkg/math v0.0.0-00010101000000-000000000000 +) diff --git a/math4/_demo/go.sum b/math4/_demo/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/math4/_demo/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/math4/_demo/main.go b/math4/_demo/main.go new file mode 100644 index 00000000..023355a1 --- /dev/null +++ b/math4/_demo/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" + "github.com/goplus/llpkg/math" +) + +func main() { + // 初始化 Python + py.Initialize() + defer py.Finalize() + + // 测试 math.Sqrt + result1 := math.Sqrt(py.Float(4.0)) + std.Print(py.Str("sqrt(4) = "), result1) + + // 测试 math.Cos + result2 := math.Cos(py.Float(0.0)) + std.Print(py.Str("cos(0) = "), result2) + + // 测试 math.Pow + result3 := math.Pow(py.Float(2.0), py.Float(3.0)) + std.Print(py.Str("2^3 = "), result3) + + // 测试 math.Sin + result4 := math.Sin(py.Float(1.57)) // 接近 pi/2 + std.Print(py.Str("sin(1.57) = "), result4) +} diff --git a/math4/go.mod b/math4/go.mod new file mode 100644 index 00000000..7d6e6402 --- /dev/null +++ b/math4/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/math + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/math4/llpkg.cfg b/math4/llpkg.cfg new file mode 100644 index 00000000..dd565d41 --- /dev/null +++ b/math4/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "math", + "version": "builtin" + } + } +} \ No newline at end of file diff --git a/math4/llpyg.cfg b/math4/llpyg.cfg new file mode 100644 index 00000000..94275e92 --- /dev/null +++ b/math4/llpyg.cfg @@ -0,0 +1,123 @@ +{ + "name": "math", + "module": "math", + "python": true, + "symMap": { + "abs": "Abs", + "acos": "Acos", + "acosh": "Acosh", + "all": "All", + "any": "Any", + "asin": "Asin", + "asinh": "Asinh", + "atan": "Atan", + "atan2": "Atan2", + "atanh": "Atanh", + "bin": "Bin", + "bool": "Bool", + "cbrt": "Cbrt", + "ceil": "Ceil", + "chr": "Chr", + "comb": "Comb", + "copysign": "Copysign", + "cos": "Cos", + "cosh": "Cosh", + "degrees": "Degrees", + "dict": "Dict", + "dir": "Dir", + "dist": "Dist", + "enumerate": "Enumerate", + "erf": "Erf", + "erfc": "Erfc", + "exp": "Exp", + "exp2": "Exp2", + "expm1": "Expm1", + "fabs": "Fabs", + "factorial": "Factorial", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "fmod": "Fmod", + "format": "Format", + "frexp": "Frexp", + "frozenset": "FrozenSet", + "fsum": "Fsum", + "gamma": "Gamma", + "gcd": "Gcd", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "list": "List", + "locals": "Locals", + "log10": "Log10", + "log2": "Log2", + "map": "Map", + "max": "Max", + "min": "Min", + "modf": "Modf", + "next": "Next", + "nextafter": "Nextafter", + "oct": "Oct", + "open": "Open", + "ord": "Ord", + "perm": "Perm", + "pow": "Pow", + "print": "Print", + "prod": "Prod", + "radians": "Radians", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "str": "Str", + "sum": "Sum", + "sumprod": "Sumprod", + "tan": "Tan", + "tanh": "Tanh", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "ulp": "Ulp", + "vars": "Vars", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "math" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "e": "E", + "inf": "Inf", + "nan": "NaN", + "pi": "Pi", + "tau": "Tau" + } +} \ No newline at end of file diff --git a/math4/math.go b/math4/math.go new file mode 100644 index 00000000..e497df6e --- /dev/null +++ b/math4/math.go @@ -0,0 +1,280 @@ +package math + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.math" +// Return the arc cosine (measured in radians) of x. +// +// The result is between 0 and pi. +// +//go:linkname Acos py.acos +func Acos(x *py.Object) *py.Object +// Return the inverse hyperbolic cosine of x. +// +//go:linkname Acosh py.acosh +func Acosh(x *py.Object) *py.Object +// Return the arc sine (measured in radians) of x. +// +// The result is between -pi/2 and pi/2. +// +//go:linkname Asin py.asin +func Asin(x *py.Object) *py.Object +// Return the inverse hyperbolic sine of x. +// +//go:linkname Asinh py.asinh +func Asinh(x *py.Object) *py.Object +// Return the arc tangent (measured in radians) of x. +// +// The result is between -pi/2 and pi/2. +// +//go:linkname Atan py.atan +func Atan(x *py.Object) *py.Object +// Return the arc tangent (measured in radians) of y/x. +// +// Unlike atan(y/x), the signs of both x and y are considered. +// +//go:linkname Atan2 py.atan2 +func Atan2(y *py.Object, x *py.Object) *py.Object +// Return the inverse hyperbolic tangent of x. +// +//go:linkname Atanh py.atanh +func Atanh(x *py.Object) *py.Object +// Return the cube root of x. +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object) *py.Object +// Return the ceiling of x as an Integral. +// +// This is the smallest integer >= x. +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object) *py.Object +// Return a float with the magnitude (absolute value) of x but the sign of y. +// +// On platforms that support signed zeros, copysign(1.0, -0.0) +// returns -1.0. +// +// +//go:linkname Copysign py.copysign +func Copysign(x *py.Object, y *py.Object) *py.Object +// Return the cosine of x (measured in radians). +// +//go:linkname Cos py.cos +func Cos(x *py.Object) *py.Object +// Return the hyperbolic cosine of x. +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object) *py.Object +// Convert angle x from radians to degrees. +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object) *py.Object +// Return the Euclidean distance between two points p and q. +// +// The points should be specified as sequences (or iterables) of +// coordinates. Both inputs must have the same dimension. +// +// Roughly equivalent to: +// sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q))) +// +//go:linkname Dist py.dist +func Dist(p *py.Object, q *py.Object) *py.Object +// Error function at x. +// +//go:linkname Erf py.erf +func Erf(x *py.Object) *py.Object +// Complementary error function at x. +// +//go:linkname Erfc py.erfc +func Erfc(x *py.Object) *py.Object +// Return e raised to the power of x. +// +//go:linkname Exp py.exp +func Exp(x *py.Object) *py.Object +// Return 2 raised to the power of x. +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object) *py.Object +// Return exp(x)-1. +// +// This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x. +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object) *py.Object +// Return the absolute value of the float x. +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object) *py.Object +// Find n!. +// +// Raise a ValueError if x is negative or non-integral. +// +//go:linkname Factorial py.factorial +func Factorial(n *py.Object) *py.Object +// Return the floor of x as an Integral. +// +// This is the largest integer <= x. +// +//go:linkname Floor py.floor +func Floor(x *py.Object) *py.Object +// Return fmod(x, y), according to platform C. +// +// x % y may differ. +// +//go:linkname Fmod py.fmod +func Fmod(x *py.Object, y *py.Object) *py.Object +// Return the mantissa and exponent of x, as pair (m, e). +// +// m is a float and e is an int, such that x = m * 2.**e. +// If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0. +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object) *py.Object +// Return an accurate floating-point sum of values in the iterable seq. +// +// Assumes IEEE-754 floating-point arithmetic. +// +//go:linkname Fsum py.fsum +func Fsum(seq *py.Object) *py.Object +// Gamma function at x. +// +//go:linkname Gamma py.gamma +func Gamma(x *py.Object) *py.Object +// Greatest Common Divisor. +// +//go:linkname Gcd py.gcd +func Gcd(__llgo_va_list ...interface{}) *py.Object +// Return the integer part of the square root of the input. +// +//go:linkname Isqrt py.isqrt +func Isqrt(n *py.Object) *py.Object +// Least Common Multiple. +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// Return x * (2**i). +// +// This is essentially the inverse of frexp(). +// +//go:linkname Ldexp py.ldexp +func Ldexp(x *py.Object, i *py.Object) *py.Object +// Natural logarithm of absolute value of Gamma function at x. +// +//go:linkname Lgamma py.lgamma +func Lgamma(x *py.Object) *py.Object +// Return the base 2 logarithm of x. +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object) *py.Object +// Return the fractional and integer parts of x. +// +// Both results carry the sign of x and are floats. +// +//go:linkname Modf py.modf +func Modf(x *py.Object) *py.Object +// Return x**y (x to the power of y). +// +//go:linkname Pow py.pow +func Pow(x *py.Object, y *py.Object) *py.Object +// Convert angle x from degrees to radians. +// +//go:linkname Radians py.radians +func Radians(x *py.Object) *py.Object +// Difference between x and the closest integer multiple of y. +// +// Return x - n*y where n*y is the closest integer multiple of y. +// In the case where x is exactly halfway between two multiples of +// y, the nearest even value of n is used. The result is always exact. +// +//go:linkname Remainder py.remainder +func Remainder(x *py.Object, y *py.Object) *py.Object +// Return the sine of x (measured in radians). +// +//go:linkname Sin py.sin +func Sin(x *py.Object) *py.Object +// Return the hyperbolic sine of x. +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object) *py.Object +// Return the square root of x. +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object) *py.Object +// Return the tangent of x (measured in radians). +// +//go:linkname Tan py.tan +func Tan(x *py.Object) *py.Object +// Return the hyperbolic tangent of x. +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object) *py.Object +// Return the sum of products of values from two iterables p and q. +// +// Roughly equivalent to: +// +// sum(itertools.starmap(operator.mul, zip(p, q, strict=True))) +// +// For float and mixed int/float inputs, the intermediate products +// and sums are computed with extended precision. +// +//go:linkname Sumprod py.sumprod +func Sumprod(p *py.Object, q *py.Object) *py.Object +// Truncates the Real x to the nearest Integral toward 0. +// +// Uses the __trunc__ magic method. +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object) *py.Object +// Calculate the product of all the elements in the input iterable. +// +// The default start value for the product is 1. +// +// When the iterable is empty, return the start value. This function is +// intended specifically for use with numeric values and may reject +// non-numeric types. +// +//go:linkname Prod py.prod +func Prod(iterable *py.Object) *py.Object +// Number of ways to choose k items from n items without repetition and with order. +// +// Evaluates to n! / (n - k)! when k <= n and evaluates +// to zero when k > n. +// +// If k is not specified or is None, then k defaults to n +// and the function returns n!. +// +// Raises TypeError if either of the arguments are not integers. +// Raises ValueError if either of the arguments are negative. +// +//go:linkname Perm py.perm +func Perm(n *py.Object, k *py.Object) *py.Object +// Number of ways to choose k items from n items without repetition and without order. +// +// Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates +// to zero when k > n. +// +// Also called the binomial coefficient because it is equivalent +// to the coefficient of k-th term in polynomial expansion of the +// expression (1 + x)**n. +// +// Raises TypeError if either of the arguments are not integers. +// Raises ValueError if either of the arguments are negative. +// +//go:linkname Comb py.comb +func Comb(n *py.Object, k *py.Object) *py.Object +// Return the floating-point value the given number of steps after x towards y. +// +// If steps is not specified or is None, it defaults to 1. +// +// Raises a TypeError, if x or y is not a double, or if steps is not an integer. +// Raises ValueError if steps is negative. +// +//go:linkname Nextafter py.nextafter +func Nextafter(x *py.Object, y *py.Object) *py.Object +// Return the value of the least significant bit of the float x. +// +//go:linkname Ulp py.ulp +func Ulp(x *py.Object) *py.Object diff --git a/math4/math_autogen_link.go b/math4/math_autogen_link.go new file mode 100644 index 00000000..1f657e14 --- /dev/null +++ b/math4/math_autogen_link.go @@ -0,0 +1,5 @@ +package math + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From ce71a62044f4c096d6d8fa6365912e9955ae9a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 12:01:53 +0800 Subject: [PATCH 09/88] math3 --- .DS_Store | Bin 0 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..59f99ee8aa6f5f1d7326b2a03473eb0fbe623fa7 GIT binary patch literal 6148 zcmeH~O-{ow5QU#hs}>Mamu!%7f=a*z($X#}0SkHo`hyB6G|(1=SY^*0xB};61#iX{ zBx$=v2+c_LOPn{h^C^jA0Iu^mIRu&j8Z4sK9ad{Xu1i^oN@&@mI_=}ApQPhal8#oq z)?fsTz~3Vv?`{nvyx<1+$iKhxNocdQJ~edeKhERan=a1x73Ua3%rV8H=yV5boVQpY z#jNCfEjjB*ILi^1^rlEk?vD-bXWTKbbZ3?6M)!j5WwCGN@Rs9H$0_9IcHm&ZsT+I4O>*T=RX^$@D>qEpb&I z*$LacyUHg(>6UsGs(BwzE&d4sd9E0ZU9VOf0V7}pz6r?pAz~4YgJxd!)4@u&0Msg* zHFzw)1CkR3je}-hd4=J8D%GdDu*Gmbo$XQZ#X&Q#J{>M>K3o{tg&m61(b<2bcDUH9 z)keSw6bWqk)26Kdz0LdoVv?O10VD9Q2)Jr@(CzS+!rHoWbF$V(ESD@2;>)~h3ahXj g>wzrA`z#u~7RdoM4w`vo3&VZ{6oXYp;8zKJ0mS8~00000 literal 0 HcmV?d00001 From 5f2dec902fbf3bc9abb2ae59d19429c2768b6db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 13:56:24 +0800 Subject: [PATCH 10/88] verif --- .github/workflows/verification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index f24eadd7..c415e84c 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -140,4 +140,4 @@ jobs: - name: Run demotest process env: LLPKG_PATH: ${{ env.LLPKG_PATH }} - run: llpkgstore demotest \ No newline at end of file + run: llpkgstore demotest From c1cc43d8d5dac2b4c37725cce5533fd76d30dd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 14:15:32 +0800 Subject: [PATCH 11/88] ver1 --- .github/workflows/verification.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index c415e84c..42691884 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -87,7 +87,6 @@ jobs: - name: Pre setup Python and Conan if: startsWith(matrix.os, 'macos') run: | - python3 -m pip install --upgrade pip --break-system-packages python3 -m pip install conan pydump --break-system-packages go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - name: Set up Conan From 0be33b37dbffa547441a899c4a5d0161e1987556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 14:36:49 +0800 Subject: [PATCH 12/88] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=20LLGo=20chec?= =?UTF-8?q?kout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/verification.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 42691884..ee1d4f6c 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -43,12 +43,6 @@ jobs: repository: 'goplus/llcppg' path: .llcppg ref: ${{matrix.llcppg}} - - name: Check out LLPyg - uses: actions/checkout@v4 - with: - repository: 'goplus/llgo' - path: .llpyg - ref: ${{matrix.llgo}} - name: Set up Go uses: actions/setup-go@v4 with: From 8da7b392b9a357d03e9f749a3c6afd5901236332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 14:52:30 +0800 Subject: [PATCH 13/88] =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=AE=89=E8=A3=85=20LL?= =?UTF-8?q?Pyg=20=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/verification.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index ee1d4f6c..db0ab9ea 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -105,8 +105,8 @@ jobs: - name: Setup LLPyg (for Python packages) working-directory: .llgo run: | - llgo install ./chore/llpyg/llpyg - llgo install ./chore/llpygcfg/llpygcfg + go install -v ./chore/llpyg/llpyg + go install -v ./chore/llpygcfg/llpygcfg - name: Set up Python environment run: | echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages" >> $GITHUB_ENV From d7826f61a36c09945501102f1857c83b5a4872fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 15:16:26 +0800 Subject: [PATCH 14/88] ymal --- .github/workflows/verification.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index db0ab9ea..d9829f69 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -105,8 +105,7 @@ jobs: - name: Setup LLPyg (for Python packages) working-directory: .llgo run: | - go install -v ./chore/llpyg/llpyg - go install -v ./chore/llpygcfg/llpygcfg + go install -v ./chore/... - name: Set up Python environment run: | echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages" >> $GITHUB_ENV From d81bf5852450326471914d4638d9c7cdceb64318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 15:27:16 +0800 Subject: [PATCH 15/88] checkout website --- .github/workflows/verification.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index d9829f69..e8f347b9 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -115,6 +115,7 @@ jobs: uses: tj-actions/changed-files@v45 - name: Checkout to website uses: actions/checkout@v4 + continue-on-error: true with: ref: website path: .website From fc290e9b3fab5b7b11b820af74c68e152d2a83e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 15:39:31 +0800 Subject: [PATCH 16/88] =?UTF-8?q?=E8=B7=B3=E8=BF=87=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=20website=20=E5=88=86=E6=94=AF=20checkout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/verification.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index e8f347b9..9123fd03 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -113,18 +113,6 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 - - name: Checkout to website - uses: actions/checkout@v4 - continue-on-error: true - with: - ref: website - path: .website - - name: Copy llpkgstore.json to root - continue-on-error: true - run: | - ls .website .website/public - cp .website/public/llpkgstore.json . - rm -rf .website - name: Verification & Prebuilt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fae47914a5a734813a67362462c18c130e922154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 18:01:49 +0800 Subject: [PATCH 17/88] verification.yml --- .github/workflows/verification.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 9123fd03..7ca750df 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -110,6 +110,9 @@ jobs: run: | echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages" >> $GITHUB_ENV echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + - name: Install Python dependencies + run: | + python3 -m pip install numpy==1.26.4 - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 From f8074323e7101e9766a26ae25844f49027910707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Thu, 14 Aug 2025 18:13:29 +0800 Subject: [PATCH 18/88] verification.yml --- .github/workflows/verification.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 7ca750df..f37b525e 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -110,9 +110,14 @@ jobs: run: | echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages" >> $GITHUB_ENV echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV - - name: Install Python dependencies + - name: Install Python dependencies (Ubuntu) + if: startsWith(matrix.os, 'ubuntu') run: | python3 -m pip install numpy==1.26.4 + - name: Install Python dependencies (macOS) + if: startsWith(matrix.os, 'macos') + run: | + python3 -m pip install numpy==1.26.4 --break-system-packages - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 From 487dd9bc5202454704094a2308ffd3f6230de715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 09:17:22 +0800 Subject: [PATCH 19/88] Release-as: numpy/v1.26.4 --- .DS_Store | Bin 6148 -> 6148 bytes math3/_demo/go.mod | 10 - math3/_demo/main.go | 29 - math3/go.mod | 5 - math3/go.sum | 2 - math3/math.go | 270 - math3/math_autogen_link.go | 5 - math4/_demo/go.mod | 10 - math4/_demo/go.sum | 2 - math4/_demo/main.go | 29 - math4/llpkg.cfg | 16 - math4/llpyg.cfg | 123 - math4/math.go | 280 - numpy/_demo/main.go | 9 + {math4 => numpy}/go.mod | 2 +- {math3/_demo => numpy}/go.sum | 0 {math3 => numpy}/llpkg.cfg | 4 +- {math3 => numpy}/llpyg.cfg | 96 +- numpy/numpy.go | 9572 +++++++++++++++++ .../numpy_autogen_link.go | 2 +- 20 files changed, 9649 insertions(+), 817 deletions(-) delete mode 100644 math3/_demo/go.mod delete mode 100644 math3/_demo/main.go delete mode 100644 math3/go.mod delete mode 100644 math3/go.sum delete mode 100644 math3/math.go delete mode 100644 math3/math_autogen_link.go delete mode 100644 math4/_demo/go.mod delete mode 100644 math4/_demo/go.sum delete mode 100644 math4/_demo/main.go delete mode 100644 math4/llpkg.cfg delete mode 100644 math4/llpyg.cfg delete mode 100644 math4/math.go create mode 100644 numpy/_demo/main.go rename {math4 => numpy}/go.mod (55%) rename {math3/_demo => numpy}/go.sum (100%) rename {math3 => numpy}/llpkg.cfg (81%) rename {math3 => numpy}/llpyg.cfg (54%) create mode 100644 numpy/numpy.go rename math4/math_autogen_link.go => numpy/numpy_autogen_link.go (86%) diff --git a/.DS_Store b/.DS_Store index 59f99ee8aa6f5f1d7326b2a03473eb0fbe623fa7..1d0aef2a9db168ea05c7039ec177006983748397 100644 GIT binary patch delta 68 zcmZoMXfc=|#>B)qu~2NHo+2an#(>?7jNF@fSdtkxZ)Oc)+SuU2w3(fQp9837vmnQJ W=E?jbjvNd?z{tSBvN=Lz4Kn~(B@e~` delta 134 zcmZoMXfc=|#>B!ku~2NHo+2af#(>?7iv?Ji7V(ZFfa%(FfgS9>3RRb0LWrsKvG#2T$GoSp9fOGxH*S8oM|&V2R{eUmd%VT- ../ - -require ( - github.com/goplus/lib v0.2.0 - github.com/goplus/llpkg/math v0.0.0-00010101000000-000000000000 -) diff --git a/math3/_demo/main.go b/math3/_demo/main.go deleted file mode 100644 index 023355a1..00000000 --- a/math3/_demo/main.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -import ( - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" - "github.com/goplus/llpkg/math" -) - -func main() { - // 初始化 Python - py.Initialize() - defer py.Finalize() - - // 测试 math.Sqrt - result1 := math.Sqrt(py.Float(4.0)) - std.Print(py.Str("sqrt(4) = "), result1) - - // 测试 math.Cos - result2 := math.Cos(py.Float(0.0)) - std.Print(py.Str("cos(0) = "), result2) - - // 测试 math.Pow - result3 := math.Pow(py.Float(2.0), py.Float(3.0)) - std.Print(py.Str("2^3 = "), result3) - - // 测试 math.Sin - result4 := math.Sin(py.Float(1.57)) // 接近 pi/2 - std.Print(py.Str("sin(1.57) = "), result4) -} diff --git a/math3/go.mod b/math3/go.mod deleted file mode 100644 index 7d6e6402..00000000 --- a/math3/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/math - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/math3/go.sum b/math3/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/math3/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/math3/math.go b/math3/math.go deleted file mode 100644 index 4c3f0c8e..00000000 --- a/math3/math.go +++ /dev/null @@ -1,270 +0,0 @@ -package math - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -//const LLGoPackage = "py.math" -// Return the arc cosine (measured in radians) of x. -// -// The result is between 0 and pi. -// -//go:linkname Acos py.acos -func Acos(x *py.Object) *py.Object -// Return the inverse hyperbolic cosine of x. -// -//go:linkname Acosh py.acosh -func Acosh(x *py.Object) *py.Object -// Return the arc sine (measured in radians) of x. -// -// The result is between -pi/2 and pi/2. -// -//go:linkname Asin py.asin -func Asin(x *py.Object) *py.Object -// Return the inverse hyperbolic sine of x. -// -//go:linkname Asinh py.asinh -func Asinh(x *py.Object) *py.Object -// Return the arc tangent (measured in radians) of x. -// -// The result is between -pi/2 and pi/2. -// -//go:linkname Atan py.atan -func Atan(x *py.Object) *py.Object -// Return the arc tangent (measured in radians) of y/x. -// -// Unlike atan(y/x), the signs of both x and y are considered. -// -//go:linkname Atan2 py.atan2 -func Atan2(y *py.Object, x *py.Object) *py.Object -// Return the inverse hyperbolic tangent of x. -// -//go:linkname Atanh py.atanh -func Atanh(x *py.Object) *py.Object -// Return the cube root of x. -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object) *py.Object -// Return the ceiling of x as an Integral. -// -// This is the smallest integer >= x. -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object) *py.Object -// Return a float with the magnitude (absolute value) of x but the sign of y. -// -// On platforms that support signed zeros, copysign(1.0, -0.0) -// returns -1.0. -// -// -//go:linkname Copysign py.copysign -func Copysign(x *py.Object, y *py.Object) *py.Object -// Return the cosine of x (measured in radians). -// -//go:linkname Cos py.cos -func Cos(x *py.Object) *py.Object -// Return the hyperbolic cosine of x. -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object) *py.Object -// Convert angle x from radians to degrees. -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object) *py.Object -// Return the Euclidean distance between two points p and q. -// -// The points should be specified as sequences (or iterables) of -// coordinates. Both inputs must have the same dimension. -// -// Roughly equivalent to: -// sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q))) -// -//go:linkname Dist py.dist -func Dist(p *py.Object, q *py.Object) *py.Object -// Error function at x. -// -//go:linkname Erf py.erf -func Erf(x *py.Object) *py.Object -// Complementary error function at x. -// -//go:linkname Erfc py.erfc -func Erfc(x *py.Object) *py.Object -// Return e raised to the power of x. -// -//go:linkname Exp py.exp -func Exp(x *py.Object) *py.Object -// Return 2 raised to the power of x. -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object) *py.Object -// Return exp(x)-1. -// -// This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x. -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object) *py.Object -// Return the absolute value of the float x. -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object) *py.Object -// Find n!. -// -// Raise a ValueError if x is negative or non-integral. -// -//go:linkname Factorial py.factorial -func Factorial(n *py.Object) *py.Object -// Return the floor of x as an Integral. -// -// This is the largest integer <= x. -// -//go:linkname Floor py.floor -func Floor(x *py.Object) *py.Object -// Return fmod(x, y), according to platform C. -// -// x % y may differ. -// -//go:linkname Fmod py.fmod -func Fmod(x *py.Object, y *py.Object) *py.Object -// Return the mantissa and exponent of x, as pair (m, e). -// -// m is a float and e is an int, such that x = m * 2.**e. -// If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0. -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object) *py.Object -// Return an accurate floating-point sum of values in the iterable seq. -// -// Assumes IEEE-754 floating-point arithmetic. -// -//go:linkname Fsum py.fsum -func Fsum(seq *py.Object) *py.Object -// Gamma function at x. -// -//go:linkname Gamma py.gamma -func Gamma(x *py.Object) *py.Object -// Greatest Common Divisor. -// -//go:linkname Gcd py.gcd -func Gcd(__llgo_va_list ...interface{}) *py.Object -// Return the integer part of the square root of the input. -// -//go:linkname Isqrt py.isqrt -func Isqrt(n *py.Object) *py.Object -// Least Common Multiple. -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// Return x * (2**i). -// -// This is essentially the inverse of frexp(). -// -//go:linkname Ldexp py.ldexp -func Ldexp(x *py.Object, i *py.Object) *py.Object -// Natural logarithm of absolute value of Gamma function at x. -// -//go:linkname Lgamma py.lgamma -func Lgamma(x *py.Object) *py.Object -// Return x**y (x to the power of y). -// -//go:linkname Pow py.pow -func Pow(x *py.Object, y *py.Object) *py.Object -// Convert angle x from degrees to radians. -// -//go:linkname Radians py.radians -func Radians(x *py.Object) *py.Object -// Difference between x and the closest integer multiple of y. -// -// Return x - n*y where n*y is the closest integer multiple of y. -// In the case where x is exactly halfway between two multiples of -// y, the nearest even value of n is used. The result is always exact. -// -//go:linkname Remainder py.remainder -func Remainder(x *py.Object, y *py.Object) *py.Object -// Return the sine of x (measured in radians). -// -//go:linkname Sin py.sin -func Sin(x *py.Object) *py.Object -// Return the hyperbolic sine of x. -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object) *py.Object -// Return the square root of x. -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object) *py.Object -// Return the tangent of x (measured in radians). -// -//go:linkname Tan py.tan -func Tan(x *py.Object) *py.Object -// Return the hyperbolic tangent of x. -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object) *py.Object -// Return the sum of products of values from two iterables p and q. -// -// Roughly equivalent to: -// -// sum(itertools.starmap(operator.mul, zip(p, q, strict=True))) -// -// For float and mixed int/float inputs, the intermediate products -// and sums are computed with extended precision. -// -//go:linkname Sumprod py.sumprod -func Sumprod(p *py.Object, q *py.Object) *py.Object -// Truncates the Real x to the nearest Integral toward 0. -// -// Uses the __trunc__ magic method. -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object) *py.Object -// Calculate the product of all the elements in the input iterable. -// -// The default start value for the product is 1. -// -// When the iterable is empty, return the start value. This function is -// intended specifically for use with numeric values and may reject -// non-numeric types. -// -//go:linkname Prod py.prod -func Prod(iterable *py.Object) *py.Object -// Number of ways to choose k items from n items without repetition and with order. -// -// Evaluates to n! / (n - k)! when k <= n and evaluates -// to zero when k > n. -// -// If k is not specified or is None, then k defaults to n -// and the function returns n!. -// -// Raises TypeError if either of the arguments are not integers. -// Raises ValueError if either of the arguments are negative. -// -//go:linkname Perm py.perm -func Perm(n *py.Object, k *py.Object) *py.Object -// Number of ways to choose k items from n items without repetition and without order. -// -// Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates -// to zero when k > n. -// -// Also called the binomial coefficient because it is equivalent -// to the coefficient of k-th term in polynomial expansion of the -// expression (1 + x)**n. -// -// Raises TypeError if either of the arguments are not integers. -// Raises ValueError if either of the arguments are negative. -// -//go:linkname Comb py.comb -func Comb(n *py.Object, k *py.Object) *py.Object -// Return the floating-point value the given number of steps after x towards y. -// -// If steps is not specified or is None, it defaults to 1. -// -// Raises a TypeError, if x or y is not a double, or if steps is not an integer. -// Raises ValueError if steps is negative. -// -//go:linkname Nextafter py.nextafter -func Nextafter(x *py.Object, y *py.Object) *py.Object -// Return the value of the least significant bit of the float x. -// -//go:linkname Ulp py.ulp -func Ulp(x *py.Object) *py.Object diff --git a/math3/math_autogen_link.go b/math3/math_autogen_link.go deleted file mode 100644 index 767d62b8..00000000 --- a/math3/math_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package math - -import _ "github.com/goplus/lib/py" - -const LLGoPackage string = "py.math" \ No newline at end of file diff --git a/math4/_demo/go.mod b/math4/_demo/go.mod deleted file mode 100644 index 46f5f92f..00000000 --- a/math4/_demo/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module test_math3 - -go 1.24.5 - -replace github.com/goplus/llpkg/math => ../ - -require ( - github.com/goplus/lib v0.2.0 - github.com/goplus/llpkg/math v0.0.0-00010101000000-000000000000 -) diff --git a/math4/_demo/go.sum b/math4/_demo/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/math4/_demo/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/math4/_demo/main.go b/math4/_demo/main.go deleted file mode 100644 index 023355a1..00000000 --- a/math4/_demo/main.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -import ( - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" - "github.com/goplus/llpkg/math" -) - -func main() { - // 初始化 Python - py.Initialize() - defer py.Finalize() - - // 测试 math.Sqrt - result1 := math.Sqrt(py.Float(4.0)) - std.Print(py.Str("sqrt(4) = "), result1) - - // 测试 math.Cos - result2 := math.Cos(py.Float(0.0)) - std.Print(py.Str("cos(0) = "), result2) - - // 测试 math.Pow - result3 := math.Pow(py.Float(2.0), py.Float(3.0)) - std.Print(py.Str("2^3 = "), result3) - - // 测试 math.Sin - result4 := math.Sin(py.Float(1.57)) // 接近 pi/2 - std.Print(py.Str("sin(1.57) = "), result4) -} diff --git a/math4/llpkg.cfg b/math4/llpkg.cfg deleted file mode 100644 index dd565d41..00000000 --- a/math4/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "math", - "version": "builtin" - } - } -} \ No newline at end of file diff --git a/math4/llpyg.cfg b/math4/llpyg.cfg deleted file mode 100644 index 94275e92..00000000 --- a/math4/llpyg.cfg +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "math", - "module": "math", - "python": true, - "symMap": { - "abs": "Abs", - "acos": "Acos", - "acosh": "Acosh", - "all": "All", - "any": "Any", - "asin": "Asin", - "asinh": "Asinh", - "atan": "Atan", - "atan2": "Atan2", - "atanh": "Atanh", - "bin": "Bin", - "bool": "Bool", - "cbrt": "Cbrt", - "ceil": "Ceil", - "chr": "Chr", - "comb": "Comb", - "copysign": "Copysign", - "cos": "Cos", - "cosh": "Cosh", - "degrees": "Degrees", - "dict": "Dict", - "dir": "Dir", - "dist": "Dist", - "enumerate": "Enumerate", - "erf": "Erf", - "erfc": "Erfc", - "exp": "Exp", - "exp2": "Exp2", - "expm1": "Expm1", - "fabs": "Fabs", - "factorial": "Factorial", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "fmod": "Fmod", - "format": "Format", - "frexp": "Frexp", - "frozenset": "FrozenSet", - "fsum": "Fsum", - "gamma": "Gamma", - "gcd": "Gcd", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "list": "List", - "locals": "Locals", - "log10": "Log10", - "log2": "Log2", - "map": "Map", - "max": "Max", - "min": "Min", - "modf": "Modf", - "next": "Next", - "nextafter": "Nextafter", - "oct": "Oct", - "open": "Open", - "ord": "Ord", - "perm": "Perm", - "pow": "Pow", - "print": "Print", - "prod": "Prod", - "radians": "Radians", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "str": "Str", - "sum": "Sum", - "sumprod": "Sumprod", - "tan": "Tan", - "tanh": "Tanh", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "ulp": "Ulp", - "vars": "Vars", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "math" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "e": "E", - "inf": "Inf", - "nan": "NaN", - "pi": "Pi", - "tau": "Tau" - } -} \ No newline at end of file diff --git a/math4/math.go b/math4/math.go deleted file mode 100644 index e497df6e..00000000 --- a/math4/math.go +++ /dev/null @@ -1,280 +0,0 @@ -package math - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.math" -// Return the arc cosine (measured in radians) of x. -// -// The result is between 0 and pi. -// -//go:linkname Acos py.acos -func Acos(x *py.Object) *py.Object -// Return the inverse hyperbolic cosine of x. -// -//go:linkname Acosh py.acosh -func Acosh(x *py.Object) *py.Object -// Return the arc sine (measured in radians) of x. -// -// The result is between -pi/2 and pi/2. -// -//go:linkname Asin py.asin -func Asin(x *py.Object) *py.Object -// Return the inverse hyperbolic sine of x. -// -//go:linkname Asinh py.asinh -func Asinh(x *py.Object) *py.Object -// Return the arc tangent (measured in radians) of x. -// -// The result is between -pi/2 and pi/2. -// -//go:linkname Atan py.atan -func Atan(x *py.Object) *py.Object -// Return the arc tangent (measured in radians) of y/x. -// -// Unlike atan(y/x), the signs of both x and y are considered. -// -//go:linkname Atan2 py.atan2 -func Atan2(y *py.Object, x *py.Object) *py.Object -// Return the inverse hyperbolic tangent of x. -// -//go:linkname Atanh py.atanh -func Atanh(x *py.Object) *py.Object -// Return the cube root of x. -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object) *py.Object -// Return the ceiling of x as an Integral. -// -// This is the smallest integer >= x. -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object) *py.Object -// Return a float with the magnitude (absolute value) of x but the sign of y. -// -// On platforms that support signed zeros, copysign(1.0, -0.0) -// returns -1.0. -// -// -//go:linkname Copysign py.copysign -func Copysign(x *py.Object, y *py.Object) *py.Object -// Return the cosine of x (measured in radians). -// -//go:linkname Cos py.cos -func Cos(x *py.Object) *py.Object -// Return the hyperbolic cosine of x. -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object) *py.Object -// Convert angle x from radians to degrees. -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object) *py.Object -// Return the Euclidean distance between two points p and q. -// -// The points should be specified as sequences (or iterables) of -// coordinates. Both inputs must have the same dimension. -// -// Roughly equivalent to: -// sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q))) -// -//go:linkname Dist py.dist -func Dist(p *py.Object, q *py.Object) *py.Object -// Error function at x. -// -//go:linkname Erf py.erf -func Erf(x *py.Object) *py.Object -// Complementary error function at x. -// -//go:linkname Erfc py.erfc -func Erfc(x *py.Object) *py.Object -// Return e raised to the power of x. -// -//go:linkname Exp py.exp -func Exp(x *py.Object) *py.Object -// Return 2 raised to the power of x. -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object) *py.Object -// Return exp(x)-1. -// -// This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x. -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object) *py.Object -// Return the absolute value of the float x. -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object) *py.Object -// Find n!. -// -// Raise a ValueError if x is negative or non-integral. -// -//go:linkname Factorial py.factorial -func Factorial(n *py.Object) *py.Object -// Return the floor of x as an Integral. -// -// This is the largest integer <= x. -// -//go:linkname Floor py.floor -func Floor(x *py.Object) *py.Object -// Return fmod(x, y), according to platform C. -// -// x % y may differ. -// -//go:linkname Fmod py.fmod -func Fmod(x *py.Object, y *py.Object) *py.Object -// Return the mantissa and exponent of x, as pair (m, e). -// -// m is a float and e is an int, such that x = m * 2.**e. -// If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0. -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object) *py.Object -// Return an accurate floating-point sum of values in the iterable seq. -// -// Assumes IEEE-754 floating-point arithmetic. -// -//go:linkname Fsum py.fsum -func Fsum(seq *py.Object) *py.Object -// Gamma function at x. -// -//go:linkname Gamma py.gamma -func Gamma(x *py.Object) *py.Object -// Greatest Common Divisor. -// -//go:linkname Gcd py.gcd -func Gcd(__llgo_va_list ...interface{}) *py.Object -// Return the integer part of the square root of the input. -// -//go:linkname Isqrt py.isqrt -func Isqrt(n *py.Object) *py.Object -// Least Common Multiple. -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// Return x * (2**i). -// -// This is essentially the inverse of frexp(). -// -//go:linkname Ldexp py.ldexp -func Ldexp(x *py.Object, i *py.Object) *py.Object -// Natural logarithm of absolute value of Gamma function at x. -// -//go:linkname Lgamma py.lgamma -func Lgamma(x *py.Object) *py.Object -// Return the base 2 logarithm of x. -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object) *py.Object -// Return the fractional and integer parts of x. -// -// Both results carry the sign of x and are floats. -// -//go:linkname Modf py.modf -func Modf(x *py.Object) *py.Object -// Return x**y (x to the power of y). -// -//go:linkname Pow py.pow -func Pow(x *py.Object, y *py.Object) *py.Object -// Convert angle x from degrees to radians. -// -//go:linkname Radians py.radians -func Radians(x *py.Object) *py.Object -// Difference between x and the closest integer multiple of y. -// -// Return x - n*y where n*y is the closest integer multiple of y. -// In the case where x is exactly halfway between two multiples of -// y, the nearest even value of n is used. The result is always exact. -// -//go:linkname Remainder py.remainder -func Remainder(x *py.Object, y *py.Object) *py.Object -// Return the sine of x (measured in radians). -// -//go:linkname Sin py.sin -func Sin(x *py.Object) *py.Object -// Return the hyperbolic sine of x. -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object) *py.Object -// Return the square root of x. -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object) *py.Object -// Return the tangent of x (measured in radians). -// -//go:linkname Tan py.tan -func Tan(x *py.Object) *py.Object -// Return the hyperbolic tangent of x. -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object) *py.Object -// Return the sum of products of values from two iterables p and q. -// -// Roughly equivalent to: -// -// sum(itertools.starmap(operator.mul, zip(p, q, strict=True))) -// -// For float and mixed int/float inputs, the intermediate products -// and sums are computed with extended precision. -// -//go:linkname Sumprod py.sumprod -func Sumprod(p *py.Object, q *py.Object) *py.Object -// Truncates the Real x to the nearest Integral toward 0. -// -// Uses the __trunc__ magic method. -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object) *py.Object -// Calculate the product of all the elements in the input iterable. -// -// The default start value for the product is 1. -// -// When the iterable is empty, return the start value. This function is -// intended specifically for use with numeric values and may reject -// non-numeric types. -// -//go:linkname Prod py.prod -func Prod(iterable *py.Object) *py.Object -// Number of ways to choose k items from n items without repetition and with order. -// -// Evaluates to n! / (n - k)! when k <= n and evaluates -// to zero when k > n. -// -// If k is not specified or is None, then k defaults to n -// and the function returns n!. -// -// Raises TypeError if either of the arguments are not integers. -// Raises ValueError if either of the arguments are negative. -// -//go:linkname Perm py.perm -func Perm(n *py.Object, k *py.Object) *py.Object -// Number of ways to choose k items from n items without repetition and without order. -// -// Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates -// to zero when k > n. -// -// Also called the binomial coefficient because it is equivalent -// to the coefficient of k-th term in polynomial expansion of the -// expression (1 + x)**n. -// -// Raises TypeError if either of the arguments are not integers. -// Raises ValueError if either of the arguments are negative. -// -//go:linkname Comb py.comb -func Comb(n *py.Object, k *py.Object) *py.Object -// Return the floating-point value the given number of steps after x towards y. -// -// If steps is not specified or is None, it defaults to 1. -// -// Raises a TypeError, if x or y is not a double, or if steps is not an integer. -// Raises ValueError if steps is negative. -// -//go:linkname Nextafter py.nextafter -func Nextafter(x *py.Object, y *py.Object) *py.Object -// Return the value of the least significant bit of the float x. -// -//go:linkname Ulp py.ulp -func Ulp(x *py.Object) *py.Object diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/math4/go.mod b/numpy/go.mod similarity index 55% rename from math4/go.mod rename to numpy/go.mod index 7d6e6402..82bc5445 100644 --- a/math4/go.mod +++ b/numpy/go.mod @@ -1,4 +1,4 @@ -module github.com/goplus/llpkg/math +module github.com/goplus/llpkg/numpy go 1.23 diff --git a/math3/_demo/go.sum b/numpy/go.sum similarity index 100% rename from math3/_demo/go.sum rename to numpy/go.sum diff --git a/math3/llpkg.cfg b/numpy/llpkg.cfg similarity index 81% rename from math3/llpkg.cfg rename to numpy/llpkg.cfg index dd565d41..44e6cd3e 100644 --- a/math3/llpkg.cfg +++ b/numpy/llpkg.cfg @@ -9,8 +9,8 @@ } }, "package": { - "name": "math", - "version": "builtin" + "name": "numpy", + "version": "1.26.4" } } } \ No newline at end of file diff --git a/math3/llpyg.cfg b/numpy/llpyg.cfg similarity index 54% rename from math3/llpyg.cfg rename to numpy/llpyg.cfg index 94275e92..b8888a8d 100644 --- a/math3/llpyg.cfg +++ b/numpy/llpyg.cfg @@ -1,107 +1,134 @@ { - "name": "math", - "module": "math", + "name": "numpy", + "module": "numpy", "python": true, "symMap": { "abs": "Abs", - "acos": "Acos", - "acosh": "Acosh", + "absolute": "Absolute", + "add": "Add", "all": "All", "any": "Any", - "asin": "Asin", - "asinh": "Asinh", - "atan": "Atan", - "atan2": "Atan2", - "atanh": "Atanh", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", "bin": "Bin", "bool": "Bool", - "cbrt": "Cbrt", + "c_": "C", "ceil": "Ceil", "chr": "Chr", - "comb": "Comb", - "copysign": "Copysign", + "corrcoef": "Corrcoef", "cos": "Cos", "cosh": "Cosh", - "degrees": "Degrees", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", "dict": "Dict", "dir": "Dir", - "dist": "Dist", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", "enumerate": "Enumerate", - "erf": "Erf", - "erfc": "Erfc", "exp": "Exp", - "exp2": "Exp2", - "expm1": "Expm1", + "eye": "Eye", "fabs": "Fabs", - "factorial": "Factorial", + "fft": "Fft", "filter": "Filter", "float": "Float", "floor": "Floor", - "fmod": "Fmod", "format": "Format", - "frexp": "Frexp", "frozenset": "FrozenSet", - "fsum": "Fsum", - "gamma": "Gamma", - "gcd": "Gcd", "getattr": "GetAttr", "hasattr": "HasAttr", "hash": "Hash", "help": "Help", "hex": "Hex", "id": "ID", + "identity": "Identity", + "inner": "Inner", "input": "Input", "int": "Int", "isinstance": "IsInstance", "issubclass": "IsSubclass", "iter": "Iter", "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", "list": "List", "locals": "Locals", + "log": "Log", "log10": "Log10", "log2": "Log2", + "logspace": "Logspace", "map": "Map", + "matmul": "Matmul", "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", "min": "Min", - "modf": "Modf", + "mod": "Mod", + "multiply": "Multiply", "next": "Next", - "nextafter": "Nextafter", "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", "open": "Open", "ord": "Ord", - "perm": "Perm", + "outer": "Outer", + "percentile": "Percentile", "pow": "Pow", + "power": "Power", "print": "Print", "prod": "Prod", - "radians": "Radians", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", "range": "Range", "remainder": "Remainder", "repr": "Repr", "reversed": "Reversed", + "rint": "Rint", "round": "Round", "set": "Set", "setattr": "SetAttr", + "sign": "Sign", "sin": "Sin", "sinh": "Sinh", "sorted": "Sorted", "sqrt": "Sqrt", + "std": "Std", "str": "Str", + "subtract": "Subtract", "sum": "Sum", - "sumprod": "Sumprod", "tan": "Tan", "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", "trunc": "Trunc", "tuple": "Tuple", "type": "Type", - "ulp": "Ulp", + "vander": "Vander", + "var": "Var", "vars": "Vars", + "zeros": "Zeros", "zip": "Zip" }, "deps": [ "py" ], "include": [ - "math" + "numpy" ], "exclude": [ "__builtins__", @@ -114,10 +141,15 @@ "__spec__" ], "constants": { + "bool_": "Bool", "e": "E", + "float32": "Float32", + "float64": "Float64", "inf": "Inf", + "int32": "Int32", + "int64": "Int64", "nan": "NaN", "pi": "Pi", - "tau": "Tau" + "uint8": "Uint8" } } \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/math4/math_autogen_link.go b/numpy/numpy_autogen_link.go similarity index 86% rename from math4/math_autogen_link.go rename to numpy/numpy_autogen_link.go index 1f657e14..bb5882ce 100644 --- a/math4/math_autogen_link.go +++ b/numpy/numpy_autogen_link.go @@ -1,4 +1,4 @@ -package math +package numpy import _ "github.com/goplus/lib/py" From 0865196aea25365eb4caadc11ce9031fec36f869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 09:47:52 +0800 Subject: [PATCH 20/88] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=AE=BE=E7=BD=AE=20PY?= =?UTF-8?q?THONPATH=20=E5=88=B0=E6=AD=A3=E7=A1=AE=E7=9A=84=20site-packages?= =?UTF-8?q?=20=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/verification.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index f37b525e..4e51b88d 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -108,16 +108,23 @@ jobs: go install -v ./chore/... - name: Set up Python environment run: | - echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages" >> $GITHUB_ENV echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV - name: Install Python dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | python3 -m pip install numpy==1.26.4 + python3 -c "import numpy; print('numpy version:', numpy.__version__)" + python3 -c "import site; print('site-packages:', site.getsitepackages())" + # Set PYTHONPATH for llpyg + echo "PYTHONPATH=$(python3 -c 'import site; print(\":\".join(site.getsitepackages()))')" >> $GITHUB_ENV - name: Install Python dependencies (macOS) if: startsWith(matrix.os, 'macos') run: | python3 -m pip install numpy==1.26.4 --break-system-packages + python3 -c "import numpy; print('numpy version:', numpy.__version__)" + python3 -c "import site; print('site-packages:', site.getsitepackages())" + # Set PYTHONPATH for llpyg + echo "PYTHONPATH=$(python3 -c 'import site; print(\":\".join(site.getsitepackages()))')" >> $GITHUB_ENV - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 From 20d01d6078bd714cb5cf06f314f015bd8f437773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 10:04:01 +0800 Subject: [PATCH 21/88] 111 --- .DS_Store | Bin 6148 -> 6148 bytes math3/llpkg.cfg | 16 ++++++++++++++++ math4/llpkg.cfg | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 math3/llpkg.cfg create mode 100644 math4/llpkg.cfg diff --git a/.DS_Store b/.DS_Store index 1d0aef2a9db168ea05c7039ec177006983748397..9b61488c2eeebae87cea9266a3ee9400836115c8 100644 GIT binary patch delta 553 zcmaJ<&r1S96n?X6j{VRDH|x03RcukQqEmMA7H(8fA-gKNxXzfnwuFcmPjykecZqI6 z#9o5_kN%a8_Eyc5qBk(}X6Ad}d+(d+DLthh6a34A>)0T%MWV0A@8nVR3nc2U3PrLJ z0TV|9YES_SY~av@G9-q5A=VWt0Prvx8+rf%sDp-}Dx`8IFX|@O@l*u(4|$_DnaP>Q zMHV>HiyZKRfbd+l?oYb3?pTd!x;MRH8kVgnA4Kr^14}^~q$~7Ft#U`THM?bHwdRGl zJK@~azkN+VHOfvwl#V#FHG`F#;{c;nM#$xv!Aji8@)j#u<5(3hx_CoFG*l2b+wIJ5 zDlRAYlAXBR-cKrVIi1RMIw88gy>pN+)XX~Lci0^o@w)VEZL-Yfd-Ud7`lSnl7V6u8 z+o>+Osko3wQfVU0XoMtTm_eZcDUhLv?}mZsCI1q2Sn@r&K^md>5nST`^bI4@A;mfc LuQ>NydiH$*XHkvK delta 68 zcmZoMXfc=|#>B)qu~2NHo+2an#(>?7jNF@fSdtkh=d#b*tibV)c{4i)KL=3FW Date: Fri, 15 Aug 2025 10:10:56 +0800 Subject: [PATCH 22/88] de --- math3/llpkg.cfg | 16 - math4/llpkg.cfg | 16 - numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 9 files changed, 9796 deletions(-) delete mode 100644 math3/llpkg.cfg delete mode 100644 math4/llpkg.cfg delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/math3/llpkg.cfg b/math3/llpkg.cfg deleted file mode 100644 index dd565d41..00000000 --- a/math3/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "math", - "version": "builtin" - } - } -} \ No newline at end of file diff --git a/math4/llpkg.cfg b/math4/llpkg.cfg deleted file mode 100644 index dd565d41..00000000 --- a/math4/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "math", - "version": "builtin" - } - } -} \ No newline at end of file diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From bafea54b4c8dca323e92271ce6a8d1772b940ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 10:26:53 +0800 Subject: [PATCH 23/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 7 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From 97729177bd78a15a93c4d3100db77f7ce66ae10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 10:30:19 +0800 Subject: [PATCH 24/88] del --- numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 7 files changed, 9764 deletions(-) delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From 68ab221c94bf0438c289461b1dd32815f3144391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 10:37:57 +0800 Subject: [PATCH 25/88] yml --- .github/workflows/issueclose.yml | 2 +- .github/workflows/labelcreate.yml | 2 +- .github/workflows/postprocessing.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issueclose.yml b/.github/workflows/issueclose.yml index b81f23a0..cbacdda8 100644 --- a/.github/workflows/issueclose.yml +++ b/.github/workflows/issueclose.yml @@ -19,7 +19,7 @@ jobs: with: go-version: 1.23.x - name: Set up Tool - run: go install -v github.com/goplus/llpkgstore/cmd/llpkgstore@latest + run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest - name: Run cleaner process env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labelcreate.yml b/.github/workflows/labelcreate.yml index 258eed4a..ddd7826d 100644 --- a/.github/workflows/labelcreate.yml +++ b/.github/workflows/labelcreate.yml @@ -29,7 +29,7 @@ jobs: with: go-version: 1.23.x - name: Set up Tool - run: go install -v github.com/goplus/llpkgstore/cmd/llpkgstore@latest + run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest - name: Copy llpkgstore.json to root continue-on-error: true run: | diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index b28a2428..dccb945b 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -35,7 +35,7 @@ jobs: with: go-version: 1.23.x - name: Set up Tool - run: go install -v github.com/goplus/llpkgstore/cmd/llpkgstore@latest + run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | @@ -73,7 +73,7 @@ jobs: with: go-version: 1.23.x - name: Set up Tool - run: go install -v github.com/goplus/llpkgstore/cmd/llpkgstore@latest + run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest - name: Checkout to website uses: actions/checkout@v4 with: From f87fe1afe4238e111d09474323f99007156f72c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 10:41:16 +0800 Subject: [PATCH 26/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 8 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpkgstore.json create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json new file mode 100644 index 00000000..e69de29b diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From 7f7bee18456f64b73092c7a993dd7dc989340452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:01:17 +0800 Subject: [PATCH 27/88] del --- .DS_Store | Bin 6148 -> 8196 bytes numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 9 files changed, 9764 deletions(-) delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpkgstore.json delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/.DS_Store b/.DS_Store index 9b61488c2eeebae87cea9266a3ee9400836115c8..8ff5bcb064c2001c1dc16080beaa9d5b3ac72291 100644 GIT binary patch delta 636 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aKKDhHAW@);O17)lwE%7TmXa`HC| za)_~PR^aGmUd+zHF|mO~9;A$&L60GwA(Np5S!rH6$bii}EDISWSr~E|5<$|QIr+&+ zIr&K-i-5ASlX=)AH*aSRVw8j`U@%2f(hX7)YKA8I6R4T*KNtXwVqjop$OAeum!W{6 z5>2H(P^AoZm6O%j8aNCM40RNY49zF6V{@#B8x&IwCheg@B5J3``qb5Wau}HzW*!MzbSi7~&ZWQT@mS3~5AYOx9z+xv}94 zqaZWH-4fhD+7%SBz{vZ~Jegm_bFx1V2L~{2L2=G7Ii6>FGLq-8ISgStrS3Y(2ml|@ BmLmWF delta 150 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50C@c(;2a6eb=Hw?Q<>V)AEL_RV zD7;xqU?JmVSt0Jt{{#aWCodKj=VJ&0sulSU1(TCRZ!Tu%;1Fa68UX|X+(5z=Wc0?u Z@640=WjsL^F)%?a1-XM^b3D%+W&n_rAnO1C diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json deleted file mode 100644 index e69de29b..00000000 diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From 337a712b8db84c46490c092ac60dff740f5a29bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:04:16 +0800 Subject: [PATCH 28/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 8 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpkgstore.json create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json new file mode 100644 index 00000000..e69de29b diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From d71abbdc152daf49a65b4aaf7d694926abc85e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:20:12 +0800 Subject: [PATCH 29/88] =?UTF-8?q?de=20=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 8 files changed, 9764 deletions(-) delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpkgstore.json delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json deleted file mode 100644 index e69de29b..00000000 diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From 1a7023e151d3ebea933da44ad9c826956d440543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:36:17 +0800 Subject: [PATCH 30/88] ALL_CHANGED_FILES --- .github/workflows/verification.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 4e51b88d..028f9f45 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -128,10 +128,21 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 + with: + files: | + **/llpkg.cfg + **/llpyg.cfg + **/llcppg.cfg + **/*.go + - name: Debug changed files + run: | + echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" + echo "Any changed: ${{ steps.changed-files.outputs.any_changed }}" + echo "All changed: ${{ steps.changed-files.outputs.all_changed }}" - name: Verification & Prebuilt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} run: llpkgstore verification - name: Run demotest process env: From 203cf4bb93cbc50ba6d2ba2883c70b2384f9837a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:39:24 +0800 Subject: [PATCH 31/88] all_changed_files --- .github/workflows/verification.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 4e51b88d..028f9f45 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -128,10 +128,21 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 + with: + files: | + **/llpkg.cfg + **/llpyg.cfg + **/llcppg.cfg + **/*.go + - name: Debug changed files + run: | + echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" + echo "Any changed: ${{ steps.changed-files.outputs.any_changed }}" + echo "All changed: ${{ steps.changed-files.outputs.all_changed }}" - name: Verification & Prebuilt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} run: llpkgstore verification - name: Run demotest process env: From 9b6288537b4126f593fa3cfb116d70c0dba01c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:41:24 +0800 Subject: [PATCH 32/88] del --- numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 8 files changed, 9764 deletions(-) delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpkgstore.json delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json deleted file mode 100644 index e69de29b..00000000 diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From b37c92f17343f076d6b9e36cca57218c6efdad63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:42:59 +0800 Subject: [PATCH 33/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 8 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpkgstore.json create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json new file mode 100644 index 00000000..e69de29b diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From 150ebee4624209b8b87e6a00122c32c8661b7563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:49:32 +0800 Subject: [PATCH 34/88] d --- numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 8 files changed, 9764 deletions(-) delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpkgstore.json delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json deleted file mode 100644 index e69de29b..00000000 diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From 3467594c147552212483e8ec5cd4f9317811363c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 11:50:58 +0800 Subject: [PATCH 35/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 8 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpkgstore.json create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json new file mode 100644 index 00000000..e69de29b diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From 5d97915f58c2202273f95c0eddf796203b0f1a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 12:06:34 +0800 Subject: [PATCH 36/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 8 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpkgstore.json create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json new file mode 100644 index 00000000..e69de29b diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From b61f252a4d84f7b028dfa04fe8488a30f3382ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 14:25:12 +0800 Subject: [PATCH 37/88] name: Verification & Prebuilt --- .github/workflows/verification.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 028f9f45..642ba84c 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -139,12 +139,12 @@ jobs: echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" echo "Any changed: ${{ steps.changed-files.outputs.any_changed }}" echo "All changed: ${{ steps.changed-files.outputs.all_changed }}" - - name: Verification & Prebuilt - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} - run: llpkgstore verification - - name: Run demotest process - env: - LLPKG_PATH: ${{ env.LLPKG_PATH }} - run: llpkgstore demotest + # - name: Verification & Prebuilt + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} + # run: llpkgstore verification + # - name: Run demotest process + # env: + # LLPKG_PATH: ${{ env.LLPKG_PATH }} + # run: llpkgstore demotest From b25359d06d6cb083fda296b465c8eed6688072c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 15:02:18 +0800 Subject: [PATCH 38/88] 11 --- llpkgstore.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 llpkgstore.json diff --git a/llpkgstore.json b/llpkgstore.json new file mode 100644 index 00000000..e69de29b From b27c17a5f59eea7813a34bc5cb58ed02da6c3b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 15:18:26 +0800 Subject: [PATCH 39/88] Release-as: numpy/v1.26.4 --- numpy/_demo/main.go | 9 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 16 + numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 + numpy/numpy.go | 9572 +++++++++++++++++++++++++++++++++++ numpy/numpy_autogen_link.go | 5 + 8 files changed, 9764 insertions(+) create mode 100644 numpy/_demo/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpkgstore.json create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go create mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go new file mode 100644 index 00000000..15eded01 --- /dev/null +++ b/numpy/_demo/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..82bc5445 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/goplus/llpkg/numpy + +go 1.23 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..44e6cd3e --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,16 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "python_version": "3.12", + "index_url": "https://pypi.org/simple/" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json new file mode 100644 index 00000000..e69de29b diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..b8888a8d --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,155 @@ +{ + "name": "numpy", + "module": "numpy", + "python": true, + "symMap": { + "abs": "Abs", + "absolute": "Absolute", + "add": "Add", + "all": "All", + "any": "Any", + "arange": "Arange", + "arccos": "Arccos", + "arccosh": "Arccosh", + "arcsin": "Arcsin", + "arcsinh": "Arcsinh", + "arctan": "Arctan", + "arctanh": "Arctanh", + "array": "Array", + "average": "Average", + "bin": "Bin", + "bool": "Bool", + "c_": "C", + "ceil": "Ceil", + "chr": "Chr", + "corrcoef": "Corrcoef", + "cos": "Cos", + "cosh": "Cosh", + "cov": "Cov", + "cross": "Cross", + "diag": "Diag", + "dict": "Dict", + "dir": "Dir", + "divide": "Divide", + "dot": "Dot", + "einsum": "Einsum", + "empty": "Empty", + "enumerate": "Enumerate", + "exp": "Exp", + "eye": "Eye", + "fabs": "Fabs", + "fft": "Fft", + "filter": "Filter", + "float": "Float", + "floor": "Floor", + "format": "Format", + "frozenset": "FrozenSet", + "getattr": "GetAttr", + "hasattr": "HasAttr", + "hash": "Hash", + "help": "Help", + "hex": "Hex", + "id": "ID", + "identity": "Identity", + "inner": "Inner", + "input": "Input", + "int": "Int", + "isinstance": "IsInstance", + "issubclass": "IsSubclass", + "iter": "Iter", + "len": "Len", + "linalg": "Linalg", + "linspace": "Linspace", + "list": "List", + "locals": "Locals", + "log": "Log", + "log10": "Log10", + "log2": "Log2", + "logspace": "Logspace", + "map": "Map", + "matmul": "Matmul", + "max": "Max", + "mean": "Mean", + "median": "Median", + "meshgrid": "Meshgrid", + "mgrid": "Mgrid", + "min": "Min", + "mod": "Mod", + "multiply": "Multiply", + "next": "Next", + "oct": "Oct", + "ogrid": "Ogrid", + "ones": "Ones", + "open": "Open", + "ord": "Ord", + "outer": "Outer", + "percentile": "Percentile", + "pow": "Pow", + "power": "Power", + "print": "Print", + "prod": "Prod", + "ptp": "Ptp", + "quantile": "Quantile", + "r_": "R", + "random": "Random", + "range": "Range", + "remainder": "Remainder", + "repr": "Repr", + "reversed": "Reversed", + "rint": "Rint", + "round": "Round", + "set": "Set", + "setattr": "SetAttr", + "sign": "Sign", + "sin": "Sin", + "sinh": "Sinh", + "sorted": "Sorted", + "sqrt": "Sqrt", + "std": "Std", + "str": "Str", + "subtract": "Subtract", + "sum": "Sum", + "tan": "Tan", + "tanh": "Tanh", + "tensordot": "Tensordot", + "tri": "Tri", + "tril": "Tril", + "triu": "Triu", + "trunc": "Trunc", + "tuple": "Tuple", + "type": "Type", + "vander": "Vander", + "var": "Var", + "vars": "Vars", + "zeros": "Zeros", + "zip": "Zip" + }, + "deps": [ + "py" + ], + "include": [ + "numpy" + ], + "exclude": [ + "__builtins__", + "__cached__", + "__doc__", + "__file__", + "__loader__", + "__name__", + "__package__", + "__spec__" + ], + "constants": { + "bool_": "Bool", + "e": "E", + "float32": "Float32", + "float64": "Float64", + "inf": "Inf", + "int32": "Int32", + "int64": "Int64", + "nan": "NaN", + "pi": "Pi", + "uint8": "Uint8" + } +} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..7cfce191 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,9572 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse cosine, element-wise. +// +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. +// +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(__llgo_va_list ...interface{}) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(__llgo_va_list ...interface{}) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(__llgo_va_list ...interface{}) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(__llgo_va_list ...interface{}) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(__llgo_va_list ...interface{}) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(__llgo_va_list ...interface{}) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(__llgo_va_list ...interface{}) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(__llgo_va_list ...interface{}) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(__llgo_va_list ...interface{}) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(__llgo_va_list ...interface{}) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(__llgo_va_list ...interface{}) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(__llgo_va_list ...interface{}) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(__llgo_va_list ...interface{}) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(__llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(__llgo_va_list ...interface{}) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(__llgo_va_list ...interface{}) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(__llgo_va_list ...interface{}) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(__llgo_va_list ...interface{}) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(__llgo_va_list ...interface{}) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(__llgo_va_list ...interface{}) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(__llgo_va_list ...interface{}) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(__llgo_va_list ...interface{}) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(__llgo_va_list ...interface{}) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(__llgo_va_list ...interface{}) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(__llgo_va_list ...interface{}) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(__llgo_va_list ...interface{}) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(__llgo_va_list ...interface{}) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(__llgo_va_list ...interface{}) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(__llgo_va_list ...interface{}) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(__llgo_va_list ...interface{}) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(__llgo_va_list ...interface{}) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(__llgo_va_list ...interface{}) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(__llgo_va_list ...interface{}) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(__llgo_va_list ...interface{}) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(__llgo_va_list ...interface{}) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(__llgo_va_list ...interface{}) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass py.issubclass_ +func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go new file mode 100644 index 00000000..bb5882ce --- /dev/null +++ b/numpy/numpy_autogen_link.go @@ -0,0 +1,5 @@ +package numpy + +import _ "github.com/goplus/lib/py" + +// LLGoPackage is defined in the main binding file From d9d8bb8edf0adcf388ae7fd518bdff2e77560f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 16:41:35 +0800 Subject: [PATCH 40/88] yml_8.15 --- .github/workflows/verification.yml | 73 ++++++++++++++++-------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 642ba84c..2565ee11 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -24,8 +24,6 @@ jobs: - ubuntu-24.04 - ubuntu-24.04-arm llvm: [19] - llgo: [e68355d94f9f9ec17caae6e0d397bd55f8c5ec33] - llcppg: [v0.7.3] runs-on: ${{matrix.os}} steps: @@ -34,15 +32,15 @@ jobs: - name: Check out LLGo uses: actions/checkout@v4 with: - repository: 'goplus/llgo' + repository: '1351914167/llgo' path: .llgo - ref: ${{matrix.llgo}} - - name: Check out LLCppg + ref: go_get_v1 + - name: Check out LLPyg uses: actions/checkout@v4 with: - repository: 'goplus/llcppg' - path: .llcppg - ref: ${{matrix.llcppg}} + repository: 'toaction/llpyg' + path: .llpyg + ref: feat/llpyg_v2 - name: Set up Go uses: actions/setup-go@v4 with: @@ -89,42 +87,46 @@ jobs: - name: Setup LLGo working-directory: .llgo run: | - go install -v ./cmd/llgo/... + ./install.sh export LLGO_ROOT=$(pwd) echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV # https://github.com/goplus/llgo/issues/1135 echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV - - name: Setup LLCppg (for C/C++ packages) - working-directory: .llcppg + - name: Setup LLPyg + working-directory: .llpyg run: | - llgo install ./_xtool/llcppsymg - llgo install ./_xtool/llcppsigfetch - go install github.com/goplus/llcppg/cmd/llcppcfg@${{matrix.llcppg}} - go install github.com/goplus/llcppg/cmd/gogensig@${{matrix.llcppg}} - go install github.com/goplus/llcppg/cmd/llcppg@${{matrix.llcppg}} - - name: Setup LLPyg (for Python packages) - working-directory: .llgo - run: | - go install -v ./chore/... + cd _xtool + llgo install ./... + cd .. + go install -v ./cmd/... - name: Set up Python environment run: | echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + # Set up Python environment as per llpyg guide + export PYTHONHOME=$LLGO_ROOT/python + export PATH=$PYTHONHOME/bin:$PATH + export DYLD_LIBRARY_PATH=$PYTHONHOME/lib + export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig + echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV - name: Install Python dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | python3 -m pip install numpy==1.26.4 python3 -c "import numpy; print('numpy version:', numpy.__version__)" python3 -c "import site; print('site-packages:', site.getsitepackages())" - # Set PYTHONPATH for llpyg - echo "PYTHONPATH=$(python3 -c 'import site; print(\":\".join(site.getsitepackages()))')" >> $GITHUB_ENV + # Set PYTHONPATH for llpyg using LLGo's Python environment + echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV - name: Install Python dependencies (macOS) if: startsWith(matrix.os, 'macos') run: | python3 -m pip install numpy==1.26.4 --break-system-packages python3 -c "import numpy; print('numpy version:', numpy.__version__)" python3 -c "import site; print('site-packages:', site.getsitepackages())" - # Set PYTHONPATH for llpyg - echo "PYTHONPATH=$(python3 -c 'import site; print(\":\".join(site.getsitepackages()))')" >> $GITHUB_ENV + # Set PYTHONPATH for llpyg using LLGo's Python environment + echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 @@ -139,12 +141,17 @@ jobs: echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" echo "Any changed: ${{ steps.changed-files.outputs.any_changed }}" echo "All changed: ${{ steps.changed-files.outputs.all_changed }}" - # - name: Verification & Prebuilt - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} - # run: llpkgstore verification - # - name: Run demotest process - # env: - # LLPKG_PATH: ${{ env.LLPKG_PATH }} - # run: llpkgstore demotest + - name: Test llpyg generation + run: | + # Test llpyg with numpy as per guide + llpyg numpy + echo "llpyg generation completed successfully" + - name: Verification & Prebuilt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} + run: llpkgstore verification + - name: Run demotest process + env: + LLPKG_PATH: ${{ env.LLPKG_PATH }} + run: llpkgstore demotest From 254716bca47fcdd8ca0242c53c8463073ec90b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 17:28:24 +0800 Subject: [PATCH 41/88] 815 --- .github/workflows/verification.yml | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 2565ee11..c8ff1100 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -74,13 +74,13 @@ jobs: run: | sudo apt install -y python3 python3-pip python3 -m pip install --upgrade pip - python3 -m pip install conan pydump - go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 + # python3 -m pip install conan pydump + # go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - name: Pre setup Python and Conan if: startsWith(matrix.os, 'macos') run: | python3 -m pip install conan pydump --break-system-packages - go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 + # go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - name: Set up Conan run: | conan profile detect @@ -114,25 +114,25 @@ jobs: - name: Install Python dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - python3 -m pip install numpy==1.26.4 - python3 -c "import numpy; print('numpy version:', numpy.__version__)" - python3 -c "import site; print('site-packages:', site.getsitepackages())" + # python3 -m pip install numpy==1.26.4 + # python3 -c "import numpy; print('numpy version:', numpy.__version__)" + # python3 -c "import site; print('site-packages:', site.getsitepackages())" # Set PYTHONPATH for llpyg using LLGo's Python environment echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV - name: Install Python dependencies (macOS) if: startsWith(matrix.os, 'macos') run: | - python3 -m pip install numpy==1.26.4 --break-system-packages - python3 -c "import numpy; print('numpy version:', numpy.__version__)" - python3 -c "import site; print('site-packages:', site.getsitepackages())" - # Set PYTHONPATH for llpyg using LLGo's Python environment + # python3 -m pip install numpy==1.26.4 --break-system-packages + # python3 -c "import numpy; print('numpy version:', numpy.__version__)" + # python3 -c "import site; print('site-packages:', site.getsitepackages())" + # # Set PYTHONPATH for llpyg using LLGo's Python environment echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 with: files: | - **/llpkg.cfg + # **/llpkg.cfg **/llpyg.cfg **/llcppg.cfg **/*.go @@ -146,12 +146,12 @@ jobs: # Test llpyg with numpy as per guide llpyg numpy echo "llpyg generation completed successfully" - - name: Verification & Prebuilt - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} - run: llpkgstore verification - - name: Run demotest process - env: - LLPKG_PATH: ${{ env.LLPKG_PATH }} - run: llpkgstore demotest + # - name: Verification & Prebuilt + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} + # run: llpkgstore verification + # - name: Run demotest process + # env: + # LLPKG_PATH: ${{ env.LLPKG_PATH }} + # run: llpkgstore demotest From 03237a62d2cc0f0e80f335823bfc406d31d6b439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 17:37:56 +0800 Subject: [PATCH 42/88] del --- numpy/_demo/main.go | 9 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 16 - numpy/llpkgstore.json | 0 numpy/llpyg.cfg | 155 - numpy/numpy.go | 9572 ----------------------------------- numpy/numpy_autogen_link.go | 5 - 8 files changed, 9764 deletions(-) delete mode 100644 numpy/_demo/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpkgstore.json delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 numpy/numpy_autogen_link.go diff --git a/numpy/_demo/main.go b/numpy/_demo/main.go deleted file mode 100644 index 15eded01..00000000 --- a/numpy/_demo/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("Hello, World!") -} \ No newline at end of file diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 82bc5445..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/numpy - -go 1.23 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index 44e6cd3e..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "python_version": "3.12", - "index_url": "https://pypi.org/simple/" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpkgstore.json b/numpy/llpkgstore.json deleted file mode 100644 index e69de29b..00000000 diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index b8888a8d..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "numpy", - "module": "numpy", - "python": true, - "symMap": { - "abs": "Abs", - "absolute": "Absolute", - "add": "Add", - "all": "All", - "any": "Any", - "arange": "Arange", - "arccos": "Arccos", - "arccosh": "Arccosh", - "arcsin": "Arcsin", - "arcsinh": "Arcsinh", - "arctan": "Arctan", - "arctanh": "Arctanh", - "array": "Array", - "average": "Average", - "bin": "Bin", - "bool": "Bool", - "c_": "C", - "ceil": "Ceil", - "chr": "Chr", - "corrcoef": "Corrcoef", - "cos": "Cos", - "cosh": "Cosh", - "cov": "Cov", - "cross": "Cross", - "diag": "Diag", - "dict": "Dict", - "dir": "Dir", - "divide": "Divide", - "dot": "Dot", - "einsum": "Einsum", - "empty": "Empty", - "enumerate": "Enumerate", - "exp": "Exp", - "eye": "Eye", - "fabs": "Fabs", - "fft": "Fft", - "filter": "Filter", - "float": "Float", - "floor": "Floor", - "format": "Format", - "frozenset": "FrozenSet", - "getattr": "GetAttr", - "hasattr": "HasAttr", - "hash": "Hash", - "help": "Help", - "hex": "Hex", - "id": "ID", - "identity": "Identity", - "inner": "Inner", - "input": "Input", - "int": "Int", - "isinstance": "IsInstance", - "issubclass": "IsSubclass", - "iter": "Iter", - "len": "Len", - "linalg": "Linalg", - "linspace": "Linspace", - "list": "List", - "locals": "Locals", - "log": "Log", - "log10": "Log10", - "log2": "Log2", - "logspace": "Logspace", - "map": "Map", - "matmul": "Matmul", - "max": "Max", - "mean": "Mean", - "median": "Median", - "meshgrid": "Meshgrid", - "mgrid": "Mgrid", - "min": "Min", - "mod": "Mod", - "multiply": "Multiply", - "next": "Next", - "oct": "Oct", - "ogrid": "Ogrid", - "ones": "Ones", - "open": "Open", - "ord": "Ord", - "outer": "Outer", - "percentile": "Percentile", - "pow": "Pow", - "power": "Power", - "print": "Print", - "prod": "Prod", - "ptp": "Ptp", - "quantile": "Quantile", - "r_": "R", - "random": "Random", - "range": "Range", - "remainder": "Remainder", - "repr": "Repr", - "reversed": "Reversed", - "rint": "Rint", - "round": "Round", - "set": "Set", - "setattr": "SetAttr", - "sign": "Sign", - "sin": "Sin", - "sinh": "Sinh", - "sorted": "Sorted", - "sqrt": "Sqrt", - "std": "Std", - "str": "Str", - "subtract": "Subtract", - "sum": "Sum", - "tan": "Tan", - "tanh": "Tanh", - "tensordot": "Tensordot", - "tri": "Tri", - "tril": "Tril", - "triu": "Triu", - "trunc": "Trunc", - "tuple": "Tuple", - "type": "Type", - "vander": "Vander", - "var": "Var", - "vars": "Vars", - "zeros": "Zeros", - "zip": "Zip" - }, - "deps": [ - "py" - ], - "include": [ - "numpy" - ], - "exclude": [ - "__builtins__", - "__cached__", - "__doc__", - "__file__", - "__loader__", - "__name__", - "__package__", - "__spec__" - ], - "constants": { - "bool_": "Bool", - "e": "E", - "float32": "Float32", - "float64": "Float64", - "inf": "Inf", - "int32": "Int32", - "int64": "Int64", - "nan": "NaN", - "pi": "Pi", - "uint8": "Uint8" - } -} \ No newline at end of file diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 7cfce191..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,9572 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(__llgo_va_list ...interface{}) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(__llgo_va_list ...interface{}) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(__llgo_va_list ...interface{}) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(__llgo_va_list ...interface{}) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(__llgo_va_list ...interface{}) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(__llgo_va_list ...interface{}) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(__llgo_va_list ...interface{}) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(__llgo_va_list ...interface{}) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(__llgo_va_list ...interface{}) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(__llgo_va_list ...interface{}) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(__llgo_va_list ...interface{}) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(__llgo_va_list ...interface{}) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(__llgo_va_list ...interface{}) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(__llgo_va_list ...interface{}) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(__llgo_va_list ...interface{}) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(__llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(__llgo_va_list ...interface{}) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(__llgo_va_list ...interface{}) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(__llgo_va_list ...interface{}) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(__llgo_va_list ...interface{}) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(__llgo_va_list ...interface{}) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(__llgo_va_list ...interface{}) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(__llgo_va_list ...interface{}) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(__llgo_va_list ...interface{}) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(__llgo_va_list ...interface{}) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(__llgo_va_list ...interface{}) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(__llgo_va_list ...interface{}) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(__llgo_va_list ...interface{}) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(__llgo_va_list ...interface{}) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(__llgo_va_list ...interface{}) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(__llgo_va_list ...interface{}) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(__llgo_va_list ...interface{}) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(__llgo_va_list ...interface{}) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(__llgo_va_list ...interface{}) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(__llgo_va_list ...interface{}) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(__llgo_va_list ...interface{}) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(__llgo_va_list ...interface{}) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(__llgo_va_list ...interface{}) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(__llgo_va_list ...interface{}) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass py.issubclass_ -func Issubclass(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/numpy/numpy_autogen_link.go b/numpy/numpy_autogen_link.go deleted file mode 100644 index bb5882ce..00000000 --- a/numpy/numpy_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package numpy - -import _ "github.com/goplus/lib/py" - -// LLGoPackage is defined in the main binding file From 68fc5d9c1012db1ec88d95a23e0918bf586c879d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 17:47:29 +0800 Subject: [PATCH 43/88] 8_15_17 --- .github/workflows/verification.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index c8ff1100..043bbacb 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -81,9 +81,9 @@ jobs: run: | python3 -m pip install conan pydump --break-system-packages # go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - - name: Set up Conan - run: | - conan profile detect + # - name: Set up Conan + # run: | + # conan profile detect - name: Setup LLGo working-directory: .llgo run: | From fc55c56b3b0d57bbf7584d43c736bee53df2ddba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 18:17:09 +0800 Subject: [PATCH 44/88] 18.17 --- .github/workflows/verification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 043bbacb..39931181 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -40,7 +40,7 @@ jobs: with: repository: 'toaction/llpyg' path: .llpyg - ref: feat/llpyg_v2 + ref: feat/llpyg_v3 - name: Set up Go uses: actions/setup-go@v4 with: From 095b61f72554f09c6aee1f65a2c3d135e8a8045b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 18:36:47 +0800 Subject: [PATCH 45/88] 8.15 --- .DS_Store | Bin 8196 -> 8196 bytes .github/workflows/verification.yml | 45 +++++++++++++++-------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.DS_Store b/.DS_Store index 8ff5bcb064c2001c1dc16080beaa9d5b3ac72291..17fa08ef34dd67a02f00f7f0f6ea805ce834d718 100644 GIT binary patch delta 41 xcmZp1XmOa}&nUJrU^hRb*k&GqsmznjMdwUr6jR%r%(H}fGrPnOmW@@c%m5S34BY?# delta 388 zcmZp1XmOa}&nUMsU^hRb+-4qusm!LV40#Nt47m&i43(Za`N>H+`AG~63<3-cjQT(< z^B)X=A`A>jDktX%HE> $GITHUB_ENV # https://github.com/goplus/llgo/issues/1135 echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV - - name: Setup LLPyg - working-directory: .llpyg - run: | - cd _xtool - llgo install ./... - cd .. - go install -v ./cmd/... - name: Set up Python environment run: | echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV @@ -111,22 +104,30 @@ jobs: echo "PATH=$PATH" >> $GITHUB_ENV echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV - - name: Install Python dependencies (Ubuntu) - if: startsWith(matrix.os, 'ubuntu') - run: | - # python3 -m pip install numpy==1.26.4 - # python3 -c "import numpy; print('numpy version:', numpy.__version__)" - # python3 -c "import site; print('site-packages:', site.getsitepackages())" - # Set PYTHONPATH for llpyg using LLGo's Python environment - echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV - - name: Install Python dependencies (macOS) - if: startsWith(matrix.os, 'macos') + - name: Setup LLPyg + working-directory: .llpyg run: | - # python3 -m pip install numpy==1.26.4 --break-system-packages - # python3 -c "import numpy; print('numpy version:', numpy.__version__)" - # python3 -c "import site; print('site-packages:', site.getsitepackages())" - # # Set PYTHONPATH for llpyg using LLGo's Python environment - echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV + cd _xtool + llgo install ./... + cd .. + go install -v ./cmd/... + + # - name: Install Python dependencies (Ubuntu) + # if: startsWith(matrix.os, 'ubuntu') + # run: | + # # python3 -m pip install numpy==1.26.4 + # # python3 -c "import numpy; print('numpy version:', numpy.__version__)" + # # python3 -c "import site; print('site-packages:', site.getsitepackages())" + # # Set PYTHONPATH for llpyg using LLGo's Python environment + # echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV + # - name: Install Python dependencies (macOS) + # if: startsWith(matrix.os, 'macos') + # run: | + # # python3 -m pip install numpy==1.26.4 --break-system-packages + # # python3 -c "import numpy; print('numpy version:', numpy.__version__)" + # # python3 -c "import site; print('site-packages:', site.getsitepackages())" + # # # Set PYTHONPATH for llpyg using LLGo's Python environment + # echo "PYTHONPATH=$PYTHONHOME/lib/python3.12/site-packages" >> $GITHUB_ENV - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 From e1ac72c71c72b83e68cc0df7d1b589613266d7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 18:59:54 +0800 Subject: [PATCH 46/88] 18_59 --- .github/workflows/verification.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 0f844bb4..cb894fa3 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -20,9 +20,9 @@ jobs: matrix: os: - macos-13 - - macos-latest - - ubuntu-24.04 - - ubuntu-24.04-arm + # - macos-latest + # - ubuntu-24.04 + # - ubuntu-24.04-arm llvm: [19] runs-on: ${{matrix.os}} From a512e34b588a585023e0cc58ab03648741357dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=A7=80=E7=85=8C?= Date: Fri, 15 Aug 2025 19:04:02 +0800 Subject: [PATCH 47/88] Release-as: numpy/v1.26.4 --- numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpyg.cfg | 8 + numpy/numpy.go | 27200 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 27215 insertions(+) create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..c3e8b3d3 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/Bigdata-shiyang/test/numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..096a39c3 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,8 @@ +{ + "name": "numpy", + "libName": "numpy", + "libVersion": "1.26.4", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..303742a9 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27200 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// +// Gives a new shape to an array without changing its data. +// +// Parameters +// ---------- +// a : array_like +// Array to be reshaped. +// newshape : int or tuple of ints +// The new shape should be compatible with the original shape. If +// an integer, then the result will be a 1-D array of that length. +// One shape dimension can be -1. In this case, the value is +// inferred from the length of the array and remaining dimensions. +// order : {'C', 'F', 'A'}, optional +// Read the elements of `a` using this index order, and place the +// elements into the reshaped array using this index order. 'C' +// means to read / write the elements using C-like index order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to read / write the +// elements using Fortran-like index order, with the first index +// changing fastest, and the last index changing slowest. Note that +// the 'C' and 'F' options take no account of the memory layout of +// the underlying array, and only refer to the order of indexing. +// 'A' means to read / write the elements in Fortran-like index +// order if `a` is Fortran *contiguous* in memory, C-like order +// otherwise. +// +// Returns +// ------- +// reshaped_array : ndarray +// This will be a new view object if possible; otherwise, it will +// be a copy. Note there is no guarantee of the *memory layout* (C- or +// Fortran- contiguous) of the returned array. +// +// See Also +// -------- +// ndarray.reshape : Equivalent method. +// +// Notes +// ----- +// It is not always possible to change the shape of an array without copying +// the data. +// +// The `order` keyword gives the index ordering both for *fetching* the values +// from `a`, and then *placing* the values into the output array. +// For example, let's say you have an array: +// +// >>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// Compute tensor dot product along specified axes. +// +// Given two tensors, `a` and `b`, and an array_like object containing +// two array_like objects, ``(a_axes, b_axes)``, sum the products of +// `a`'s and `b`'s elements (components) over the axes specified by +// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative +// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions +// of `a` and the first ``N`` dimensions of `b` are summed over. +// +// Parameters +// ---------- +// a, b : array_like +// Tensors to "dot". +// +// axes : int or (2,) array_like +// * integer_like +// If an int N, sum over the last N axes of `a` and the first N axes +// of `b` in order. The sizes of the corresponding axes must match. +// * (2,) array_like +// Or, a list of axes to be summed over, first sequence applying to `a`, +// second to `b`. Both elements array_like must be of the same length. +// +// Returns +// ------- +// output : ndarray +// The tensor dot product of the input. +// +// See Also +// -------- +// dot, einsum +// +// Notes +// ----- +// Three common use cases are: +// * ``axes = 0`` : tensor product :math:`a\otimes b` +// * ``axes = 1`` : tensor dot product :math:`a\cdot b` +// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` +// +// When `axes` is integer_like, the sequence for evaluation will be: first +// the -Nth axis in `a` and 0th axis in `b`, and the -1th axis in `a` and +// Nth axis in `b` last. +// +// When there is more than one axis to sum over - and they are not the last +// (first) axes of `a` (`b`) - the argument `axes` should consist of +// two sequences of the same length, with the first axis to sum over given +// first in both sequences, the second axis second, and so forth. +// +// The shape of the result consists of the non-contracted axes of the +// first tensor, followed by the non-contracted axes of the second. +// +// Examples +// -------- +// A "traditional" example: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 >= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : bool or ndarray of bool +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) +// array([ True, True, False]) +// +// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` +// on ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a >= b +// array([ True, True, False]) +// +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 > x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// +// See Also +// -------- +// greater_equal, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.greater([4,2],[2,2]) +// array([ True, False]) +// +// The ``>`` operator can be used as a shorthand for ``np.greater`` on +// ndarrays. +// +// >>> a = np.array([4, 2]) +// >>> b = np.array([2, 2]) +// >>> a > b +// array([ True, False]) +// +//go:linkname Greater py.greater +func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '`. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(__llgo_va_list ...interface{}) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Returns an array with axes transposed. +// +// For a 1-D array, this returns an unchanged view of the original array, as a +// transposed vector is simply the same vector. +// To convert a 1-D array into a 2-D column vector, an additional dimension +// must be added, e.g., ``np.atleast2d(a).T`` achieves this, as does +// ``a[:, np.newaxis]``. +// For a 2-D array, this is the standard matrix transpose. +// For an n-D array, if axes are given, their order indicates how the +// axes are permuted (see Examples). If axes are not provided, then +// ``transpose(a).shape == a.shape[::-1]``. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axes : tuple or list of ints, optional +// If specified, it must be a tuple or list which contains a permutation +// of [0,1,...,N-1] where N is the number of axes of `a`. The `i`'th axis +// of the returned array will correspond to the axis numbered ``axes[i]`` +// of the input. If not specified, defaults to ``range(a.ndim)[::-1]``, +// which reverses the order of the axes. +// +// Returns +// ------- +// p : ndarray +// `a` with its axes permuted. A view is returned whenever possible. +// +// See Also +// -------- +// ndarray.transpose : Equivalent method. +// moveaxis : Move axes of an array to new positions. +// argsort : Return the indices that would sort an array. +// +// Notes +// ----- +// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors +// when using the `axes` keyword argument. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(__llgo_va_list ...interface{}) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '`. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(x *py.Object, out *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object From 5670544601d3754a13b6a2607a468e145cbe0616 Mon Sep 17 00:00:00 2001 From: Askeladd <1351914167@qq.com> Date: Fri, 15 Aug 2025 19:26:31 +0800 Subject: [PATCH 48/88] Release-as:numpy/v0.1.0 --- numpy/go.mod | 2 +- numpy/llpyg.cfg | 2 +- numpy/numpy.go | 41102 +++++++++++++++++++++++----------------------- 3 files changed, 20808 insertions(+), 20298 deletions(-) diff --git a/numpy/go.mod b/numpy/go.mod index c3e8b3d3..8ce9049a 100644 --- a/numpy/go.mod +++ b/numpy/go.mod @@ -1,4 +1,4 @@ -module github.com/Bigdata-shiyang/test/numpy +module github.com/PengPengPeng717/llpkg/numpy go 1.24.5 diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg index 096a39c3..932c66b2 100644 --- a/numpy/llpyg.cfg +++ b/numpy/llpyg.cfg @@ -1,7 +1,7 @@ { "name": "numpy", "libName": "numpy", - "libVersion": "1.26.4", + "libVersion": "2.3.2", "modules": [ "numpy" ] diff --git a/numpy/numpy.go b/numpy/numpy.go index 303742a9..9f86641a 100644 --- a/numpy/numpy.go +++ b/numpy/numpy.go @@ -7,393 +7,505 @@ import ( const LLGoPackage = "py.numpy" // -// An array with ones at and below the given diagonal and zeros elsewhere. +// Compute the q-th quantile of the data along the specified axis. // // Parameters // ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities of the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// The recommended options, numbered as they appear in [1]_, are: // -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' // +// The first three methods are discontinuous. For backward compatibility +// with previous versions of NumPy, the following discontinuous variations +// of the default 'linear' (7.) option are available: // +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' // -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// See Notes for details. // -// Return an antiderivative (indefinite integral) of a polynomial. +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. // -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the quantile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// See the notes for more details. // -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// .. versionadded:: 2.0.0 // -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// interpolation : str, optional +// Deprecated name for the method keyword argument. // -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. +// .. deprecated:: 1.22.0 // -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis +// of the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. // // See Also // -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a sample `a` from an underlying distribution, `quantile` provides a +// nonparametric estimate of the inverse cumulative distribution function. +// +// By default, this is done by interpolating between adjacent elements in +// ``y``, a sorted copy of `a`:: +// +// (1-g)*y[j] + g*y[j+1] +// +// where the index ``j`` and coefficient ``g`` are the integral and +// fractional components of ``q * (n-1)``, and ``n`` is the number of +// elements in the sample. +// +// This is a special case of Equation 1 of H&F [1]_. More generally, +// +// - ``j = (q*n + m - 1) // 1``, and +// - ``g = (q*n + m - 1) % 1``, +// +// where ``m`` may be defined according to several different conventions. +// The preferred convention may be selected using the ``method`` parameter: +// +// =============================== =============== =============== +// ``method`` number in H&F ``m`` +// =============================== =============== =============== +// ``interpolated_inverted_cdf`` 4 ``0`` +// ``hazen`` 5 ``1/2`` +// ``weibull`` 6 ``q`` +// ``linear`` (default) 7 ``1 - q`` +// ``median_unbiased`` 8 ``q/3 + 1/3`` +// ``normal_unbiased`` 9 ``q/4 + 3/8`` +// =============================== =============== =============== +// +// Note that indices ``j`` and ``j + 1`` are clipped to the range ``0`` to +// ``n - 1`` when the results of the formula would be outside the allowed +// range of non-negative indices. The ``- 1`` in the formulas for ``j`` and +// ``g`` accounts for Python's 0-based indexing. +// +// The table above includes only the estimators from H&F that are continuous +// functions of probability `q` (estimators 4-9). NumPy also provides the +// three discontinuous estimators from H&F (estimators 1-3), where ``j`` is +// defined as above, ``m`` is defined as follows, and ``g`` is a function +// of the real-valued ``index = q*n + m - 1`` and ``j``. +// +// 1. ``inverted_cdf``: ``m = 0`` and ``g = int(index - j > 0)`` +// 2. ``averaged_inverted_cdf``: ``m = 0`` and +// ``g = (1 + int(index - j > 0)) / 2`` +// 3. ``closest_observation``: ``m = -1/2`` and +// ``g = 1 - int((index == j) & (j%2 == 1))`` +// +// For backward compatibility with previous versions of NumPy, `quantile` +// provides four additional discontinuous estimators. Like +// ``method='linear'``, all have ``m = 1 - q`` so that ``j = q*(n-1) // 1``, +// but ``g`` is defined as follows. +// +// - ``lower``: ``g = 0`` +// - ``midpoint``: ``g = 0.5`` +// - ``higher``: ``g = 1`` +// - ``nearest``: ``g = (q*(n-1) % 1) > 0.5`` +// +// **Weighted quantiles:** +// More formally, the quantile at probability level :math:`q` of a cumulative +// distribution function :math:`F(y)=P(Y \leq y)` with probability measure +// :math:`P` is defined as any number :math:`x` that fulfills the +// *coverage conditions* +// +// .. math:: P(Y < x) \leq q \quad\text{and}\quad P(Y \leq x) \geq q +// +// with random variable :math:`Y\sim P`. +// Sample quantiles, the result of `quantile`, provide nonparametric +// estimation of the underlying population counterparts, represented by the +// unknown :math:`F`, given a data vector `a` of length ``n``. +// +// Some of the estimators above arise when one considers :math:`F` as the +// empirical distribution function of the data, i.e. +// :math:`F(y) = \frac{1}{n} \sum_i 1_{a_i \leq y}`. +// Then, different methods correspond to different choices of :math:`x` that +// fulfill the above coverage conditions. Methods that follow this approach +// are ``inverted_cdf`` and ``averaged_inverted_cdf``. +// +// For weighted quantiles, the coverage conditions still hold. The +// empirical cumulative distribution is simply replaced by its weighted +// version, i.e. +// :math:`P(Y \leq t) = \frac{1}{\sum_i w_i} \sum_i w_i 1_{x_i \leq t}`. +// Only ``method="inverted_cdf"`` supports weights. // // Examples // -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True +// >>> import numpy as np +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) // -// The integration constants default to zero, but can be specified: +// See also `numpy.percentile` for a visualization of most methods. // -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 // -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: // -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 // +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object // +// Compute the arithmetic mean along the specified axis, ignoring NaNs. // -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. // -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. // // Parameters // ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. // -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. // +// .. versionadded:: 1.22.0 // // Returns // ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. // // See Also // -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar // // Notes // ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. // -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. // // Examples // -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: +// >>> import numpy as np +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary // -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) // // -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object // -// Construct an array from a text file, using regular expression parsing. +// Return the character for the minimum-size type to which given types can +// be safely cast. // -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). // // Parameters // ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. // // Returns // ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. +// typechar : str +// The character representing the minimum-size type that was found. // // See Also // -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. +// dtype // // Examples // -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// >>> import numpy as np +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' // -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) +// >>> np.mintypecode('abceh', default='G') +// 'G' // // // -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object // -// Cross-correlation of two 1-dimensional sequences. +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. // -// This function computes the correlation as generally defined in signal -// processing texts: +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. // -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. // -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. +// If `x` is not inexact, then no replacements are made. // // Parameters // ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. // // Returns // ------- // out : ndarray -// Discrete cross-correlation of `a` and `v`. +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. // // See Also // -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) // // Notes // ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. // // Examples // -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// >>> import numpy as np +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) // -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: // -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object // +// Return selected slices of an array along given axis. // +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. // -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. // -// Return the base 10 logarithm of the input array, element-wise. +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of NOT x element-wise. // // Parameters // ---------- // x : array_like -// Input values. +// Logical NOT is applied to the elements of `x`. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -412,363 +524,299 @@ func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. // This is a scalar if `x` is a scalar. // // See Also // -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// logical_and, logical_or, logical_xor // // Examples // -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) +// >>> import numpy as np +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) // -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) // -// Return the Hamming window. +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object // -// The Hamming window is a taper formed by using a weighted cosine. +// Repeat each element of an array after themselves // // Parameters // ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. // // Returns // ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. // // See Also // -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// tile : Tile an array. +// unique : Find the unique elements of an array. // // Examples // -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() +// >>> import numpy as np +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) // -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() // // +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object // -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object +// One-dimensional linear interpolation for monotonically increasing sample points. // -// Compute the histogram of a dataset. +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. // // Parameters // ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. // -// .. versionadded:: 1.11.0 +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. // -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. // -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. // // Returns // ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. // +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` // // See Also // -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// scipy.interpolate // -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. // -// [1, 2, 3, 4] +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. // -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. +// A simple check for `xp` being strictly increasing is:: // +// np.all(np.diff(xp) > 0) // // Examples // -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) +// >>> import numpy as np +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) // 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 // -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: +// Plot an interpolant to the sine function: // +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) // >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] // >>> plt.show() // +// Interpolation with periodic x-coordinates: // +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) // -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// Complex interpolation: // -// Build a matrix object from a string, nested sequence, or array. +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) // -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. // -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. // -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object // -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') +// Integrate along the given axis using the composite trapezoidal rule. // -// All the following expressions construct the same block matrix: +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. // -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. // +// .. versionadded:: 2.0.0 // +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. // -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// Returns +// ------- +// trapezoid : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. // -// Interpret the input as a matrix. +// See Also +// -------- +// sum, cumsum // -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. // -// Parameters +// +// References // ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule // -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png // // Examples // -------- -// >>> x = np.array([[1, 2], [3, 4]]) +// >>> import numpy as np // -// >>> m = np.asmatrix(x) +// Use the trapezoidal rule on evenly spaced points: // -// >>> x[0,0] = 5 +// >>> np.trapezoid([1, 2, 3]) +// 4.0 // -// >>> m -// matrix([[5, 2], -// [3, 4]]) +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: // +// >>> np.trapezoid([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapezoid([1, 2, 3], dx=2) +// 8.0 // +// Using a decreasing ``x`` corresponds to integrating in reverse: // -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object +// >>> np.trapezoid([1, 2, 3], x=[8, 6, 4]) +// -8.0 // -// Round an array to the given number of decimals. +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: // -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapezoid(y, x) +// 0.33340274885464394 // -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: // -// See Also -// -------- -// around : equivalent function; see for details. +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapezoid(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapezoid`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapezoid(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapezoid(a, axis=1) +// array([2., 8.]) // // -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +//go:linkname Trapezoid py.trapezoid +func Trapezoid(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) // -// Return a new array of given shape and type, filled with `fill_value`. +// Interpret a buffer as a 1-dimensional array. // // Parameters // ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. +// buffer : buffer_like +// An object that exposes the buffer interface. // dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. // like : array_like, optional // Reference object to allow the creation of arrays which are not // NumPy arrays. If an array-like passed in as ``like`` supports @@ -781,528 +829,596 @@ func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object // Returns // ------- // out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. // -// See Also +// See also // -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. // -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: // -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP // +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. // +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. // -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// Examples +// -------- +// >>> import numpy as np +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') // -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) // -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object // -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). +// Get the current way of handling floating-point errors. // // Returns // ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. // // See Also // -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. // // Examples // -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) +// >>> import numpy as np +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) # doctest: +SKIP +// array([nan, 1., 1.]) +// RuntimeWarning: invalid value encountered in divide // -// A 3-D example: +// >>> oldsettings = np.seterr(all='warn', invalid='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'warn', 'invalid': 'raise'} +// >>> np.arange(3.) / np.arange(3.) +// Traceback (most recent call last): +// ... +// FloatingPointError: invalid value encountered in divide +// >>> oldsettings = np.seterr(**oldsettings) # restore original // -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) // -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. // -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) +//go:linkname Geterr py.geterr +func Geterr() *py.Object // -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. +// Compute the variance along the specified axis. // -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. // -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : {int, float}, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. See notes for details about use of `ddof`. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. // -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// .. versionadded:: 1.20.0 // -// Element-wise minimum of array elements. +// mean : array like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this var function. // -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. +// .. versionadded:: 2.0.0 // -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. // -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. +// .. versionadded:: 2.0.0 // -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. // -// fmax, amax, nanmax +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` // -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. +// Notes +// ----- +// There are several common variants of the array variance calculation. +// Assuming the input `a` is a one-dimensional NumPy array and ``mean`` is +// either provided as an argument or computed as ``a.mean()``, NumPy +// computes the variance of an array as:: // -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) +// N = len(a) +// d2 = abs(a - mean)**2 # abs is for complex `a` +// var = d2.sum() / (N - ddof) # note use of `ddof` // -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) +// Different values of the argument `ddof` are useful in different +// contexts. NumPy's default ``ddof=0`` corresponds with the expression: // -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf +// .. math:: // -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// \frac{\sum_i{|a_i - \bar{a}|^2 }}{N} // -// Return the reciprocal of the argument, element-wise. +// which is sometimes called the "population variance" in the field of +// statistics because it applies the definition of variance to `a` as if `a` +// were a complete population of possible observations. // -// Calculates ``1/x``. +// Many other libraries define the variance of an array differently, e.g.: // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// .. math:: // -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. +// \frac{\sum_i{|a_i - \bar{a}|^2}}{N - 1} // -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. +// In statistics, the resulting quantity is sometimes called the "sample +// variance" because if `a` is a random sample from a larger population, +// this calculation provides an unbiased estimate of the variance of the +// population. The use of :math:`N-1` in the denominator is often called +// "Bessel's correction" because it corrects for bias (toward lower values) +// in the variance estimate introduced when the sample mean of `a` is used +// in place of the true mean of the population. For this quantity, use +// ``ddof=1``. // -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. // -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. // -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) // -// Check for a complex type or an array of complex numbers. +// In single precision, var() can be inaccurate: // -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// np.float32(0.20250003) // -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. +// Computing the variance in float64 is more accurate: // -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 // -// See Also -// -------- -// isrealobj, iscomplex +// Specifying a where argument: // -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 // +// Using the mean keyword to save computation time: // +// >>> import numpy as np +// >>> from timeit import timeit +// >>> +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> mean = np.mean(a, axis=1, keepdims=True) +// >>> +// >>> g = globals() +// >>> n = 10000 +// >>> t1 = timeit("var = np.var(a, axis=1, mean=mean)", globals=g, number=n) +// >>> t2 = timeit("var = np.var(a, axis=1)", globals=g, number=n) +// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') +// #doctest: +SKIP +// Percentage execution time saved 32% // -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object // -// Find the union of two arrays. // -// Return the unique, sorted array of values that are in either of the two -// input arrays. +//go:linkname Var py.var +func Var(__llgo_va_list ...interface{}) *py.Object +// +// Returns the unique elements of an input array `x`. +// +// This function is an Array API compatible alternative to:: +// +// np.unique(x, equal_nan=False, sorted=False) +// +// .. versionchanged:: 2.3 +// The algorithm was changed to a faster one that does not rely on +// sorting, and hence the results are no longer implicitly sorted. // // Parameters // ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. +// x : array_like +// Input array. It will be flattened if it is not already 1-D. // // Returns // ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. +// out : ndarray +// The unique elements of an input array. // // See Also // -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. +// unique : Find the unique elements of an array. // // Examples // -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) +// >>> import numpy as np +// >>> np.unique_values([1, 1, 2]) +// array([1, 2]) # may vary // // -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object // -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. +//go:linkname UniqueValues py.unique_values +func UniqueValues(x *py.Object) *py.Object // -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. +// Calculate the n-th discrete difference along the given axis. // -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. // // Parameters // ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. // // Returns // ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. // // See Also // -------- -// allclose -// math.isclose +// gradient, ediff1d, cumsum // // Notes // ----- -// .. versionadded:: 1.7.0 +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. // -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: // -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// np.uint8(255) // -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. +// If this is not desirable, then the array should be cast to a larger +// integer type first: // -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) // // Examples // -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) +// >>> import numpy as np +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) // +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) // -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') // -// Return the minimum of an array or minimum along an axis. // -// `amin` is an alias of `~numpy.min`. // -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object // +// Compute the median along the specified axis, while ignoring NaNs. // -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Returns the median of the array elements. // -// Divide arguments element-wise. +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. // -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. // -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. // -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. +// See Also +// -------- +// mean, median, percentile // -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. // -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// np.float64(nan) +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) // -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) // -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. // -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object // -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Split an array into multiple sub-arrays horizontally (column-wise). // -// Element-wise maximum of array elements. +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. // -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// >>> import numpy as np +// +// Create a 4 by 4 array +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. // // Parameters // ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -1323,1231 +1439,1086 @@ func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. +// y : ndarray +// y = floor(`x1`/`x2`) // This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. // // Examples // -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// >>> import numpy as np +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. // -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) // -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. // -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. // -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. // -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). // -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. // -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// Examples +// -------- +// >>> import numpy as np // -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object +// Convert a list into an array. If all elements are finite, then +// ``asarray_chkfinite`` is identical to ``asarray``. // -// Set the size of the buffer used in ufuncs. +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) // -// Parameters -// ---------- -// size : int -// Size of buffer. +// Raises ValueError if array_like contains Nans or Infs. // +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError // // -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object // -// unravel_index(indices, shape, order='C') +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object // -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. +// Return the indices for the lower-triangle of an (n, m) array. // // Parameters // ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. // -// .. versionadded:: 1.6.0 // // Returns // ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. +// inds : tuple of arrays +// The row and column indices, respectively. The row indices are sorted +// in non-decreasing order, and the correspdonding column indices are +// strictly increasing for each row. // -// See Also +// See also // -------- -// ravel_multi_index +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu // // Examples // -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) +// >>> import numpy as np // -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: // +// >>> il1 = np.tril_indices(4) +// >>> il1 +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) // +// Note that row indices (first array) are non-decreasing, and the corresponding +// column indices (second array) are strictly increasing for each row. +// Here is how they can be used with a sample array: // -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) // -// unpackbits(a, /, axis=None, count=None, bitorder='big') +// Both for indexing: // -// Unpacks elements of a uint8 array into a binary-valued output array. +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) // -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. +// And for assigning values: // -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) // -// .. versionadded:: 1.17.0 +// These cover almost the whole array (two diagonals right of the main one): // -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. +// >>> il2 = np.tril_indices(4, 2) +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) // -// .. versionadded:: 1.17.0 // -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). // -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) +// Return the floor of the input, element-wise. // -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. // +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. // -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// See Also +// -------- +// ceil, trunc, rint, fix // -// vdot(a, b, /) +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. // -// Return the dot product of two vectors. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) // -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object // -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. +// Return an array drawn from elements in choicelist, depending on conditions. // // Parameters // ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. // // Returns // ------- // output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. // // See Also // -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal // // Examples // -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! +// >>> import numpy as np // -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 +// Beginning with an array of integers from 0 to 5 (inclusive), +// elements less than ``3`` are negated, elements greater than ``3`` +// are squared, and elements not meeting either of these conditions +// (exactly ``3``) are replaced with a `default` value of ``42``. // +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [-x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, -1, -2, 42, 16, 25]) // +// When multiple conditions are satisfied, the first one encountered in +// `condlist` is used. // -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) // -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. // -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. // -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object // -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. +// Clip (limit) the values in an array. // -// See also -// -------- -// diag_indices, diag_indices_from +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. // -// Notes -// ----- -// .. versionadded:: 1.4.0 +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. // -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. +// No check is performed to ensure ``a_min < a_max``. // -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. If both ``a_min`` and ``a_max`` are ``None``, +// the elements of the returned array stay the same. Both are broadcasted +// against ``a``. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// min, max : array_like or None +// Array API compatible alternatives for ``a_min`` and ``a_max`` +// arguments. Either ``a_min`` and ``a_max`` or ``min`` and ``max`` +// can be passed at the same time. Default: ``None``. // -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) +// .. versionadded:: 2.1.0 +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// The wrap option affects only tall matrices: +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. // -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) +// See Also +// -------- +// :ref:`ufuncs-output-type` // -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. // -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(10) // >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) // >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) // >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) // -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object // -// Return the indices of the bins to which each value in input array belongs. // -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object // -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. +// Return a sorted copy of an array. // // Parameters // ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, +// in general, the actual implementation will vary with data type. +// The 'mergesort' option is retained for backwards compatibility. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// stable : bool, optional +// Sort stability. If ``True``, the returned array will maintain +// the relative order of ``a`` values which compare as equal. +// If ``False`` or ``None``, this is not guaranteed. Internally, +// this option selects ``kind='stable'``. Default: ``None``. +// +// .. versionadded:: 2.0.0 // // Returns // ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. +// sorted_array : ndarray +// Array of the same type and shape as `a`. // // See Also // -------- -// bincount, histogram, unique, searchsorted +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. // // Notes // ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: // -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== // -// For monotonically _increasing_ `bins`, the following are equivalent:: +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. // -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') +// For performance, ``sort`` makes a temporary copy if needed to make the data +// `contiguous `_ +// in memory along the sort axis. For even better performance and reduced +// memory consumption, ensure that the array is already contiguous along the +// sort axis. // -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. // -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: // -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] // +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. // -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// quicksort has been changed to: +// `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. // -// Split an array into multiple sub-arrays vertically (row-wise). +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. // -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt +// `_ +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. +// Radix sort is an O(n) sort instead of O(n log n). // -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. +// NaT now sorts to the end of arrays for consistency with NaN. // // Examples // -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// +// >>> import numpy as np +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) // +// Use the `order` keyword to specify a field to use when sorting a +// structured array: // -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '`. +// >>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// Return Pearson product-moment correlation coefficients. // -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is // -// Format a floating-point scalar as a decimal string in positional notation. +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } // -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// The values of `R` are between -1 and 1, inclusive. // // Parameters // ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. // -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. // -// -- versionadded:: 1.21.0 +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 // // Returns // ------- -// rep : string -// The string representation of the floating point value +// R : ndarray +// The correlation coefficient matrix of the variables. // // See Also // -------- -// format_float_scientific +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. // // Examples // -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// +// >>> import numpy as np // -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. // -// Counts the number of non-zero values in the array ``a``. +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) // -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. // -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) // -// .. versionadded:: 1.12.0 +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. // -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) // -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. // -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) // +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object // -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// Return a scalar type which is common to the input arrays. // -// can_cast(from_, to, casting='safe') +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. // -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. // // Parameters // ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. +// array1, array2, ... : ndarrays +// Input arrays. // // Returns // ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. +// out : data type code +// Data type code. // -// See also +// See Also // -------- -// dtype, result_type +// dtype, mintypecode // // Examples // -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// // // // -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object // -// Return the cumulative product of elements along a given axis. +// Build a matrix object from a string, nested sequence, or array. // // Parameters // ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. // // Returns // ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. // // See Also // -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. // // Examples // -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) +// >>> import numpy as np +// >>> A = np.asmatrix('1 1; 1 1') +// >>> B = np.asmatrix('2 2; 2 2') +// >>> C = np.asmatrix('3 4; 5 6') +// >>> D = np.asmatrix('7 8; 9 0') // -// The cumulative product for each column (i.e., over the rows) of `a`: +// All the following expressions construct the same block matrix: // -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) // -// The cumulative product for each row (i.e. over the columns) of `a`: // -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) // +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object // +// Return a string representation of an array. // -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: // -// Round elements of the array to the nearest integer. +// prefix + array2string(a) + suffix // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. // -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: // -// See Also -// -------- -// fix, ceil, floor, trunc +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` // -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. +// Other keys that can be used to set a group of types at once are: // -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. // -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object +// .. versionchanged:: 2.0 +// The sign parameter can now be an integer type, previously +// types were floating-point types. // -// Return an array converted to a float type. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: // -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. // // Returns // ------- -// out : ndarray -// The input `a` as a float ndarray. +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. // // Examples // -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) +// >>> import numpy as np +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' // +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' // +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' // -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object // -// Reverse the order of elements in an array along the given axis. // -// The shape of the array is preserved, but the elements are reordered. +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. // -// .. versionadded:: 1.12.0 +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. // // Parameters // ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported +// file : file or str or Path +// Open file object or filename. +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. +// .. versionadded:: 1.20.0 // -// See Also +// See also // -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. // // Notes // ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. // // Examples // -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True +// Construct an ndarray: // +// >>> import numpy as np +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', 'doc is NULL.) +// >>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) // -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. +// Read the raw data from disk: // -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', ' (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. +// Round elements of the array to the nearest integer. // // Parameters // ---------- // x : array_like -// Input array in degrees. +// Input array. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -2566,1335 +2537,1317 @@ func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// The corresponding radian values. +// out : ndarray or scalar +// Output array is same shape and type as `x`. // This is a scalar if `x` is a scalar. // // See Also // -------- -// deg2rad : equivalent function +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. // // Examples // -------- -// Convert a degree array to radians +// >>> import numpy as np +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) // -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object // -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True +// Split an array into a sequence of arrays along the given axis. // -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object +// The ``axis`` parameter specifies the dimension along which the array will +// be split. For example, if ``axis=0`` (the default) it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. // -// If input is complex with all imaginary parts close to zero, return -// real parts. +// The result is a tuple of arrays split along ``axis``. // -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). +// .. versionadded:: 2.1.0 // // Parameters // ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. +// x : ndarray +// The array to be unstacked. +// axis : int, optional +// Axis along which the array will be split. Default: ``0``. // // Returns // ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. +// unstacked : tuple of ndarrays +// The unstacked arrays. // // See Also // -------- -// real, imag, angle +// stack : Join a sequence of arrays along a new axis. +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. // // Notes // ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. +// ``unstack`` serves as the reverse operation of :py:func:`stack`, i.e., +// ``stack(unstack(x, axis=axis), axis=axis) == x``. +// +// This function is equivalent to ``tuple(np.moveaxis(x, axis, 0))``, since +// iterating on an array iterates along the first axis. // // Examples // -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary +// >>> arr = np.arange(24).reshape((2, 3, 4)) +// >>> np.unstack(arr) +// (array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]), +// array([[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]])) +// >>> np.unstack(arr, axis=1) +// (array([[ 0, 1, 2, 3], +// [12, 13, 14, 15]]), +// array([[ 4, 5, 6, 7], +// [16, 17, 18, 19]]), +// array([[ 8, 9, 10, 11], +// [20, 21, 22, 23]])) +// >>> arr2 = np.stack(np.unstack(arr, axis=1), axis=1) +// >>> arr2.shape +// (2, 3, 4) +// >>> np.all(arr == arr2) +// np.True_ // -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) // // +//go:linkname Unstack py.unstack +func Unstack(x *py.Object) *py.Object // -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. // -// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. // // Parameters // ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. In the case of a single +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 // // Returns // ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. // -// Examples +// See Also // -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. // -// The input data type is preserved, list/tuple in means list/tuple out. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) // -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) // // // -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object // -// Return the Blackman window. +// Compute the median along the specified axis. // -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. +// Returns the median of the array elements. // // Parameters // ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default, +// axis=None, will compute the median along a flattened version of +// the array. If a sequence of axes, the array is first flattened +// along the given axes, then the median is computed along the +// resulting flattened axis. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. // -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. // -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. // // Examples // -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// >>> import numpy as np +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// np.float64(3.5) +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> np.median(a, axis=(0, 1)) +// np.float64(3.5) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// np.float64(3.5) +// >>> assert not np.all(a==b) // -// Plot the window and the frequency response: // -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() // -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object // +// Function to calculate only the edges of the bins used by the `histogram` +// function. // +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. // -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object +// If `bins` is a string from the list below, `histogram_bin_edges` will +// use the method chosen to calculate the optimal bin width and +// consequently the number of bins (see the Notes section for more detail +// on the estimators) from the data that falls within the requested range. +// While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. // -// Return a list of coordinate matrices from coordinate vectors. +// 'auto' +// Minimum bin width between the 'sturges' and 'fd' estimators. +// Provides good all-around performance. // -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. // -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. // -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. // -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. // -// Default is False. +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. // -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. // -// .. versionadded:: 1.7.0 +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. // // Returns // ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram // // Notes // ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. // -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] +// 'auto' (minimum bin width of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. // -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} // -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. // -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} // -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. // -// The result of `meshgrid` is a coordinate grid: +// 'rice' +// .. math:: n_h = 2n^{1/3} // -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. // -// You can create sparse output arrays to save memory and computation time. +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 // -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. // -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) // -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] // +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} // -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. // -// Split an array into multiple sub-arrays. +// 'sqrt' +// .. math:: n_h = \sqrt n // -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. +// The simplest and fastest estimator. Only takes into account the +// data size. // -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. +// Additionally, if the data is of integer dtype, then the binwidth will never +// be less than 1. // // Examples // -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// >>> import numpy as np +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) // +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: // +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) // -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// This function allows one set of bins to be computed, and reused across +// multiple histograms: // -// Return the directory that contains the NumPy \*.h header files. +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) // -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) // -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) // -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... +// Which gives more easily comparable results than using separate bins for +// each histogram: // +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) // // -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object // -// Return the number of dimensions of an array. +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object // -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. +// Stack arrays in sequence vertically (row wise). // -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. // -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. // -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. In the case of a single +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. // +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. // +// .. versionadded:: 1.24 // -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. // -// Get the current way of handling floating-point errors. +// .. versionadded:: 1.24 // // Returns // ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. // // See Also // -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. // // Examples // -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) +// >>> import numpy as np +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) // -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) // // // -//go:linkname Geterr py.geterr -func Geterr() *py.Object +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Rotate an array by 90 degrees in the plane specified by axes. +// Compute bit-wise inversion, or bit-wise NOT, element-wise. // -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. // -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. +// For signed integer inputs, the bit-wise NOT of the absolute value is +// returned. In a two's-complement system, this operation effectively flips +// all the bits, resulting in a representation that corresponds to the +// negative of the input plus one. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range :math:`-2^{N-1}` to +// :math:`+2^{N-1}-1`. // -// .. versionadded:: 1.12.0 +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. // -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. // -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` +// Notes +// ----- +// ``numpy.bitwise_not`` is an alias for `invert`: // -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` +// >>> np.bitwise_not is np.invert +// True // -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement // +// Examples +// -------- +// >>> import numpy as np // +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: // -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// np.uint8(242) +// >>> np.binary_repr(x, width=8) +// '11110010' // -// Compute the outer product of two vectors. +// The result depends on the bit-width: // -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// np.uint16(65522) +// >>> np.binary_repr(x, width=16) +// '1111111111110010' // -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// When using signed integer types, the result is the bit-wise NOT of +// the unsigned type, interpreted as a signed integer: // -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseInvert py.bitwise_invert +func BitwiseInvert(__llgo_va_list ...interface{}) *py.Object +// +// Return the current callback function used on floating-point errors. // -// .. versionadded:: 1.9.0 +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. // // Returns // ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. // -// See also +// See Also // -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. +// seterrcall, seterr, geterr // -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. // // Examples // -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// >>> import numpy as np +// >>> np.geterrcall() # we did not yet set a handler, returns None // -// An example using a "vector" of letters: +// >>> orig_settings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) // -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// >>> old_settings = np.seterr(**orig_settings) # restore original +// >>> old_handler = np.seterrcall(None) # restore original // // // -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object // -// Returns True if input arrays are shape consistent and all elements equal. +// Join a sequence of arrays along a new axis. // -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. // // Parameters // ---------- -// a1, a2 : array_like -// Input arrays. +// arrays : sequence of ndarrays +// Each array must have the same shape. In the case of a single ndarray +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// // // Returns // ------- -// out : bool -// True if equivalent, False otherwise. +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. // -// Examples +// See Also // -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// unstack : Split an array into a tuple of sub-arrays along an axis. // -// Showing the shape equivalence: +// Examples +// -------- +// >>> import numpy as np +// >>> rng = np.random.default_rng() +// >>> arrays = [rng.normal(size=(3,4)) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) // -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) // -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) // +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) // +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) // -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Return the non-negative square-root of an array, element-wise. // -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object // -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. +// Insert values along the given axis before the given indices. // -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int, array-like of ints or bools +// Object that defines the index or indices before which `values` is +// inserted. // -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// .. versionchanged:: 2.1.2 +// Boolean indices are now treated as a mask of elements to insert, +// rather than being cast to the integers 0 and 1. // -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. // -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. // -// Compute the q-th percentile of the data along the specified axis. +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. // -// Returns the q-th percentile(s) of the array elements. +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. This is because of the difference between basic +// and advanced :ref:`indexing `. // -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(6).reshape(3, 2) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.insert(a, 1, 6) +// array([0, 6, 1, 2, 3, 4, 5]) +// >>> np.insert(a, 1, 6, axis=1) +// array([[0, 6, 1], +// [2, 6, 3], +// [4, 6, 5]]) +// +// Difference between sequence and scalars, +// showing how ``obj=[1]`` behaves different from ``obj=1``: +// +// >>> np.insert(a, [1], [[7],[8],[9]], axis=1) +// array([[0, 7, 1], +// [2, 8, 3], +// [4, 9, 5]]) +// >>> np.insert(a, 1, [[7],[8],[9]], axis=1) +// array([[0, 7, 8, 9, 1], +// [2, 7, 8, 9, 3], +// [4, 7, 8, 9, 5]]) +// >>> np.array_equal(np.insert(a, 1, [7, 8, 9], axis=1), +// ... np.insert(a, [1], [[7],[8],[9]], axis=1)) +// True // -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: +// >>> b = a.flatten() +// >>> b +// array([0, 1, 2, 3, 4, 5]) +// >>> np.insert(b, [2, 2], [6, 7]) +// array([0, 1, 6, 7, 2, 3, 4, 5]) // -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' +// >>> np.insert(b, slice(2, 4), [7, 8]) +// array([0, 1, 7, 2, 8, 3, 4, 5]) // -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([0, 1, 7, 0, 2, 3, 4, 5]) // -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) // -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. // -// .. versionadded:: 1.9.0 +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object // -// interpolation : str, optional -// Deprecated name for the method keyword argument. +// Save an array to a binary file in NumPy ``.npy`` format. // -// .. deprecated:: 1.22.0 +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, +// a ``.npy`` extension will be appended to the filename if it does not +// already have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for +// disallowing pickles include security (loading pickled data can execute +// arbitrary code) and portability (pickled objects may not be loadable +// on different Python installations, for example if the stored objects +// require libraries that are not available, and not all pickled data is +// compatible between different versions of Python). +// Default: True +// fix_imports : bool, optional +// The `fix_imports` flag is deprecated and has no effect. // -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. +// .. deprecated:: 2.1 +// This flag is ignored since NumPy 1.17 and was only needed to +// support loading in Python 2 some files written in Python 3. // // See Also // -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load // // Notes // ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. // -// The different methods then work as follows +// Any data saved to the file is appended to the end of the file. // -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: +// Examples +// -------- +// >>> import numpy as np // -// * if g > 0 ; then take j -// * if g = 0 ; then take i +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() // -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: +// >>> x = np.arange(10) +// >>> np.save(outfile, x) // -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds +// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) // -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: // -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] // -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: // -// * alpha = 0 -// * beta = 1 +//go:linkname Save py.save +func Save(__llgo_va_list ...interface{}) *py.Object // -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: +// Return the derivative of the specified order of a polynomial. // -// * alpha = 1/2 -// * beta = 1/2 +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. // -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) // -// * alpha = 0 -// * beta = 0 +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. // -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. // -// * alpha = 1 -// * beta = 1 +// Examples +// -------- // -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: // -// * alpha = 1/3 -// * beta = 1/3 +// >>> import numpy as np // -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) // -// * alpha = 3/8 -// * beta = 3/8 +// which evaluates to: // -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. +// >>> p2(2.) +// 17.0 // -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: // -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 // -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. +// The fourth-order derivative of a 3rd-order polynomial is zero: // -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) // -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) // -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) // -// The different methods can be visualized graphically: +//go:linkname Polyder py.polyder +func Polyder(__llgo_va_list ...interface{}) *py.Object // -// .. plot:: +// Create a two-dimensional array with the flattened input as a diagonal. // -// import matplotlib.pyplot as plt +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. // -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// Returns +// ------- +// out : ndarray +// The 2-D output array. // -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. // -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. +// Examples +// -------- +// >>> import numpy as np +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) // -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) // -// .. versionadded:: 1.8.0 // -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. +// Convert angles from degrees to radians. // -// .. versionadded:: 1.22.0 +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. // -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` +// See Also +// -------- +// deg2rad : equivalent function // -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// Examples +// -------- +// >>> import numpy as np // -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. +// Convert a degree array to radians // -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) // -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True // -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object // +// shares_memory(a, b, /, max_work=None) // +// Determine if two arrays share memory. // -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// .. warning:: // -// Return a new array of given shape and type, filled with ones. +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to zero or a positive integer. +// If in doubt, use `numpy.may_share_memory` instead. // // Parameters // ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: // -// .. versionadded:: 1.20.0 +// max_work=-1 (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=0 +// Only the memory bounds of a and b are checked. +// This is equivalent to using ``may_share_memory()``. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. // // Returns // ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. +// out : bool // // See Also // -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// +// may_share_memory // // Examples // -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) +// >>> import numpy as np +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False // -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: // -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided( +// ... x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided( +// ... x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work // -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. // // // -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object // -// Returns the indices that would sort an array. +// busday_offset( +// dates, +// offsets, +// roll='raise', +// weekmask='1111100', +// holidays=None, +// busdaycal=None, +// out=None +// ) // -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. // // Parameters // ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. // -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. // // Returns // ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. // // See Also // -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. // // Examples // -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> import numpy as np +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// np.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// np.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// np.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// np.datetime64('2012-05-13') // -// >>> np.argsort(x, order=('x','y')) -// array([1, 0]) +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// np.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// np.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// np.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// np.datetime64('2011-03-23') // -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) // +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object // +// Return the sum along diagonals of the array. // -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. // -// Gives a new shape to an array without changing its data. +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. // // Parameters // ---------- // a : array_like -// Array to be reshaped. -// newshape : int or tuple of ints -// The new shape should be compatible with the original shape. If -// an integer, then the result will be a 1-D array of that length. -// One shape dimension can be -1. In this case, the value is -// inferred from the length of the array and remaining dimensions. -// order : {'C', 'F', 'A'}, optional -// Read the elements of `a` using this index order, and place the -// elements into the reshaped array using this index order. 'C' -// means to read / write the elements using C-like index order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to read / write the -// elements using Fortran-like index order, with the first index -// changing fastest, and the last index changing slowest. Note that -// the 'C' and 'F' options take no account of the memory layout of -// the underlying array, and only refer to the order of indexing. -// 'A' means to read / write the elements in Fortran-like index -// order if `a` is Fortran *contiguous* in memory, C-like order -// otherwise. +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. // // Returns // ------- -// reshaped_array : ndarray -// This will be a new view object if possible; otherwise, it will -// be a copy. Note there is no guarantee of the *memory layout* (C- or -// Fortran- contiguous) of the returned array. +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. // // See Also // -------- -// ndarray.reshape : Equivalent method. -// -// Notes -// ----- -// It is not always possible to change the shape of an array without copying -// the data. -// -// The `order` keyword gives the index ordering both for *fetching* the values -// from `a`, and then *placing* the values into the output array. -// For example, let's say you have an array: -// -// >>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) +// diag, diagonal, diagflat // // Examples // -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) +// >>> import numpy as np +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) // -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) // // -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Convert angles from radians to degrees. +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. // // Parameters // ---------- // x : array_like -// Angle in radians. +// Input data. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -3913,1669 +3866,897 @@ func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// The corresponding angle in degrees. +// y : ndarray or scalar +// The truncated value of each element in `x`. // This is a scalar if `x` is a scalar. // // See Also // -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. +// ceil, floor, rint, fix // // Examples // -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 +// >>> import numpy as np +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) // -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. // -// Returns True if first argument is a typecode lower/equal in type hierarchy. +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. // -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. // // Parameters // ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one +// file : file, str, or pathlib.Path +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for +// disallowing pickles include security (loading pickled data can execute +// arbitrary code) and portability (pickled objects may not be loadable +// on different Python installations, for example if the stored objects +// require libraries that are not available, and not all pickled data is +// compatible between different versions of Python). +// Default: True +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. // // Returns // ------- -// out : bool +// None // // See Also // -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` +// object is returned. This is a dictionary-like object which can be queried +// for its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. // // Examples // -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False +// >>> import numpy as np +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) // -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True +// Using `savez` with \*args, the arrays are saved with default names. // -// Similar types of different sizes are not subdtypes of each other: +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) // -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False +// Using `savez` with \**kwds, the arrays are saved with the keyword names. // -// but both are subtypes of `floating`: +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) // -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True // -// For convenience, dtype-like objects are allowed too: // -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True +//go:linkname Savez py.savez +func Savez(__llgo_va_list ...interface{}) *py.Object // +// result_type(*arrays_and_dtypes) // +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. // -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. // -// Broadcast any number of arrays against each other. +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. // // Parameters // ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. // // Returns // ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes +// out : dtype +// The result type. // -// Examples +// See also // -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// dtype, promote_types, min_scalar_type, can_cast // -// Print the NumPy arrays in the given dictionary. +// Notes +// ----- +// The specific algorithm used is as follows. // -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. // -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. // -// Returns -// ------- -// out : None -// Returns 'None'. +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. // -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. // // Examples // -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// +// >>> import numpy as np +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') // -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object +// >>> np.result_type('i4', 'c8') +// dtype('complex128') // -// Returns True if two arrays are element-wise equal within a tolerance. +// >>> np.result_type(3.0, -2) +// dtype('float64') // -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. // -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. // -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object // -// .. versionadded:: 1.10.0 +// Round an array to the given number of decimals. // -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. +// `around` is an alias of `~numpy.round`. // // See Also // -------- -// isclose, all, any, equal +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc // -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. // -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) // -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object // -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. +// unpackbits(a, /, axis=None, count=None, bitorder='big') // -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. +// Unpacks elements of a uint8 array into a binary-valued output array. // -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. // // Parameters // ---------- -// a : array_like -// Input array. +// a : ndarray, uint8 type +// Input array. // axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. // // Returns // ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). // // See Also // -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. // // Examples // -------- -// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> import numpy as np +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) // >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) // >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) // -// Setting `keepdims` to `True`, +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True // -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) // // -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object // -// Return the cumulative sum of the elements along a given axis. +// Return a 2-D array with ones on the diagonal and zeros elsewhere. // // Parameters // ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. // // See Also // -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. // // Examples // -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) +// >>> import numpy as np +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) // -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) // -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` // -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // +// First array elements raised to powers from second array, element-wise. // +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. // -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// An integer type raised to a negative integer power will raise a +// ``ValueError``. // -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). // -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// .. versionadded:: 1.20.0 +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. // -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. +// See Also +// -------- +// float_power : power function that promotes integers to float // -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` +// Examples +// -------- +// >>> import numpy as np // -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. +// Cube each element in an array. // -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) // -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. +// Raise the bases to different exponents. // -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) // -// In single precision, std() can be inaccurate: +// The effect of broadcasting. // -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) // -// Computing the standard deviation in float64 is more accurate: +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. // -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) // -// Specifying a where argument: +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). // -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) // +// To get complex results, give the argument ``dtype=complex``. // +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) // -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Pow py.pow +func Pow(__llgo_va_list ...interface{}) *py.Object // -// Generate a Vandermonde matrix. +// Set printing options. // -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. // // Parameters // ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') // -// .. versionadded:: 1.9.0 +// .. versionchanged:: 2.0 +// The sign parameter can now be an integer type, previously +// types were floating-point types. // -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: // -// See Also -// -------- -// polynomial.polynomial.polyvander +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays // -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) +// Other keys that can be used to set a group of types at once are: // -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): // -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// Compute tensor dot product along specified axes. -// -// Given two tensors, `a` and `b`, and an array_like object containing -// two array_like objects, ``(a_axes, b_axes)``, sum the products of -// `a`'s and `b`'s elements (components) over the axes specified by -// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative -// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions -// of `a` and the first ``N`` dimensions of `b` are summed over. -// -// Parameters -// ---------- -// a, b : array_like -// Tensors to "dot". -// -// axes : int or (2,) array_like -// * integer_like -// If an int N, sum over the last N axes of `a` and the first N axes -// of `b` in order. The sizes of the corresponding axes must match. -// * (2,) array_like -// Or, a list of axes to be summed over, first sequence applying to `a`, -// second to `b`. Both elements array_like must be of the same length. -// -// Returns -// ------- -// output : ndarray -// The tensor dot product of the input. -// -// See Also -// -------- -// dot, einsum -// -// Notes -// ----- -// Three common use cases are: -// * ``axes = 0`` : tensor product :math:`a\otimes b` -// * ``axes = 1`` : tensor dot product :math:`a\cdot b` -// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` -// -// When `axes` is integer_like, the sequence for evaluation will be: first -// the -Nth axis in `a` and 0th axis in `b`, and the -1th axis in `a` and -// Nth axis in `b` last. -// -// When there is more than one axis to sum over - and they are not the last -// (first) axes of `a` (`b`) - the argument `axes` should consist of -// two sequences of the same length, with the first axis to sum over given -// first in both sequences, the second axis second, and so forth. -// -// The shape of the result consists of the non-contracted axes of the -// first tensor, followed by the non-contracted axes of the second. -// -// Examples -// -------- -// A "traditional" example: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) +// Floating point precision can be set: // -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// >>> import numpy as np +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] // -// Sort two columns of numbers: +// Long arrays can be summarised: // -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9], shape=(10,)) // -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// Small results can be suppressed: // -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) // -// A normal ``argsort`` would have yielded: +// A custom formatter can be used to display array elements as desired: // -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) // -// Structured arrays are sorted lexically by ``argsort``: +// To put back the default options, you can use: // -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) // -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) +// Also to temporarily override options, use `printoptions` +// as a context manager: // +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ], shape=(10,)) // // -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object // -// inner(a, b, /) +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object // -// Inner product of two arrays. +// Return the indices to access the main diagonal of an array. // -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. // // Parameters // ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. // -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. +// ndim : int, optional +// The number of dimensions. // // See Also // -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b +// diag_indices_from // // Examples // -------- -// Ordinary inner product for vectors: +// >>> import numpy as np // -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 +// Create a set of indices to access the diagonal of a (4, 4) array: // -// Some multidimensional examples: +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) // -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) +// Now, we create indices to manipulate a 3-D array: // -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) // -// An example where `b` is a scalar: +// And use it to set the diagonal of an array of zeros to 1: // -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) // // // -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object // -// Return the product of array elements over a given axis. +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. // // Parameters // ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. // // Returns // ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read // // See Also // -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. // // Notes // ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: // -// The product of an empty array is the neutral element 1: +// with load('foo.npz') as data: +// a = data['a'] // -// >>> np.prod([]) -// 1.0 +// The underlying file descriptor is closed when exiting the 'with' +// block. // // Examples // -------- -// By default, calculate the product of all elements: +// >>> import numpy as np // -// >>> np.prod([1.,2.]) -// 2.0 +// Store data to disk, and load it again: // -// Even when the input array is two-dimensional: +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) // -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 +// Store compressed data to disk, and load it again: // -// But we can also specify the axis over which to multiply: +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() // -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) +// Mem-map the stored array, and then access the second row +// directly from disk: // -// Or select specific elements to include: +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) // -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 // -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: // -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// If `x` is of a signed integer type, then the output type -// is the default platform integer: +// Inverse hyperbolic cosine, element-wise. // -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// You can also start the product with a value other than one: +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. // -// >>> np.prod([1, 2], initial=5) -// 10 +// See Also +// -------- // +// cosh, arcsinh, sinh, arctanh, tanh // -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. // -// Compute the absolute values element-wise. +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. // -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Acosh py.acosh +func Acosh(__llgo_va_list ...interface{}) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. // // Parameters // ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -5594,31 +4775,77 @@ func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepd // // Returns // ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// absolute : Absolute values including `complex` types. +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." // // Examples // -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) // -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Consider four points in different quadrants: // -// Trigonometric sine, element-wise. +// >>> import numpy as np +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Atan2 py.atan2 +func Atan2(__llgo_va_list ...interface{}) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. // // Parameters // ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -5637,700 +4864,553 @@ func Fabs(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// arcsin, sinh, cos +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax // // Notes // ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. // // Examples // -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 +// >>> import numpy as np +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) // -// Print sines of an array of angles given in degrees: +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) // -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) // -// Plot the sine function: +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() +// min_scalar_type(a, /) // -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. // -// Display a message on a device. +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. // // Parameters // ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. +// a : scalar or array_like +// The value whose minimal data type is to be found. // -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. +// Returns +// ------- +// out : dtype +// The minimal data type. // -// Examples +// See Also // -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// +// result_type, promote_types, dtype, can_cast // +// Examples +// -------- +// >>> import numpy as np +// >>> np.min_scalar_type(10) +// dtype('uint8') // -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// >>> np.min_scalar_type(-260) +// dtype('int16') // -// One-dimensional linear interpolation for monotonically increasing sample points. +// >>> np.min_scalar_type(3.1) +// dtype('float16') // -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// >>> np.min_scalar_type(1e50) +// dtype('float64') // -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') // -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. // -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. // -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object // -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// unravel_index(indices, shape, order='C') // -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. // -// .. versionadded:: 1.10.0 +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. // // Returns // ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. // // See Also // -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) +// ravel_multi_index // // Examples // -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) +// >>> import numpy as np +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) // -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) // -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) // -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// ravel_multi_index(multi_index, dims, mode='raise', order='C') +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) // -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. +// Create a new 1-dimensional array from an iterable object. // // Parameters // ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. // -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). // -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index +// out : ndarray +// The output array. // // Notes // ----- -// .. versionadded:: 1.6.0 +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. // // Examples // -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) +// >>> import numpy as np +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) // -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) // +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object // -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// Determine if a provided dtype is of a specified data type ``kind``. // -// Split array into multiple sub-arrays along the 3rd axis (depth). +// This function only supports built-in NumPy's data types. +// Third-party dtypes are not yet supported. // -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. +// Parameters +// ---------- +// dtype : dtype +// The input dtype. +// kind : dtype or str or tuple of dtypes/strs. +// dtype or dtype kind. Allowed dtype kinds are: +// * ``'bool'`` : boolean kind +// * ``'signed integer'`` : signed integer data types +// * ``'unsigned integer'`` : unsigned integer data types +// * ``'integral'`` : integer data types +// * ``'real floating'`` : real-valued floating-point data types +// * ``'complex floating'`` : complex floating-point data types +// * ``'numeric'`` : numeric data types +// +// Returns +// ------- +// out : bool // // See Also // -------- -// split : Split an array into multiple sub-arrays of equal size. +// issubdtype // // Examples // -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// +// >>> import numpy as np +// >>> np.isdtype(np.float32, np.float64) +// False +// >>> np.isdtype(np.float32, "real floating") +// True +// >>> np.isdtype(np.complex128, ("real floating", "complex floating")) +// True // -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object // -// Take values from the input array by matching 1d index and data slices. // -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. +//go:linkname Isdtype py.isdtype +func Isdtype(dtype *py.Object, kind *py.Object) *py.Object // -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. +// Reverse the order of elements along axis 0 (up/down). // -// .. versionadded:: 1.15.0 +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. // // Parameters // ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. +// m : array_like +// Input array. // // Returns // ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. // // Notes // ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. // -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) // -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] +// >>> rng = np.random.default_rng() +// >>> A = rng.normal(size=(2,3,5)) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True // -// Equivalently, eliminating the inner loop, the last two lines would be:: +// >>> np.flipud([1,2]) +// array([2, 1]) // -// out_1d[:] = a_1d[indices_1d] // -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices // -// Examples -// -------- +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object // -// For this sample array +// Returns the indices that would sort an array. // -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. // -// We can sort either by using sort directly, or argsort and this function +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// stable : bool, optional +// Sort stability. If ``True``, the returned array will maintain +// the relative order of ``a`` values which compare as equal. +// If ``False`` or ``None``, this is not guaranteed. Internally, +// this option selects ``kind='stable'``. Default: ``None``. // -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) +// .. versionadded:: 2.0.0 // -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. // -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. // -// If we want to get the max and min at the same time, we can stack the -// indices first +// Examples +// -------- +// One dimensional array: // -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) +// >>> import numpy as np +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) // +// Two-dimensional array: // -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) // -// Find the set difference of two arrays. +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) // -// Return the unique values in `ar1` that are not in `ar2`. +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) // -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. +// Indices of the sorted elements of a N-dimensional array: // -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) // -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. +// Sorting with keys: // -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) // +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) // -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object // -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. // -// Zeros are returned for slices that are all-NaN or empty. +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object // -// .. versionadded:: 1.12.0 +// True if two arrays have the same shape and elements, False otherwise. // // Parameters // ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. // // Returns // ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. +// b : bool +// Returns True if the arrays are equal. // // See Also // -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. // // Examples // -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) +// >>> import numpy as np // +// >>> np.array_equal([1, 2], [1, 2]) +// True // +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True // -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False // -// Return the identity array. +// >>> np.array_equal([1, 2], [1, 4]) +// False // -// The identity array is a square array with ones on -// the main diagonal. +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False // -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// >>> np.array_equal(a, a, equal_nan=True) +// True // -// .. versionadded:: 1.20.0 +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. // -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True // -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) // +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object // +// Returns True if two arrays are element-wise equal within a tolerance. // -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. // -// Return a new array with the specified shape. +// .. warning:: The default `atol` is not appropriate for comparing numbers +// with magnitudes much smaller than one (see Notes). // -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. // // Parameters // ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. +// a, b : array_like +// Input arrays to compare. +// rtol : array_like +// The relative tolerance parameter (see Notes). +// atol : array_like +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. // // Returns // ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. // // See Also // -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. +// isclose, all, any, equal // // Notes // ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// +// If the following equation is element-wise True, then allclose returns +// True.:: // -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object +// absolute(a - b) <= (atol + rtol * absolute(b)) // -// Return the shape of an array. +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. // -// Parameters -// ---------- -// a : array_like -// Input array. +// The default value of `atol` is not appropriate when the reference value +// `b` has magnitude smaller than one. For example, it is unlikely that +// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet +// ``allclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure +// to select `atol` for the use case at hand, especially for defining the +// threshold below which a non-zero value in `a` will be considered "close" +// to a very small or zero value in `b`. // -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. // -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. // // Examples // -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () +// >>> import numpy as np +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False // -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False // +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False // +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True // -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Return the natural logarithm of one plus the input array, element-wise. // -// Calculates ``log(1 + x)``. +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Convert angles from degrees to radians. // // Parameters // ---------- // x : array_like -// Input values. +// Angles in degrees. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -6350,526 +5430,430 @@ func Shape(a *py.Object) *py.Object // Returns // ------- // y : ndarray -// Natural logarithm of `1 + x`, element-wise. +// The corresponding angle in radians. // This is a scalar if `x` is a scalar. // // See Also // -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. // // Notes // ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// ``deg2rad(x)`` is ``x * pi / 180``. // // Examples // -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') +// >>> import numpy as np +// >>> np.deg2rad(180) +// 3.1415926535897931 // -// Setting the timezone to UTC shows the same information, but with a Z suffix +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='`. // -// >>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> import numpy as np +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) // -// >>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True // +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object // -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// Return numbers spaced evenly on a log scale (a geometric progression). // -// Return the number of elements along a given axis. +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. // // Parameters // ---------- -// a : array_like -// Input data. +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. // axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. // // Returns // ------- -// element_count : int -// Number of elements along the specified axis. +// samples : ndarray +// `num` samples, equally spaced on a log scale. // // See Also // -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) // // Examples // -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 +// >>> import numpy as np +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) // +// Note that the above may not produce exact integers: // +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) // -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) +// Negative, decreasing, and complex inputs are allowed: // -// Set numerical operators for array objects. +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) // -// .. deprecated:: 1.16 +// Graphical illustration of `endpoint` parameter: // -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() // -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. // -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. // -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. +// Return the distance between x and the nearest adjacent number. // -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. // -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. // -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// Spacing of +- inf and NaN is NaN. // -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// Examples +// -------- +// >>> import numpy as np +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True // -// Return the maximum of an array or maximum along an axis. +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// Return an array copy of the given object. // // Parameters // ---------- // a : array_like // Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). // // Returns // ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 +// arr : ndarray +// Array interpretation of `a`. // -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy // -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) +// Notes +// ----- +// This is equivalent to: // -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. +// >>> np.array(a, copy=True) #doctest: +SKIP // -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 +// The copy made of the data is shallow, i.e., for arrays with object dtype, +// the new array will point to the same objects. +// See Examples from `ndarray.copy`. // +// Examples +// -------- +// >>> import numpy as np // -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Create an array x, with a reference y and a copy z: // -// First array elements raised to powers from second array, element-wise. +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) // -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. +// Note that, when we modify x, y changes, but not z: // -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False // -// .. versionadded:: 1.12.0 +// Note that, np.copy clears previously set WRITEABLE=False flag. // -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) // -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. // -// See Also -// -------- -// power : power function that preserves type +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, device=None, like=None) // -// Examples -// -------- -// Cube each element in a list. +// Return evenly spaced values within a given interval. // -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) +// ``arange`` can be called with a varying number of positional arguments: // -// Raise the bases to different exponents. +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. // -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. // -// The effect of broadcasting. +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. // -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) +// See the Warning sections below for more information. // -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// To get complex results, give the argument ``dtype=complex``. +// .. versionadded:: 1.20.0 // -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. // -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. // -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// Warnings +// -------- +// The length of the output might not be numerically stable. // -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: // -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) // -// See Also -// -------- -// gcd : The greatest common divisor +// In such cases, the use of `numpy.linspace` should be preferred. // -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: // -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect // -// Numerical negative, element-wise. +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. // // Parameters // ---------- -// x : array_like or scalar -// Input array. +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -6888,912 +5872,968 @@ func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. // -// Examples +// See Also // -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. // -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' // -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) // -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): // +// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 // +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. // -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) // -// Return the cross product of two (arrays of) vectors. +//go:linkname BitwiseLeftShift py.bitwise_left_shift +func BitwiseLeftShift(__llgo_va_list ...interface{}) *py.Object // -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. +// Return the cumulative sum of the elements along a given axis. // // Parameters // ---------- // a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. +// Input array. // axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` +// for more details. // // Returns // ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. // // See Also // -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. +// cumulative_sum : Array API compatible alternative for ``cumsum``. +// sum : Sum array elements. +// trapezoid : Integration of array values using composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. // // Notes // ----- -// .. versionadded:: 1.9.0 +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. // -// Supports full broadcasting of the inputs. +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. // // Examples // -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. +// >>> import numpy as np +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) // -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) // -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` // -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 // // // -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object // -// Return indices that are non-zero in the flattened version of a. +// Compute the outer product of two vectors. // -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// Given two vectors `a` and `b` of length ``M`` and ``N``, respectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] // // Parameters // ---------- -// a : array_like -// Input data. +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored // // Returns // ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` // -// See Also +// See also // -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// linalg.outer : An Array API compatible variation of ``np.outer``, +// which accepts 1-dimensional inputs only. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. // // Examples // -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: +// Make a (*very* coarse) grid for computing a Mandelbrot set: // -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) +// >>> import numpy as np +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) // +// An example using a "vector" of letters: // +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) // -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object // -// Stack arrays in sequence horizontally (column wise). // -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. +//go:linkname Outer py.outer +func Outer(a *py.Object, b *py.Object, out *py.Object) *py.Object // -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. +// Interchange two axes of an array. // // Parameters // ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. // -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. // -// .. versionadded:: 1.24 +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) // -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) // -// .. versionadded:: 1.24 +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) // -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. // -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). // -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // +// Compute tangent element-wise. // +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. // -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Split an array into multiple sub-arrays as views into `ary`. +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. // -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) // -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // -// - ary[:2] -// - ary[2:3] -// - ary[3:] +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object // -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. // axis : int, optional -// The axis along which to split, default is 0. +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. // // Returns // ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. // // See Also // -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). +// insert : Insert elements into an array. +// delete : Delete elements from an array. // // Examples // -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// >>> import numpy as np +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) // -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) // +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) // +// >>> a = np.array([1, 2], dtype=int) +// >>> c = np.append(a, []) +// >>> c +// array([1., 2.]) +// >>> c.dtype +// float64 // -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// Default dtype for empty ndarrays is `float64` thus making the output of dtype +// `float64` when appended with dtype `int64` // -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. // -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. // // Parameters // ---------- // a : array_like -// Array containing numbers whose sum is desired. If `a` is not an +// Array containing numbers whose variance is desired. If `a` is not an // array, a conversion is attempted. // axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. // dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. // out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : {int, float}, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. // keepdims : bool, optional // If this is set to True, the axes which are reduced are left // in the result as dimensions with size one. With this option, // the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. // +// .. versionadded:: 1.22.0 // -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. +// mean : array_like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this var function. // -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// .. versionadded:: 2.0.0 // -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. // -// .. versionadded:: 1.22.0 +// .. versionadded:: 2.0.0 // // Returns // ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. // // See Also // -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` // // Notes // ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. // -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. // +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. // +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. // -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// from_dlpack(x, /) +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` // -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary // -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. // -// Returns -// ------- -// out : ndarray // -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object // -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) // -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) +// Evaluates the Einstein summation convention on the operands. // -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. // -// Returns the element-wise remainder of division. +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. // -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. +// See the notes and examples for clarification. // -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. // -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. // -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. // -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einsum: +// Similar verbose interface is provided by the +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// The `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. // -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) +// Notes +// ----- +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. // -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: // -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` +// :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` +// :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, +// :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, +// :py:func:`numpy.einsum_path`. // -// Return the gradient of an N-dimensional array. +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` +// produces a view of ``a`` with no changes. A further example +// ``np.einsum('ij,jk', a, b)`` describes traditional matrix multiplication +// and is equivalent to :py:func:`np.matmul(a,b) `. +// Repeated subscript labels in one operand take the diagonal. +// For example, ``np.einsum('ii', a)`` is equivalent to +// :py:func:`np.trace(a) `. // -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. // -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a) ` +// if ``a`` is a 1-D array, and ``np.einsum('ii->i', a)`` +// is like :py:func:`np.diag(a) ` if ``a`` is a square 2-D array. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. // -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// ``np.einsum('...i->...', a)`` is like +// :py:func:`np.sum(a, axis=-1) ` for array ``a`` of any shape. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. // -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). // -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. +// `einsum` also provides an alternative way to provide the subscripts and +// operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. // -// .. versionadded:: 1.9.1 +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. // -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands +// this can greatly increase the computational efficiency at the cost of +// a larger memory footprint during computation. // -// .. versionadded:: 1.11.0 +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive +// search. For iterative calculations it may be advisable to calculate +// the optimal path once and reuse that path by supplying it as an argument. +// An example is given below. // -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. +// See :py:func:`numpy.einsum_path` for more details. // // Examples // -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) // -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: +// Trace of a matrix: // -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 // -// Or a non uniform one: +// Extract the diagonal (requires explicit form): // -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) // -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: +// Sum over an axis (requires explicit form): // -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) // -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 +// For higher dimensional arrays summing a single axis can be done +// with ellipsis: // -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) // -// It is possible to specify how boundaries are treated using `edge_order` +// Compute a matrix transpose, or reorder any number of axes: // -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) // -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated +// Vector inner products: // -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 // -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) // -// .. math:: +// Tensor contraction: // -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) // -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: +// Writeable returned arrays (since version 1.10.0): // -// .. math:: +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) // -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. +// Example of ellipsis use: // -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) // -// .. math:: +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing +// the 'optimal' path and repeatedly applying it, using an `einsum_path` +// insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: // -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) +// >>> a = np.ones(64).reshape(2,4,8) // -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) // -// .. math:: +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) // -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms // -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, +// ... optimize='optimal') // -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. +// Greedy `einsum` (faster optimal path approximation): ~160ms // +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') // -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// Optimal `einsum` (best usage pattern in some use cases): ~110ms // -// Sort a complex array using the real part first, then the imaginary part. +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, +// ... optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) // -// Parameters -// ---------- -// a : array_like -// Input array // -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. // -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// First array elements raised to powers from second array, element-wise. // +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. // +// An integer type raised to a negative integer power will raise a +// ``ValueError``. // -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). // -// Determine if the first argument is a subclass of the second argument. +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. // -// Returns -// ------- -// out : bool -// The result. +// See Also +// -------- +// float_power : power function that promotes integers to float // -// See Also -// -------- -// issctype, issubdtype, obj2sctype +// Examples +// -------- +// >>> import numpy as np // -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False +// Cube each element in an array. // +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) // +// Raise the bases to different exponents. // -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) // -// Function to calculate only the edges of the bins used by the `histogram` -// function. +// The effect of broadcasting. // -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) // -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. // -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) // -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). // -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) // -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. +// To get complex results, give the argument ``dtype=complex``. // -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) // -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. +// Compute the histogram of a dataset. // -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. // // range : (float, float), optional // The lower and upper range of the bins. If not provided, range @@ -7803,581 +6843,534 @@ func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object // computation as well. While bin width is computed to be optimal // based on the actual data within `range`, the bin count will fill // the entire range including portions containing no data. -// // weights : array_like, optional // An array of weights, of the same shape as `a`. Each value in // `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// Please note that the ``dtype`` of `weights` will also become the +// ``dtype`` of the returned accumulator (`hist`), so it must be +// large enough to hold accumulated values as well. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. // // Returns // ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. If `weights` are given, +// ``hist.dtype`` will be taken from `weights`. // bin_edges : array of dtype float -// The edges to pass into `histogram` +// Return the bin edges ``(length(hist)+1)``. +// // // See Also // -------- -// histogram +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges // // Notes // ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: // -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. +// [1, 2, 3, 4] // -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. // -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. // -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// Examples +// -------- +// >>> import numpy as np +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) // -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 // -// 'rice' -// .. math:: n_h = 2n^{1/3} +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points. // -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. +// .. plot:: +// :include-source: // -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 +// import matplotlib.pyplot as plt +// import numpy as np // -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. +// rng = np.random.RandomState(10) # deterministic random data +// a = np.hstack((rng.normal(size=1000), +// rng.normal(loc=5, scale=2, size=1000))) +// plt.hist(a, bins='auto') # arguments are passed to np.histogram +// plt.title("Histogram with 'auto' bins") +// plt.show() // -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) // -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] // -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. // -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// values ``a[i, ..., i]`` with indices ``i`` all identical. This function +// modifies the input array in-place without returning a value. // -// 'sqrt' -// .. math:: n_h = \sqrt n +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled in-place. +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. // -// The simplest and fastest estimator. Only takes into account the -// data size. +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. // // Examples // -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) +// >>> import numpy as np +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) // -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: +// The same function can operate on a 4-D array: // -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) // -// This function allows one set of bins to be computed, and reused across -// multiple histograms: +// We only show a few blocks for clarity: // -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) // -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// The wrap option affects only tall matrices: // -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) // -// Which gives more easily comparable results than using separate bins for -// each histogram: +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) // -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. // +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) // +// Note that the order in which the diagonal is filled varies depending +// on the flip function. // -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object // -// Return an array representing the indices of a grid. +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object // -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. +// Save several arrays into a single file in compressed ``.npz`` format. // -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez_compressed(fn, x=x, y=y)``. // -// .. versionadded:: 1.17 +// If arrays are specified as positional arguments, i.e., +// ``savez_compressed(fn, x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for +// disallowing pickles include security (loading pickled data can execute +// arbitrary code) and portability (pickled objects may not be loadable +// on different Python installations, for example if the stored objects +// require libraries that are not available, and not all pickled data is +// compatible between different versions of Python). +// Default: True +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. // // Returns // ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place +// None // // See Also // -------- -// mgrid, ogrid, meshgrid +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. // // Notes // ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. // -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: // -// grid[k, i0, i1, ..., iN-1] = ik +// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` +// object is returned. This is a dictionary-like object which can be queried +// for its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. // // Examples // -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. +// >>> import numpy as np +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True // -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. // -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. // -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(__llgo_va_list ...interface{}) *py.Object // -// maximum, amax, nanmax +// Returns the quotient and remainder of polynomial division. // -// Notes -// ----- -// .. versionadded:: 1.3.0 +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. // -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. // -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. // -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) +// v : array_like or poly1d +// Divisor polynomial's coefficients. // -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. // -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval // -// Compute the truth value of NOT x element-wise. +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. // -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Examples +// -------- // -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 // -// See Also -// -------- -// logical_and, logical_or, logical_xor +// >>> import numpy as np // -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) // -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) // -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object // -// Return the scalar dtype or NumPy equivalent of Python type of an object. +//go:linkname Polydiv py.polydiv +func Polydiv(__llgo_va_list ...interface{}) *py.Object // -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. +// Split an array into multiple sub-arrays. // -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. // // See Also // -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// split : Split array into multiple sub-arrays of equal size. // // Examples // -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// +// >>> import numpy as np +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] // +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] // // -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object // -// Return the indices to access the main diagonal of an n-dimensional array. +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object // -// See `diag_indices` for full details. +// Split array into multiple sub-arrays along the 3rd axis (depth). // -// Parameters -// ---------- -// arr : array, at least 2-D +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. // // See Also // -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 +// split : Split an array into multiple sub-arrays of equal size. // // Examples // -------- +// >>> import numpy as np +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] // -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. // -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) // -// >>> a[di] -// array([ 0, 5, 10, 15]) +// Convert the input to an ndarray, but pass ndarray subclasses through. // -// This is simply syntactic sugar for diag_indices. +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// .. versionadded:: 2.1.0 // +// copy : bool, optional +// If ``True``, then the object is copied. If ``None`` then the object is +// copied only if needed, i.e. if ``__array__`` returns a copy, if obj +// is a nested sequence, or if a copy is needed to satisfy any of +// the other requirements (``dtype``, ``order``, etc.). +// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. +// Default: ``None``. // +// .. versionadded:: 2.1.0 // -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// Split an array into multiple sub-arrays horizontally (column-wise). +// .. versionadded:: 1.20.0 // -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. // // See Also // -------- -// split : Split an array into multiple sub-arrays of equal size. +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. // // Examples // -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. +// Convert a list into an array: // -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] +// >>> a = [1, 2] +// >>> import numpy as np +// >>> np.asanyarray(a) +// array([1, 2]) // -// With a 1-D array, the split is along axis 0. +// Instances of `ndarray` subclasses are passed through as-is: // -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] +// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True // +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object // +// Convert inputs to arrays with at least one dimension. // -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. // -// Test element-wise for finiteness (not infinity and not Not a Number). +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. // -// The result is returned as a boolean array. +// Returns +// ------- +// ret : ndarray +// An array, or tuple of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. // -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// See Also +// -------- +// atleast_2d, atleast_3d // -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. +// Examples +// -------- +// >>> import numpy as np +// >>> np.atleast_1d(1.0) +// array([1.]) // -// See Also -// -------- -// isinf, isneginf, isposinf, isnan +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True // -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. +// >>> np.atleast_1d(1, [3, 4]) +// (array([1]), array([3, 4])) // -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. // -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) // -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Test element-wise for positive or negative infinity. // -// Return the next floating-point value after x1 towards x2, element-wise. +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. // // Parameters // ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// x : array_like +// Input values // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -8396,973 +7389,967 @@ func Isfinite(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. // // Examples // -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 +// >>> import numpy as np +// >>> np.isinf(np.inf) // True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(-np.inf) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) // -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) // -// Return a string representation of the data in an array. +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. // -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) // // Parameters // ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. // // See Also // -------- -// array2string, array_repr, set_printoptions +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. // // Examples // -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' +// It is equivalent to ``reshape(-1, order=order)``. // +// >>> import numpy as np +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) // +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) // -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) // -// Return the string representation of an array. +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// +// Compute tensor dot product along specified axes. +// +// Given two tensors, `a` and `b`, and an array_like object containing +// two array_like objects, ``(a_axes, b_axes)``, sum the products of +// `a`'s and `b`'s elements (components) over the axes specified by +// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative +// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions +// of `a` and the first ``N`` dimensions of `b` are summed over. // // Parameters // ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. +// a, b : array_like +// Tensors to "dot". +// +// axes : int or (2,) array_like +// * integer_like +// If an int N, sum over the last N axes of `a` and the first N axes +// of `b` in order. The sizes of the corresponding axes must match. +// * (2,) array_like +// Or, a list of axes to be summed over, first sequence applying to `a`, +// second to `b`. Both elements array_like must be of the same length. // // Returns // ------- -// string : str -// The string representation of an array. +// output : ndarray +// The tensor dot product of the input. // // See Also // -------- -// array_str, array2string, set_printoptions +// dot, einsum // -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' +// Notes +// ----- +// Three common use cases are: +// * ``axes = 0`` : tensor product :math:`a\otimes b` +// * ``axes = 1`` : tensor dot product :math:`a\cdot b` +// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` // -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' +// When `axes` is integer_like, the sequence of axes for evaluation +// will be: from the -Nth axis to the -1th axis in `a`, +// and from the 0th axis to (N-1)th axis in `b`. +// For example, ``axes = 2`` is the equal to +// ``axes = [[-2, -1], [0, 1]]``. +// When N-1 is smaller than 0, or when -N is larger than -1, +// the element of `a` and `b` are defined as the `axes`. +// +// When there is more than one axis to sum over - and they are not the last +// (first) axes of `a` (`b`) - the argument `axes` should consist of +// two sequences of the same length, with the first axis to sum over given +// first in both sequences, the second axis second, and so forth. +// The calculation can be referred to ``numpy.einsum``. +// +// The shape of the result consists of the non-contracted axes of the +// first tensor, followed by the non-contracted axes of the second. // +// Examples +// -------- +// An example on integer_like: // +// >>> a_0 = np.array([[1, 2], [3, 4]]) +// >>> b_0 = np.array([[5, 6], [7, 8]]) +// >>> c_0 = np.tensordot(a_0, b_0, axes=0) +// >>> c_0.shape +// (2, 2, 2, 2) +// >>> c_0 +// array([[[[ 5, 6], +// [ 7, 8]], +// [[10, 12], +// [14, 16]]], +// [[[15, 18], +// [21, 24]], +// [[20, 24], +// [28, 32]]]]) // -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// An example on array_like: // -// Stack arrays in sequence vertically (row wise). +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) // -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. +// A slower but equivalent way of computing the same... // -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) // -// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// An extended example taking advantage of the overloading of + and \*: // -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) // -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) // -// .. versionadded:: 1.24 +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) // -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... // -// .. versionadded:: 1.24 +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) // -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) // -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) // -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) // -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) // // +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object // -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object +// Modified Bessel function of the first kind, order 0. // -// Return a description for the given data type code. +// Usually denoted :math:`I_0`. // // Parameters // ---------- -// char : str -// Data type code. +// x : array_like of float +// Argument of the Bessel function. // // Returns // ------- -// out : str -// Description of the input data type code. +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. // // See Also // -------- -// dtype, typecodes +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero // // Examples // -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer +// >>> import numpy as np +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) // // // -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object // -// Lower triangle of an array. +// Expand the shape of an array. // -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. // // Parameters // ---------- -// m : array_like, shape (..., M, N) +// a : array_like // Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. // // Returns // ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. +// result : ndarray +// View of `a` with the number of dimensions increased. // // See Also // -------- -// triu : same thing, only for the upper triangle +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// atleast_1d, atleast_2d, atleast_3d // // Examples // -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. +// >>> import numpy as np +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) // -// See Also -// -------- -// numpy.all : Equivalent function; see for details. +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: // +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) // -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// The following is equivalent to ``x[:, np.newaxis]``: // -// Shift the bits of an integer to the left. +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) // -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. +// ``axis`` may also be a tuple: // -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) // -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) // -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: // -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' +// >>> np.newaxis is None +// True // -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) // -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): // -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object // -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. +// Returns the indices of the maximum values along an axis. // -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. // -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// .. versionadded:: 1.22.0 // -// Natural logarithm, element-wise. +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as ``a.shape`` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as ``a.shape``. // -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. // -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. // -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) // -// See Also -// -------- -// log10, log2, log1p, emath.log +// Indexes of the maximal elements of a N-dimensional array: // -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 // -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 // -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), +// ... axis=-1).squeeze(axis=-1) +// array([4, 3]) // -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. +// Setting `keepdims` to `True`, // -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) // -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) // -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) // -// Logarithm of the sum of exponentiations of the inputs in base-2. +// Get information about the step size of a date or time type. // -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. // -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. // -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. // -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// Examples +// -------- +// >>> import numpy as np +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') // -// Notes -// ----- -// .. versionadded:: 1.3.0 +// The result can be used to construct a datetime that uses the same units +// as a timedelta // -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// np.datetime64('2010-01-01T00:00:00','25s') // -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object // -// Return the current print options. +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. // // Returns // ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. // // See Also // -------- -// set_printoptions, printoptions, set_string_function +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. // +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) // +// These all achieve the same result: // -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) // -// Unwrap by taking the complement of large deltas with respect to the period. // -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. // -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. // // Parameters // ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// .. versionadded:: 1.21.0 +// .. versionadded:: 2.0.0 // // Returns // ------- // out : ndarray -// Output array. +// Array of ones with the same shape and type as `a`. // // See Also // -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. // // Examples // -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) +// >>> import numpy as np +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) // +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) // -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) // -// Create an array. // -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. +//go:linkname OnesLike py.ones_like +func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +//go:linkname Subtract py.subtract +func Subtract(__llgo_va_list ...interface{}) *py.Object // -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== +// Find the unique elements of `x` and indices to reconstruct `x`. // -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// This function is an Array API compatible alternative to:: // -// .. versionadded:: 1.20.0 +// np.unique(x, return_inverse=True, equal_nan=False, sorted=False) +// +// but returns a namedtuple for easier access to each output. +// +// .. note:: +// This function currently always returns a sorted result, however, +// this could change in any NumPy minor release. +// +// Parameters +// ---------- +// x : array_like +// Input array. It will be flattened if it is not already 1-D. // // Returns // ------- -// out : ndarray -// An array object satisfying the specified requirements. +// out : namedtuple +// The result containing: +// +// * values - The unique elements of an input array. +// * inverse_indices - The indices from the set of unique elements +// that reconstruct `x`. // // See Also // -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. +// unique : Find the unique elements of an array. // // Examples // -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) +// >>> import numpy as np +// >>> x = [1, 1, 2] +// >>> uniq = np.unique_inverse(x) +// >>> uniq.values +// array([1, 2]) +// >>> uniq.inverse_indices +// array([0, 0, 1]) // -// Upcasting: // -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) +//go:linkname UniqueInverse py.unique_inverse +func UniqueInverse(x *py.Object) *py.Object // -// More than one dimension: +// Return the Hamming window. // -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) +// The Hamming window is a taper formed by using a weighted cosine. // -// Minimum dimensions 2: +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. // -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). // -// Type provided: +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. // -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// Examples +// -------- +// >>> import numpy as np +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) // -// Data-type consisting of more than one element: +// Plot the window and the frequency response. // -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) +// .. plot:: +// :include-source: // -// Creating an array from sub-classes: +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.hamming(51) +// plt.plot(window) +// plt.title("Hamming window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() // -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Hamming window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() // -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) // -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object // -// where(condition, [x, y], /) +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object // -// Return elements chosen from `x` or `y` depending on `condition`. +// Find the product of two polynomials. // // .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. // // Parameters // ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. +// a1, a2 : array_like or poly1d object +// Input polynomials. // // Returns // ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. // // See Also // -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. // // Examples // -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) +// >>> import numpy as np +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) // +// Using poly1d objects: // -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 // -// Construct an array from an index array and a list of arrays to choose from. // -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): // -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object // -// But this omits some subtleties. Here is a fully general summary: +// Test whether any array element along a given axis evaluates to True. // -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: +// Returns single boolean if `axis` is ``None`` // -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. If this +// is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. // -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. // -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. // -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// .. versionadded:: 1.20.0 // // Returns // ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. // // See Also // -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. // // Notes // ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. // -// Inverse hyperbolic tangent element-wise. +// .. versionchanged:: 2.0 +// Before NumPy 2.0, ``any`` did not return booleans for object dtype +// input arrays. +// This behavior is still available via ``np.logical_or.reduce``. // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Examples +// -------- +// >>> import numpy as np +// >>> np.any([[True, False], [True, True]]) +// True // -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. +// >>> np.any([[True, False, True ], +// ... [False, False, False]], axis=0) +// array([ True, False, True]) // -// See Also -// -------- -// emath.arctanh +// >>> np.any([-1, 0, 5]) +// True // -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// >>> np.any([[np.nan], [np.inf]], axis=1, keepdims=True) +// array([[ True], +// [ True]]) // -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False // -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. +// >>> a = np.array([[1, 0, 0], +// ... [0, 0, 1], +// ... [0, 0, 0]]) +// >>> np.any(a, axis=0) +// array([ True, False, True]) +// >>> np.any(a, axis=1) +// array([ True, True, False]) // -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) // -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh // -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) // -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Return the truth value of (x1 >= x2) element-wise. +// Compute the truth value of x1 AND x2 element-wise. // // Parameters // ---------- @@ -9388,41 +8375,49 @@ func Arctanh(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : bool or ndarray of bool -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. // This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// greater, less, less_equal, equal, not_equal +// logical_or, logical_not, logical_xor +// bitwise_and // // Examples // -------- -// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) -// array([ True, True, False]) +// >>> import numpy as np +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) // -// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` -// on ndarrays. +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) // -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a >= b -// array([ True, True, False]) // -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. // -// Return the fractional and integral parts of an array, element-wise. +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) // -// The fractional and integral parts are negative if the given number is -// negative. +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of x1 XOR x2, element-wise. // // Parameters // ---------- -// x : array_like -// Input array. +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -9441,276 +8436,208 @@ func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. +// logical_and, logical_or, logical_not, bitwise_xor // // Examples // -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: +// >>> import numpy as np +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) // -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) // -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: +// Simple example showing support of broadcasting // -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) // +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// vecmat(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) // +// Vector-matrix dot product of two arrays. // -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// Given a vector (or stack of vector) :math:`\mathbf{v}` in ``x1`` and +// a matrix (or stack of matrices) :math:`\mathbf{A}` in ``x2``, the +// vector-matrix product is defined as: // -// Return the current callback function used on floating-point errors. +// .. math:: +// \mathbf{b} \cdot \mathbf{A} = \sum_{i=0}^{n-1} \overline{v_i}A_{ij} // -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. +// where the sum is over the last dimension of ``x1`` and the one-but-last +// dimensions in ``x2`` (unless `axes` is specified) and where +// :math:`\overline{v_i}` denotes the complex conjugate if :math:`v` +// is complex and the identity otherwise. (For a non-conjugated vector-matrix +// product, use ``np.matvec(x2.mT, x1)``.) // -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. +// .. versionadded:: 2.2.0 // -// See Also -// -------- -// seterrcall, seterr, geterr +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// the broadcasted shape of ``x1`` and ``x2`` with the summation axis +// removed. If not provided or None, a freshly-allocated array is used. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. +// Returns +// ------- +// y : ndarray +// The vector-matrix product of the inputs. // -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None +// Raises +// ------ +// ValueError +// If the last dimensions of ``x1`` and the one-but-last dimension of +// ``x2`` are not the same size. // -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) +// If a scalar value is passed in. // -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True +// See Also +// -------- +// vecdot : Vector-vector product. +// matvec : Matrix-vector product. +// matmul : Matrix-matrix product. +// einsum : Einstein summation convention. // +// Examples +// -------- +// Project a vector along X and Y. // +// >>> v = np.array([0., 4., 2.]) +// >>> a = np.array([[1., 0., 0.], +// ... [0., 1., 0.], +// ... [0., 0., 0.]]) +// >>> np.vecmat(v, a) +// array([ 0., 4., 0.]) // -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object +//go:linkname Vecmat py.vecmat +func Vecmat(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// Returns True if the type of `element` is a scalar type. +// Return an array of zeros with the same shape and type as a given array. // // Parameters // ---------- -// element : any -// Input argument, can be of any type and shape. +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 // // Returns // ------- -// val : bool -// True if `element` is a scalar type, False if it is not. +// out : ndarray +// Array of zeros with the same shape and type as `a`. // // See Also // -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. // // Examples // -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True +// >>> import numpy as np +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) // -// NumPy supports PEP 3141 numbers: +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) // -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True // // +//go:linkname ZerosLike py.zeros_like +func ZerosLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object // -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object +// Check for a complex type or an array of complex numbers. // -// Repeat each element of an array after themselves +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. // // Parameters // ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. +// x : any +// The input can be of any type and shape. // // Returns // ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. // // See Also // -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. +// isrealobj, iscomplex // // Examples // -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) +// >>> import numpy as np +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True // // // -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Element-wise maximum of array elements. +// Trigonometric inverse cosine, element-wise. // -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. // // Parameters // ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -9729,731 +8656,1002 @@ func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object // // Returns // ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. // // See Also // -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin +// cos, arctan, arcsin, emath.arccos // // Notes // ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm // // Examples // -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) +// >>> import numpy as np // -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) +// We expect the arccos of 1 to be 0, and of -1 to be pi: // -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) // -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// Context manager for setting print options. +// Plot arccos: // -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() // -// Examples -// -------- +//go:linkname Arccos py.arccos +func Arccos(x *py.Object, out *py.Object) *py.Object +// asfortranarray(a, dtype=None, *, like=None) // -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) +// Return an array (ndim >= 1) laid out in Fortran order in memory. // -// The `as`-clause of the `with`-statement gives the current print options: +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. // // See Also // -------- -// set_printoptions, get_printoptions +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: // +// >>> import numpy as np +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True // +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: // -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix // -// Assemble an nd-array from nested lists of blocks. +// Examples +// -------- +// >>> import numpy as np // -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) // -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object // -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. +// Return the cumulative sum of the elements along a given axis. // -// .. versionadded:: 1.13.0 +// This function is an Array API compatible alternative to `numpy.cumsum`. // // Parameters // ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. +// x : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is only allowed for one-dimensional arrays. For arrays +// with more than one dimension ``axis`` is required. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If ``dtype`` is not specified, it defaults +// to the dtype of ``x``, unless ``x`` has an integer dtype with +// a precision less than that of the default platform integer. +// In that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` +// for more details. +// include_initial : bool, optional +// Boolean indicating whether to include the initial value (zeros) as +// the first value in the output. With ``include_initial=True`` +// the shape of the output is different than the shape of the input. +// Default: ``False``. // // Returns // ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` +// cumulative_sum_along_axis : ndarray +// A new array holding the result is returned unless ``out`` is +// specified, in which case a reference to ``out`` is returned. The +// result has the same shape as ``x`` if ``include_initial=False``. // // See Also // -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// sum : Sum array elements. +// trapezoid : Integration of array values using composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. // // Notes // ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. // -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. +// ``cumulative_sum(a)[-1]`` may not be equal to ``sum(a)`` for +// floating-point values since ``sum`` may use a pairwise summation routine, +// reducing the roundoff-error. See `sum` for more information. // -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 4, 5, 6]) +// >>> a +// array([1, 2, 3, 4, 5, 6]) +// >>> np.cumulative_sum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumulative_sum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) // -// AAAbb -// AAAbb -// cccDD +// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumulative_sum(b,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumulative_sum(b,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) // -// But is also allowed to produce, for some ``a, b, c, d``:: +// ``cumulative_sum(c)[-1]`` may not be equal to ``sum(c)`` // -// AAAbb -// AAAbb -// cDDDD +// >>> c = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> np.cumulative_sum(c)[-1] +// 1000000.0050045159 +// >>> c.sum() +// 1000000.0050000029 // -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: // -// AAAbb -// cccbb -// cccDD // -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +//go:linkname CumulativeSum py.cumulative_sum +func CumulativeSum(x *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this +// many digits. If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional // // Examples // -------- -// The most common use of this function is to build a block matrix +// >>> import numpy as np +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' // -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) // -// With a list of depth 1, `block` can be used as `hstack` +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object // -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) +// putmask(a, mask, values) // -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) +// Changes elements of an array based on conditional and input values. // -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. // -// With a list of depth 2, `block` can be used in place of `vstack`: +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. // -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. // -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) +// See Also +// -------- +// place, put, take, copyto // -// It can also be used in places of `atleast_1d` and `atleast_2d` +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) // -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) +// If `values` is smaller than `a` it is repeated: // -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) // // // +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object // -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// add_docstring(obj, docstring) +// vdot(a, b, /) // -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError +// Return the dot product of two vectors. // -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// The `vdot` function handles complex numbers differently than `dot`: +// if the first argument is complex, it is replaced by its complex conjugate +// in the dot product calculation. `vdot` also handles multidimensional +// arrays differently than `dot`: it does not perform a matrix product, but +// flattens the arguments to 1-D arrays before taking a vector dot product. // -// Insert values along the given axis before the given indices. +// Consequently, when the arguments are 2-D arrays of the same shape, this +// function effectively returns their +// `Frobenius inner product `_ +// (also known as the *trace inner product* or the *standard inner product* +// on a vector space of matrices). // // Parameters // ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. // // Returns // ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. // // See Also // -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. +// dot : Return the dot product without using the complex conjugate of the +// first argument. // // Examples // -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) +// >>> import numpy as np +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) // -// Difference between sequence and scalars: +// Note that higher-dimensional arrays are flattened! // -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 // -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) // -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) // -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) +// Compute the bit-wise AND of two arrays element-wise. // +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. // +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. // -// Put values into the destination array by matching 1d index and data slices. +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. // -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. +// Examples +// -------- +// >>> import numpy as np // -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: // -// .. versionadded:: 1.15.0 +// >>> np.bitwise_and(13, 17) +// 1 // -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) // -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) // -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. // -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) // -// Equivalently, eliminating the inner loop, the last two lines would be:: +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// a_1d[indices_1d] = values_1d +// Return element-wise quotient and remainder simultaneously. // -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. // -// Examples -// -------- +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// For this sample array +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. // -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. // -// We can replace the maximum values with: +// Examples +// -------- +// >>> import numpy as np +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) // -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truth value of (x1 > x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// +// See Also +// -------- +// greater_equal, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.greater([4,2],[2,2]) +// array([ True, False]) // +// The ``>`` operator can be used as a shorthand for ``np.greater`` on +// ndarrays. // +// >>> a = np.array([4, 2]) +// >>> b = np.array([2, 2]) +// >>> a > b +// array([ True, False]) // -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +//go:linkname Greater py.greater +func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// Set the floating-point error callback function or log object. // -// Join a sequence of arrays along an existing axis. +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. // // Parameters // ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). // -// .. versionadded:: 1.20.0 +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: // -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// [0 0 0 0 divide over under invalid] // -// .. versionadded:: 1.20.0 +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. // // Returns // ------- -// res : ndarray -// The concatenated array. +// h : callable, log instance or None +// The old error handler. // // See Also // -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. +// seterr, geterr, geterrcall // // Examples // -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) +// Callback upon error: // -// This function will not preserve masking of MaskedArray inputs. +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... // -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) +// >>> import numpy as np // +// >>> orig_handler = np.seterrcall(err_handler) +// >>> orig_err = np.seterr(all='call') // +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) // -//go:linkname Concatenate py.concatenate -func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object +// >>> np.seterrcall(orig_handler) +// +// >>> np.seterr(**orig_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} // -// Test whether all array elements along a given axis evaluate to True. +// Log error message: // -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... // -// .. versionadded:: 1.7.0 +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') // -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. +// >>> np.seterrcall(orig_handler) +// +// >>> np.seterr(**orig_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} // -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. // -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. // -// .. versionadded:: 1.20.0 +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. // // Returns // ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. // // See Also // -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. +// choose +// nonzero : The function that is called when x and y are omitted // // Notes // ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] // // Examples // -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. +// >>> import numpy as np +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) // -// .. versionadded:: 1.7.0 +// This can be used on multidimensional arrays too: // -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) // -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. +// The shapes of x, y, and the condition are broadcast together: // -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) // -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) // // -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object // -// Return the character for the minimum-size type to which given types can -// be safely cast. +// ravel_multi_index(multi_index, dims, mode='raise', order='C') // -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. // // Parameters // ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. // // Returns // ------- -// typechar : str -// The character representing the minimum-size type that was found. +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. // // See Also // -------- -// dtype, sctype2char, maximum_sctype +// unravel_index // // Examples // -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' +// >>> import numpy as np +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) // -// >>> np.mintypecode('abceh', default='G') -// 'G' +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 // // +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object // -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. // -// Check whether or not an object can be iterated over. +// Ones are returned for slices that are all-NaN or empty. // // Parameters // ---------- -// y : object -// Input object. +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. // // Returns // ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. // +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. // // Examples // -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: +// >>> import numpy as np +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) // -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False // // +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object // -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object +// Load data from a text file, with missing values handled as specified. // -// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. // // Parameters // ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. Any content before the comment delimiter is +// discarded. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field +// names in a structured dtype. If `names` is None, the names of the +// dtype fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` +// is a file object. The special value 'bytes' enables backward +// compatibility workarounds that ensure that you receive byte arrays +// when possible and passes latin1 encoded strings to converters. +// Override this value to receive unicode arrays and pass strings +// as input to converters. If set to None the system default is used. +// The default value is 'bytes'. +// +// .. versionchanged:: 2.0 +// Before NumPy 2, the default was ``'bytes'`` for Python 2 +// compatibility. The default is now ``None``. // -// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 // like : array_like, optional // Reference object to allow the creation of arrays which are not // NumPy arrays. If an array-like passed in as ``like`` supports @@ -10465,804 +9663,1093 @@ func Iterable(y *py.Object) *py.Object // // Returns // ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. // // See Also // -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. +// numpy.loadtxt : equivalent function when no data is missing. // -// See `tril_indices` for full details. +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When variables are named (either by a flexible dtype or with a `names` +// sequence), there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// * Custom converters may receive unexpected values due to dtype +// discovery. // -// Parameters +// References // ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. // // Examples // -------- +// >>> from io import StringIO +// >>> import numpy as np // -// Create a 4 by 4 array. +// Comma delimited file with mixed dtype // -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) +// >>> s = StringIO("1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// >>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, 'abcde'), +// dtype=[('myint', '>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// Specifying dtype and names // -// This is syntactic sugar for tril_indices(). +// >>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// An example with fixed-width columns // -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. +// >>> s = StringIO("11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, 'abcde'), +// dtype=[('intvar', '>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// An example to show comments // -// See Also -// -------- -// tril_indices, tril, triu_indices_from +// >>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) // -// Notes -// ----- -// .. versionadded:: 1.4.0 // // +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) // -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) +// Create nditers for use in nested loops // -// Return a contiguous array (ndim >= 1) in memory (C order). +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. // // Parameters // ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// op : ndarray or sequence of array_like +// The array(s) to iterate over. // -// .. versionadded:: 1.20.0 +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name // // Returns // ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first // // See Also // -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. +// nditer // // Examples // -------- -// Starting with a Fortran-contiguous array: // -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] // -// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// >>> import numpy as np +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 // -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Numerical positive, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `element` and `test_elements`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `element` plus the max-min value of `test_elements`. +// `assume_unique` has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `element` and `test_elements`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. // -// Now, starting with a C-contiguous array: // -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. // -// Then, calling ``ascontiguousarray`` returns the same object: +// Notes +// ----- +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. // -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. // -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(test_elements)) > +// (log10(max(test_elements)-min(test_elements)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. // -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// fastCopyAndTranspose(a) +// Examples +// -------- +// >>> import numpy as np +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) // -// .. deprecated:: 1.24 +// The indices of the matched values can be obtained with `nonzero`: // -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) // -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// The test can also be inverted: // -// Trigonometric inverse tangent, element-wise. +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) // -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// Because of how `array` handles sets, the following does not +// work as expected: // -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) // -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. +// Casting the set to a list gives the expected result: // -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) // -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. // -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object // -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. +// Compute the weighted average along the specified axis. // -// The inverse tangent is also known as `atan` or tan^{-1}. +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// `axis=None`, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The array of weights must be the same shape as `a` if no axis is +// specified, otherwise the weights must have dimensions and shape +// consistent with `a` along the specified axis. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// The calculation is:: // -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// avg = sum(a * weights) / sum(weights) // -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// where the sum is over all included elements. +// The only constraint on the values of `weights` is that `sum(weights)` +// must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. // -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) +// .. versionadded:: 1.23.0 // -// >>> np.pi/4 -// 0.78539816339744828 +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a general pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. // -// Plot arctan: +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When `weights` does not have the same shape as `a`, and `axis=None`. +// ValueError +// When `weights` does not have dimensions and shape consistent with `a` +// along specified `axis`. // -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() +// See Also +// -------- +// mean // -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. // -// Return element-wise quotient and remainder simultaneously. +// Examples +// -------- +// >>> import numpy as np +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 // -// .. versionadded:: 1.13.0 +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. // -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. +// With ``keepdims=True``, the following result has shape (3, 1). // -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) // -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. +// >>> data = np.arange(8).reshape((2, 2, 2)) +// >>> data +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.average(data, axis=(0, 1), weights=[[1./4, 3./4], [1., 1./2]]) +// array([3.4, 4.4]) +// >>> np.average(data, axis=0, weights=[[1./4, 3./4], [1., 1./2]]) +// Traceback (most recent call last): +// ... +// ValueError: Shape of weights must be consistent +// with shape of a along specified axis. // -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. // -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object // -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. // -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// Returns the qth percentile(s) of the array elements. // -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: // -// Apply a function to 1-D slices along the given axis. +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' // -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: // -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' // -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. // -// Equivalently, eliminating the inner loop, this can be expressed as:: +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. // -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. // -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the percentile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// +// .. versionadded:: 2.0.0 // -// .. versionadded:: 1.9.0 +// interpolation : str, optional +// Deprecated name for the method keyword argument. // +// .. deprecated:: 1.22.0 // // Returns // ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. // // See Also // -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// The behavior of `numpy.nanpercentile` with percentage `q` is that of +// `numpy.quantile` with argument ``q/100`` (ignoring nan values). +// For more information, please see `numpy.quantile`. // // Examples // -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) +// >>> import numpy as np +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// np.float64(nan) +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) // -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) // -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 // // -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object // -// Reverse the order of elements along axis 0 (up/down). +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object // -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. +// Load data from a text file. // // Parameters // ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. // -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. // -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. // -// >>> np.flipud([1,2]) -// array([2, 1]) +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. // +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is None. // +// .. versionchanged:: 2.0 +// Before NumPy 2, the default was ``'bytes'`` for Python 2 +// compatibility. The default is now ``None``. // -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. // -// Return the indices to access (n, n) arrays, given a masking function. +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. // -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. // -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. +// out : ndarray +// Data read from the text file. // // See Also // -------- -// triu, tril, triu_indices, tril_indices +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files // // Notes // ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. // -// >>> iu = np.mask_indices(3, np.triu) +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. // -// For example, if `a` is a 3x3 array: +// The strings produced by the Python float.hex method can be used as +// input for floats. // -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) +// Examples +// -------- +// >>> import numpy as np +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) // -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> iu1 = np.mask_indices(3, np.triu, 1) +// >>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) // -// with which we now extract only three elements: +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: // -// >>> a[iu1] -// array([1, 2, 5]) +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) // +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: // +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) // -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. // -// Return the roots of a polynomial with coefficients given in p. +// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith("-") else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: // -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) // -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// This idea can be extended to automatically handle values specified in +// many different formats, such as hex values: // -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) // -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. +// Or a format where the ``-`` sign comes after the number: // -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. +// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") +// >>> conv = lambda x: -float(x[:-1]) if x.endswith("-") else float(x) +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) // -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: // -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// >>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) // -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. // -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// Broadcast an array to a new shape. // // Parameters // ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). // // Returns // ------- -// out : dtype -// The minimal data type. +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. // -// Notes -// ----- -// .. versionadded:: 1.6.0 +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. // // See Also // -------- -// result_type, promote_types, dtype, can_cast +// broadcast +// broadcast_arrays +// broadcast_shapes // // Examples // -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') +// >>> import numpy as np +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) // -// >>> np.min_scalar_type(3.1) -// dtype('float16') // -// >>> np.min_scalar_type(1e50) -// dtype('float64') +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object // -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') +// Interpret the input as a matrix. // +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. // +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. // -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. // -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[1, 2], [3, 4]]) // -// Return a new array with the same shape and type as a given array. +// >>> m = np.asmatrix(x) // -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. +// >>> x[0,0] = 5 // -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. +// >>> m +// matrix([[5, 2], +// [3, 4]]) // -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. // -// .. versionadded:: 1.17.0 // -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// bitwise_count(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. +// Computes the number of 1-bits in the absolute value of ``x``. +// Analogous to the builtin `int.bit_count` or ``popcount`` in C++. // -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. +// Parameters +// ---------- +// x : array_like, unsigned int +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// Returns +// ------- +// y : ndarray +// The corresponding number of 1-bits in the input. +// Returns uint8 for all integer types +// This is a scalar if `x` is a scalar. // +// References +// ---------- +// .. [1] https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel // +// .. [2] Wikipedia, "Hamming weight", +// https://en.wikipedia.org/wiki/Hamming_weight // -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// Return a contiguous flattened array. +// .. [3] http://aggregate.ee.engr.uky.edu/MAGIC/#Population%20Count%20(Ones%20Count) // -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. +// Examples +// -------- +// >>> import numpy as np +// >>> np.bitwise_count(1023) +// np.uint8(10) +// >>> a = np.array([2**i - 1 for i in range(16)]) +// >>> np.bitwise_count(a) +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], +// dtype=uint8) +// +//go:linkname BitwiseCount py.bitwise_count +func BitwiseCount(x *py.Object, out *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) // -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) +// A new 1-D array initialized from text data in a string. // // Parameters // ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. // -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. // // See Also // -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. +// frombuffer, fromfile, fromiter // // Examples // -------- -// It is equivalent to ``reshape(-1, order=order)``. +// >>> import numpy as np +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) // -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object // -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) +// Return a full array with the same shape and type as a given array. // -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// .. versionadded:: 2.0.0 // -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. // -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. // -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) // -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) // +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) // // -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Given the "legs" of a right triangle, return its hypotenuse. +// Logarithm of the sum of exponentiations of the inputs. // -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. // // Parameters // ---------- // x1, x2 : array_like -// Leg of the triangle(s). +// Input values. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -11283,1116 +10770,1113 @@ func Ravel(a *py.Object, order *py.Object) *py.Object // // Returns // ------- -// z : ndarray -// The hypotenuse of the triangle(s). +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. // This is a scalar if both `x1` and `x2` are scalars. // -// Examples +// See Also // -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. // -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. +// Examples +// -------- +// >>> import numpy as np +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 // -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. +// Element-wise maximum of array elements. // -// .. versionadded:: 1.17 +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. // +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. // -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. // -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) +// fmin, amin, nanmin // -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. // -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// Examples +// -------- +// >>> import numpy as np +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) // +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) // -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.inf, 1) +// inf // -// Stack arrays in sequence depth wise (along third axis). +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. +// Returns an array with axes transposed. // -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. +// For a 1-D array, this returns an unchanged view of the original array, as a +// transposed vector is simply the same vector. +// To convert a 1-D array into a 2-D column vector, an additional dimension +// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does +// ``a[:, np.newaxis]``. +// For a 2-D array, this is the standard matrix transpose. +// For an n-D array, if axes are given, their order indicates how the +// axes are permuted (see Examples). If axes are not provided, then +// ``transpose(a).shape == a.shape[::-1]``. // // Parameters // ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. +// a : array_like +// Input array. +// axes : tuple or list of ints, optional +// If specified, it must be a tuple or list which contains a permutation +// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative +// indices can also be used to specify axes. The i-th axis of the returned +// array will correspond to the axis numbered ``axes[i]`` of the input. +// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses +// the order of the axes. // // Returns // ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. +// p : ndarray +// `a` with its axes permuted. A view is returned whenever possible. // // See Also // -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. +// ndarray.transpose : Equivalent method. +// moveaxis : Move axes of an array to new positions. +// argsort : Return the indices that would sort an array. +// +// Notes +// ----- +// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors +// when using the `axes` keyword argument. // // Examples // -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) // -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) // +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) // +// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) +// >>> np.transpose(a, (-1, 0, -2)).shape +// (5, 3, 4) // -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object // -// Find the coefficients of a polynomial with the given sequence of roots. // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +//go:linkname PermuteDims py.permute_dims +func PermuteDims(a *py.Object, axes *py.Object) *py.Object // -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. // // Parameters // ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. // // Returns // ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. // -// See Also +// Examples // -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. +// >>> import numpy as np +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) // -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) // -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by // -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object // -// where **I** is the `n`-by-`n` identity matrix. [2]_ +// Extract a diagonal or construct a diagonal array. // -// References +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters // ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. // -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. // // Examples // -------- -// Given a sequence of a polynomial's zeros: +// >>> import numpy as np +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) // -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) // -// The line above represents z**3 + 0*z**2 + 0*z + 0. +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) // -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) // -// The line above represents z**3 - z/4 // -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Given a square array object: +// Return the next floating-point value after x1 towards x2, element-wise. // -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Note how in all cases the leading coefficient is always 1. +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> import numpy as np +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) // +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // +// bincount(x, /, weights=None, minlength=0) // -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object +// Count number of occurrences of each value in array of non-negative ints. // -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. // // Parameters // ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. // // Returns // ------- -// index_array : ndarray -// An array of indices or a single index value. +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. // // See Also // -------- -// argmin, nanargmax +// histogram, digitize, unique // // Examples // -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) +// >>> import numpy as np +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) // +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True // +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: // -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' // -// Clip (limit) the values in an array. +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. // -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) // -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. // -// No check is performed to ensure ``a_min < a_max``. +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. // // Parameters // ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. // // Returns // ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. +// y : ndarray +// A rotated view of `m`. // // See Also // -------- -// :ref:`ufuncs-output-type` +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. // // Notes // ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` // // Examples // -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> import numpy as np +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) // // // -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object // -// Sum of array elements over a given axis. +// Split an array into multiple sub-arrays as views into `ary`. // // Parameters // ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. // -// The sum of an empty array is the neutral element 0: +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in // -// >>> np.sum([]) -// 0.0 +// - ary[:2] +// - ary[2:3] +// - ary[3:] // -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). // // Examples // -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) +// >>> import numpy as np +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] // -// If the accumulator is too small, overflow occurs: +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] // -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 // -// You can also start the sum with a value other than zero: // -// >>> np.sum([10], initial=5) -// 15 +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object // +// Reverse the order of elements along axis 1 (left/right). // -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. // -// First array elements raised to powers from second array, element-wise. +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. // -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. // -// An integer type raised to a negative integer power will raise a -// ``ValueError``. +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. // -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. // -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) // -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. +// >>> rng = np.random.default_rng() +// >>> A = rng.normal(size=(2,3,5)) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True // -// See Also -// -------- -// float_power : power function that promotes integers to float // -// Examples -// -------- -// Cube each element in an array. // -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object // -// Raise the bases to different exponents. +// Return the indices for the upper-triangle of an (n, m) array. // -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. // -// The effect of broadcasting. // -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The row and column indices, respectively. The row indices are sorted +// in non-decreasing order, and the correspdonding column indices are +// strictly increasing for each row. // -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril // -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) +// Examples +// -------- +// >>> import numpy as np // -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: // -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) +// >>> iu1 = np.triu_indices(4) +// >>> iu1 +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) // -// To get complex results, give the argument ``dtype=complex``. +// Note that row indices (first array) are non-decreasing, and the corresponding +// column indices (second array) are strictly increasing for each row. // -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// Here is how they can be used with a sample array: // -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) // -// Return evenly spaced numbers over a specified interval. +// Both for indexing: // -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) // -// The endpoint of the interval can optionally be excluded. +// And for assigning values: // -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) // -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// These cover only a small part of the whole array (two diagonals right +// of the main one): // -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. +// >>> iu2 = np.triu_indices(4, 2) +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) // -// .. versionadded:: 1.9.0 // -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. // -// .. versionadded:: 1.16.0 +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object // -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True +// Test whether all array elements along a given axis evaluate to True. // -// Size of spacing between samples. +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. If this +// is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` +// for more details. // +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. // -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. // -// Graphical illustration: +// .. versionadded:: 1.20.0 // -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. // +// See Also +// -------- +// ndarray.all : equivalent method // +// any : Test whether any element along a given axis evaluates to True. // -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. // -// Join a sequence of arrays along a new axis. +// .. versionchanged:: 2.0 +// Before NumPy 2.0, ``all`` did not return booleans for object dtype +// input arrays. +// This behavior is still available via ``np.logical_and.reduce``. // -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. +// Examples +// -------- +// >>> import numpy as np +// >>> np.all([[True,False],[True,True]]) +// False // -// .. versionadded:: 1.10.0 +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) // -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. +// >>> np.all([-1, 4, 5]) +// True // -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. +// >>> np.all([1.0, np.nan]) +// True // -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True // -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary // -// .. versionadded:: 1.24 // -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. // -// .. versionadded:: 1.24 +//go:linkname All py.all +func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// Return the number of dimensions of an array. // +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. // // Returns // ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. // // See Also // -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array // // Examples // -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) +// >>> import numpy as np +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 // -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) // // +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object // -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// Return a new array with the specified shape. // -// Test element-wise for negative infinity, return result as bool array. +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. // // Parameters // ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. // // Returns // ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. // // See Also // -------- -// isinf, isposinf, isnan, isfinite +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. // // Notes // ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. // -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. // // Examples // -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// +// >>> import numpy as np +// >>> a = np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) // -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object // -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. // -// One is returned for slices that are all-NaN or empty. +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object // -// .. versionadded:: 1.10.0 +// Return a string representation of a number in the given base system. // // Parameters // ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). // // Returns // ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. +// out : str +// String representation of `number` in `base` system. // // See Also // -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. +// binary_repr : Faster version of `base_repr` for base 2. // // Examples // -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) +// >>> import numpy as np +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' // // // -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object // -// Convert the input to an array. +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete. If you only want to check if an array is Fortran +// contiguous use ``a.flags.f_contiguous`` instead. // // Parameters // ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 +// a : ndarray +// Input array. // // Returns // ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. // -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. // // Examples // -------- -// Convert a list into an array: // -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). // -// Existing arrays are not copied: +// >>> import numpy as np +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False // -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) // True // -// If `dtype` is set, array is copied only if dtype does not match: // -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) // False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True // -// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. // -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a +// >>> np.isfortran(np.array([1, 2], order='F')) // False -// >>> np.asanyarray(a) is a -// True // -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object // -// Return an array of ones with the same shape and type as a given array. +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// Remove values along a dimension which are zero along all other. // // Parameters // ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. +// filt : array_like +// Input array. +// trim : {"fb", "f", "b"}, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. By default, zeros are trimmed on both sides. +// Front and back refer to the edges of a dimension, with "front" referring +// to the side with the lowest index 0, and "back" referring to the highest +// index (or index -1). +// axis : int or sequence, optional +// If None, `filt` is cropped such that the smallest bounding box is +// returned that still contains all values which are not zero. +// If an axis is specified, `filt` will be sliced in that dimension only +// on the sides specified by `trim`. The remaining area will be the +// smallest that still contains all values wich are not zero. // -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. +// .. versionadded:: 2.2.0 // -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. +// Returns +// ------- +// trimmed : ndarray or sequence +// The result of trimming the input. The number of dimensions and the +// input data type are preserved. +// +// Notes +// ----- +// For all-zero arrays, the first axis is trimmed first. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) // -// .. versionadded:: 1.17.0 +// >>> np.trim_zeros(a, trim='b') +// array([0, 0, 0, ..., 0, 2, 1]) // -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. +// Multiple dimensions are supported. // -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. +// >>> b = np.array([[0, 0, 2, 3, 0, 0], +// ... [0, 1, 0, 3, 0, 0], +// ... [0, 0, 0, 0, 0, 0]]) +// >>> np.trim_zeros(b) +// array([[0, 2, 3], +// [1, 0, 3]]) // -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) +// >>> np.trim_zeros(b, axis=-1) +// array([[0, 2, 3], +// [1, 0, 3], +// [0, 0, 0]]) // -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] // // // -//go:linkname OnesLike py.ones_like -func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object, axis *py.Object) *py.Object // -// Interchange two axes of an array. +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. // // Parameters // ---------- // a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 // // Returns // ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. +// index_array : ndarray +// An array of indices or a single index value. // -// Examples +// See Also // -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) +// argmin, nanargmax // -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) // // // -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Nanargmin py.nanargmin +func Nanargmin(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Return the complex conjugate, element-wise. +// Trigonometric inverse tangent, element-wise. // -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. // // Parameters // ---------- // x : array_like -// Input value. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -12411,1574 +11895,1564 @@ func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). // This is a scalar if `x` is a scalar. // +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// // Notes // ----- -// `conj` is an alias for `conjugate`: +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. // -// >>> np.conj is np.conjugate -// True +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm // // Examples // -------- -// >>> np.conjugate(1+2j) -// (1-2j) // -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: // -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) +// >>> import numpy as np +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) // -// Get information about the step size of a date or time type. +// >>> np.pi/4 +// 0.78539816339744828 // -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Atan py.atan +func Atan(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. // // Parameters // ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. // -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. // // Examples // -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') +// >>> import numpy as np +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary // -// The result can be used to construct a datetime that uses the same units -// as a timedelta +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) // -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') // -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object // -// Calculate the n-th discrete difference along the given axis. +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, device=None, like=None) // -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. +// Return a new array of given shape and type, without initializing entries. // // Parameters // ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// .. versionadded:: 1.16.0 +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. // // See Also // -------- -// gradient, ediff1d, cumsum +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. // // Notes // ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) +// Unlike other array creation functions (e.g. `zeros`, `ones`, `full`), +// `empty` does not initialize the values of the array, and may therefore be +// marginally faster. However, the values stored in the newly allocated array +// are arbitrary. For reproducible behavior, be sure to set each element of +// the array before reading. // // Examples // -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// +// >>> import numpy as np +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized // +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized // -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object // -// Return the derivative of the specified order of a polynomial. +// Return an array representing the indices of a grid. // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. // // Parameters // ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. // // Returns // ------- -// der : poly1d -// A new polynomial representing the derivative. +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place // // See Also // -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. +// mgrid, ogrid, meshgrid // -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. // -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: // -// which evaluates to: +// grid[k, i0, i1, ..., iN-1] = ik // -// >>> p2(2.) -// 17.0 +// Examples +// -------- +// >>> import numpy as np +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) // -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: +// The indices can be used as an index into an array. // -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) // -// The fourth-order derivative of a 3rd-order polynomial is zero: +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. // -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) +// If sparse is set to true, the grid will be returned in a sparse +// representation. // +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) // // -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object // -// Determine if a class is a subclass of a second class. +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object // -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. +// Returns True if the type of `element` is a scalar type. // // Parameters // ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. +// element : any +// Input argument, can be of any type and shape. // // Returns // ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. +// val : bool +// True if `element` is a scalar type, False if it is not. // // See Also // -------- -// issubsctype, issubdtype, issctype +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and +// the ``bins`` argument to `histogram`. Some key differences: +// +// +------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +====================================+===============+===================+ +// | PEP 3141 numeric objects | ``True`` | ``True`` | +// | (including builtins) | | | +// +------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other | ``False`` | ``False`` | +// | sequence objects | | | +// +------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> np.isscalar(3.1) +// True // -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) +// >>> np.isscalar(np.array(3.1)) // False -// >>> np.issubclass_(np.int32, float) +// +// >>> np.isscalar([3.1]) // False -// >>> np.issubclass_(np.float64, float) -// True // +// >>> np.isscalar(False) +// True // +// >>> np.isscalar('numpy') +// True // -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// NumPy supports PEP 3141 numbers: // -// Subtract arguments, element-wise. +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True // -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. // -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. // -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object // -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 +// Return the minimum of an array or minimum along an axis. // -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. // -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. // -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. // -// Return the string representation of a scalar dtype. +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. // -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. // // Returns // ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. // // See Also // -------- -// obj2sctype, issctype, issubsctype, mintypecode +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. // // Examples // -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O +// >>> import numpy as np +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) // -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.nan +// >>> np.min(b) +// np.float64(nan) +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. // +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 // // -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// Range of values (maximum - minimum) along an axis. // -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. +// The name of the function comes from the acronym for 'peak to peak'. // -// .. versionadded:: 1.7.0 +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `numpy.int8`, `numpy.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. // // Parameters // ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. // -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. // // Returns // ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis // // Examples // -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') +// >>> import numpy as np +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) // -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. // +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: // -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) // -// Stack arrays in sequence vertically (row wise). // -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. // -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) // -// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// Return a new array of given shape and type, filled with zeros. // // Parameters // ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// .. versionadded:: 1.24 +// .. versionadded:: 1.20.0 // // Returns // ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. +// out : ndarray +// Array of zeros with the given shape, dtype, and order. // // See Also // -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. // // Examples // -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) +// >>> import numpy as np +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) // -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) // +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) // +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) // -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) +// >>> import numpy as np +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) // -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True // +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object // +// Stack arrays in sequence depth wise (along third axis). // -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. // -// Pad an array. +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. // // Parameters // ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. // -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. // -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. // -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) // -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) // -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. // -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. // -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object // -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. +// Returns the indices of the minimum values along an axis. // -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. // -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. +// .. versionadded:: 1.22.0 // // Returns // ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. // // Notes // ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. // // Examples // -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// >>> import numpy as np +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) // -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// Indices of the minimum elements of a N-dimensional array: // -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 // -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 // -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), +// ... axis=-1).squeeze(axis=-1) +// array([2, 0]) // -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// Setting `keepdims` to `True`, // -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) // -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) // -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object // +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. // -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// Zeros are returned for slices that are all-NaN or empty. // -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. // -// .. versionadded:: 1.24.0 +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. // // See Also // -------- -// show_config : Show libraries in the system on which NumPy was built. +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. // -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// Examples +// -------- +// >>> import numpy as np +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) // // // -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// empty(shape, dtype=float, order='C', *, like=None) +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object // -// Return a new array of given shape and type, without initializing entries. +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. // // Parameters // ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of ``arr``. This must match the +// dimension of ``arr``, but dimensions Ni and Nj only need to broadcast +// against ``arr``. +// axis : int or None, optional +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. // -// .. versionadded:: 1.20.0 +// .. versionchanged:: 2.3 +// The default value is now ``-1``. // // Returns // ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// +// out: ndarray (Ni..., J, Nk...) +// The indexed result. // // Notes // ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: // -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) // -// Find the indices of array elements that are non-zero, grouped by element. +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] // -// Parameters -// ---------- -// a : array_like -// Input data. +// Equivalently, eliminating the inner loop, the last two lines would be:: // -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. +// out_1d[:] = a_1d[indices_1d] // // See Also // -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices // // Examples // -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// +// >>> import numpy as np // -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) +// For this sample array // -// Takes an arbitrary Python function and returns a NumPy ufunc. +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) // -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). +// We can sort either by using sort directly, or argsort and this function // -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) // -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: // -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) // -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. +// If we want to get the max and min at the same time, we can stack the +// indices first // -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) // -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). // -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. +// Returns +// ------- +// broadcasted : tuple of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. // -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. // -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes // -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// (array([[1, 2, 3], +// [1, 2, 3]]), +// array([[4, 4, 4], +// [5, 5, 5]])) // -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. // -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), +// array([[4, 4, 4], +// [5, 5, 5]])] // -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object // -// Determines whether the given object represents a scalar data-type. +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. // // Parameters // ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. // // Returns // ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. // // See Also // -------- -// issubsctype, issubdtype, obj2sctype, sctype2char +// triu, tril, triu_indices, tril_indices // // Examples // -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False +// >>> import numpy as np // -// Strings are also a scalar type: +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: // -// >>> np.issctype(np.dtype('str')) -// True +// >>> iu = np.mask_indices(3, np.triu) // +// For example, if `a` is a 3x3 array: // +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) // -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: // -// Take elements from an array along an axis. +// >>> iu1 = np.mask_indices(3, np.triu, 1) // -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. +// with which we now extract only three elements: // -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: +// >>> a[iu1] +// array([1, 2, 5]) // -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] // -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. // -// .. versionadded:: 1.8.0 +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object // -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. // -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. // -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. +// .. warning:: The default `atol` is not appropriate for comparing numbers +// with magnitudes much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : array_like +// The relative tolerance parameter (see Notes). +// atol : array_like +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. // // Returns // ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. // // See Also // -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays +// allclose +// math.isclose // // Notes // ----- +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent.:: // -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: +// absolute(a - b) <= (atol + rtol * absolute(b)) // -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. // -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: +// The default value of `atol` is not appropriate when the reference value +// `b` has magnitude smaller than one. For example, it is unlikely that +// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet +// ``isclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure +// to select `atol` for the use case at hand, especially for defining the +// threshold below which a non-zero value in `a` will be considered "close" +// to a very small or zero value in `b`. // -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// `isclose` is not defined for non-numeric data types. +// :class:`bool` is considered a numeric data-type for this purpose. // // Examples // -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. +// >>> import numpy as np +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) // -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) // -// If `indices` is not one dimensional, the output also has these dimensions. +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) // -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) // +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) // -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) // -// Format a floating-point scalar as a decimal string in scientific notation. +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) // -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) // -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) // -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. // -// -- versionadded:: 1.21.0 // -// Returns -// ------- -// rep : string -// The string representation of the floating point value +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// Context manager for setting print options. // -// See Also -// -------- -// format_float_positional +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. // // Examples // -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' +// >>> import numpy as np // +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) // -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// The `as`-clause of the `with`-statement gives the current print options: // -// Returns a bool array, where True if input element is real. +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) // -// If element has complex type with zero complex part, the return value -// for that element is True. +// See Also +// -------- +// set_printoptions, get_printoptions // -// Parameters -// ---------- -// x : array_like -// Input array. // -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. // -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object // -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. +// Return the directory that contains the NumPy \*.h header files. // -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) +// Extension modules that need to compile against NumPy may need to use this +// function to locate the appropriate include directory. // -// The function does not work on string arrays. +// Notes +// ----- +// When using ``setuptools``, for example in ``setup.py``:: // -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... // -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. +// Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using +// that is likely preferred for build systems other than ``setuptools``:: // -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) +// $ numpy-config --cflags +// -I/path/to/site-packages/numpy/_core/include // -// isreal should not be used with object arrays +// # Or rely on pkg-config: +// $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir) +// $ pkg-config --cflags +// -I/path/to/site-packages/numpy/_core/include // -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) +// Examples +// -------- +// >>> np.get_include() +// '.../site-packages/numpy/core/include' # may vary // // // -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object // -// Load data from a text file, with missing values handled as specified. +// Copies an array to a specified data type. // -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. +// This function is an Array API compatible alternative to +// `numpy.ndarray.astype`. // // Parameters // ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// x : ndarray +// Input NumPy array to cast. ``array_likes`` are explicitly not +// supported here. +// dtype : dtype +// Data type of the result. +// copy : bool, optional +// Specifies whether to copy an array when the specified dtype matches +// the data type of the input array ``x``. If ``True``, a newly allocated +// array must always be returned. If ``False`` and the specified dtype +// matches the data type of the input array, the input array must be +// returned; otherwise, a newly allocated array must be returned. +// Defaults to ``True``. +// device : str, optional +// The device on which to place the returned array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// .. versionadded:: 1.20.0 +// .. versionadded:: 2.1.0 // // Returns // ------- // out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. +// An array having the specified data type. // // See Also // -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. +// ndarray.astype // // Examples // -------- -// >>> from io import StringIO // >>> import numpy as np +// >>> arr = np.array([1, 2, 3]); arr +// array([1, 2, 3]) +// >>> np.astype(arr, np.float64) +// array([1., 2., 3.]) // -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// >>> arr = np.array([1, 2, 3]) +// >>> arr_noncpy = np.astype(arr, arr.dtype, copy=False) +// >>> np.shares_memory(arr, arr_noncpy) +// True // // // -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Astype py.astype +func Astype(x *py.Object, dtype *py.Object) *py.Object // -// Calculate the absolute value element-wise. +// can_cast(from_, to, casting='safe') // -// ``np.abs`` is a shorthand for this function. +// Returns True if cast between data types can occur according to the +// casting rule. // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Parameters +// ---------- +// from_ : dtype, dtype specifier, NumPy scalar, or array +// Data type, NumPy scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. // -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. // -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. // -// Plot the function over ``[-10, 10]``: +// Notes +// ----- +// .. versionchanged:: 2.0 +// This function does not support Python scalars anymore and does not +// apply any value-based logic for 0-D arrays and NumPy scalars. // -// >>> import matplotlib.pyplot as plt +// See also +// -------- +// dtype, result_type // -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() +// Examples +// -------- +// Basic examples // -// Plot the function over the complex plane: +// >>> import numpy as np +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False // -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False // -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. // -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) // -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object // -// Show libraries and system information on which NumPy was built -// and is being used +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. // // Parameters // ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. // // Returns // ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. // // See Also // -------- -// get_include : Returns the directory containing NumPy C -// header files. +// einsum, linalg.multi_dot // -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. // +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il // // -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// A more complex index transformation example. // -// Returns the element-wise remainder of division. +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') // -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh // -// .. warning:: // -// This should not be confused with: +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. +// Test element-wise for NaT (not a time) and return result as a boolean array. // // Parameters // ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// x : array_like +// Input array with datetime or timedelta data type. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -13995,329 +13469,246 @@ func ShowConfig(mode *py.Object) *py.Object // For other keyword-only arguments, see the // :ref:`ufunc docs `. // -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. // +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite // -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// Examples +// -------- +// >>> import numpy as np +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) // -// Return the indices for the upper-triangle of an (n, m) array. +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. // // Parameters // ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: // -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ // +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis // // Returns // ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. // -// See also +// See Also // -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. // // Examples // -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): +// >>> import numpy as np +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) // -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) // // +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object // -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// Broadcast the input shapes into a single shape. // -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. +// :ref:`Learn more about broadcasting here `. // +// .. versionadded:: 1.20.0 // // Parameters // ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 +// *args : tuples of ints, or ints +// The shapes to be broadcast against each other. // // Returns // ------- -// index_array : ndarray -// An array of indices or a single index value. +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. // // See Also // -------- -// argmax, nanargmin +// broadcast +// broadcast_arrays +// broadcast_to // // Examples // -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// +// >>> import numpy as np +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) // +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) // -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object // -// Replaces specified elements of an array with given values. +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object // -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: +// copyto(dst, src, casting='same_kind', where=True) // -// :: +// Copies values from one array to another, broadcasting as necessary. // -// a.flat[ind] = v +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. // // Parameters // ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. // -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. // // Examples // -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) +// >>> import numpy as np +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. // -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.cosh(0) +// 1.0 // +// The hyperbolic cosine describes the shape of a hanging cable: // -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() // -// Compute the bit-wise OR of two arrays element-wise. +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. +// Return the truth value of (x1 <= x2) element-wise. // // Parameters // ---------- // x1, x2 : array_like -// Only integer and boolean types are handled. +// Input arrays. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -14339,63 +13730,38 @@ func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object // Returns // ------- // out : ndarray or scalar -// Result. +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. // This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. +// greater, less, greater_equal, equal, not_equal // // Examples // -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) +// >>> import numpy as np +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) // -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on // ndarrays. // -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) // -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Return the distance between x and the nearest adjacent number. +// Trigonometric sine, element-wise. // // Parameters // ---------- // x : array_like -// Values to find the spacing of. +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -14414,325 +13780,475 @@ func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// The spacing of values of `x`. +// y : array_like +// The sine of each element of x. // This is a scalar if `x` is a scalar. // +// See Also +// -------- +// arcsin, sinh, cos +// // Notes // ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. // // Examples // -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True +// >>> import numpy as np // -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object +// Print sine of one angle: // -// Return an array copy of the given object. +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. // // Parameters // ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). // -// .. versionadded:: 1.19.0 +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. // // Returns // ------- -// arr : ndarray -// Array interpretation of `a`. +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : tuple of ndarrays +// A tuple of D arrays describing the bin edges for each dimension. // // See Also // -------- -// ndarray.copy : Preferred method for creating an array copy +// histogram: 1-D histogram +// histogram2d: 2-D histogram // -// Notes -// ----- -// This is equivalent to: +// Examples +// -------- +// >>> import numpy as np +// >>> rng = np.random.default_rng() +// >>> r = rng.normal(size=(100,3)) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) // -// >>> np.array(a, copy=True) #doctest: +SKIP +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. // -// Examples -// -------- -// Create an array x, with a reference y and a copy z: +// Examples +// -------- +// >>> import numpy as np +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Note that, when we modify x, y changes, but not z: +// Test element-wise for finiteness (not infinity and not Not a Number). // -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False +// The result is returned as a boolean array. // -// Note that, np.copy clears previously set WRITEABLE=False flag. +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. // -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): +// See Also +// -------- +// isinf, isneginf, isposinf, isnan // -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. // -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. // -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) +// Examples +// -------- +// >>> import numpy as np +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(-np.inf) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) // +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) // +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object // -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// Change elements of an array based on conditional and input values. // -// Apply a function repeatedly over multiple axes. +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. // -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. +// Note that `extract` does the exact opposite of `place`. // // Parameters // ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. // // See Also // -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. +// copyto, put, take, extract // // Examples // -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) +// >>> import numpy as np +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) // // // -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object // -// Returns pointers to the end-points of an array. +// Sort a complex array using the real part first, then the imaginary part. // // Parameters // ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. +// a : array_like +// Input array // // Returns // ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. +// out : complex ndarray +// Always returns a sorted complex array. // // Examples // -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True +// >>> import numpy as np +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) // +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) // // -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object // -// Find the intersection of two arrays. +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object // -// Return the sorted, unique values that are in both of the input arrays. +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. // // Parameters // ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. // -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. // -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. // -// To intersect more than two arrays, use functools.reduce: +// .. versionadded:: 1.22.0 // -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. // -// To return the indices of the values common to the input arrays -// along with the intersected values: +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. // -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// amax, fmax, maximum // +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. // +// If the input has a integer type the function is equivalent to np.min. // -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) // -// Interpret the input as a matrix. +// When positive infinity and negative infinity are present: // -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, -np.inf]) +// -inf // -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. // -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. // -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> m = np.asmatrix(x) +// Change the sign of x1 to that of x2, element-wise. // -// >>> x[0,0] = 5 +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. // -// >>> m -// matrix([[5, 2], -// [3, 4]]) +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. // +// Examples +// -------- +// >>> import numpy as np +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf // -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) // -// Return the cube-root of an array, element-wise. +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// .. versionadded:: 1.10.0 +// Calculate `2**p` for all `p` in the input array. // // Parameters // ---------- // x : array_like -// The values whose cube-roots are required. +// Input values. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -14751,442 +14267,418 @@ func Asmatrix(data *py.Object, dtype *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. +// out : ndarray or scalar +// Element-wise 2 to the power `x`. // This is a scalar if `x` is a scalar. // +// See Also +// -------- +// power // // Examples // -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. +// >>> import numpy as np +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) // -// .. versionadded:: 1.6.0 +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. +// Element-wise maximum of array elements. // -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. // -// See Also -// -------- -// histogram, digitize, unique +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. // -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. // -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: +// minimum, amin, nanmin // -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' +// Notes +// ----- +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. // -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. +// Examples +// -------- +// >>> import numpy as np +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2, 5, 4]) // -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) // +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) // +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) // -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// Takes an arbitrary Python function and returns a NumPy ufunc. // -// Returns the indices of the minimum values along an axis. +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). // // Parameters // ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. // // Returns // ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. // // See Also // -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. // // Notes // ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. +// The returned ufunc always returns PyObject arrays. // // Examples // -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) +// Use frompyfunc to add broadcasting to the Python function ``oct``: // -// Indices of the minimum elements of a N-dimensional array: +// >>> import numpy as np +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 +//go:linkname Frompyfunc py.frompyfunc +func Frompyfunc(func_ *py.Object, nin *py.Object, nout *py.Object) *py.Object +//go:linkname Heaviside py.heaviside +func Heaviside(__llgo_va_list ...interface{}) *py.Object // -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 +// Return the indices of the elements that are non-zero. // -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. // -// Setting `keepdims` to `True`, +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. // -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) +// .. note:: // +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. // -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// .. deprecated:: 1.17.0 // -// Evenly round to the given number of decimals. +// Use `atleast_1d` explicitly if this behavior is deliberate. // // Parameters // ---------- // a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. +// Input array. // // Returns // ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. // // See Also // -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. // // Notes // ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. // -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) // -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) // -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. // -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) // -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. +// Using this result to index `a` is equivalent to using the mask directly: // -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) // -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// ddof : {int, float}, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. See Notes for details about use of `ddof`. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. // -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// .. versionadded:: 1.20.0 // -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) +// mean : array_like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this std function. // +// .. versionadded:: 2.0.0 // +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. // -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// .. versionadded:: 2.0.0 // -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. // -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` // -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. +// Notes +// ----- +// There are several common variants of the array standard deviation +// calculation. Assuming the input `a` is a one-dimensional NumPy array +// and ``mean`` is either provided as an argument or computed as +// ``a.mean()``, NumPy computes the standard deviation of an array as:: // -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// N = len(a) +// d2 = abs(a - mean)**2 # abs is for complex `a` +// var = d2.sum() / (N - ddof) # note use of `ddof` +// std = var**0.5 // -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. +// Different values of the argument `ddof` are useful in different +// contexts. NumPy's default ``ddof=0`` corresponds with the expression: // -// See Also -// -------- -// arctan, tan, angle +// .. math:: // -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ +// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N}} // -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ +// which is sometimes called the "population standard deviation" in the field +// of statistics because it applies the definition of standard deviation to +// `a` as if `a` were a complete population of possible observations. // -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. +// Many other libraries define the standard deviation of an array +// differently, e.g.: // -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// .. math:: // -// Examples -// -------- -// Consider four points in different quadrants: +// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N - 1}} // -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) +// In statistics, the resulting quantity is sometimes called the "sample +// standard deviation" because if `a` is a random sample from a larger +// population, this calculation provides the square root of an unbiased +// estimate of the variance of the population. The use of :math:`N-1` in the +// denominator is often called "Bessel's correction" because it corrects for +// bias (toward lower values) in the variance estimate introduced when the +// sample mean of `a` is used in place of the true mean of the population. +// The resulting estimate of the standard deviation is still biased, but less +// than it would have been without the correction. For this quantity, use +// ``ddof=1``. // -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. // -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) +// For floating-point input, the standard deviation is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. // -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) // -// Return the truth value of (x1 > x2) element-wise. +// In single precision, std() can be inaccurate: // -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// np.float32(0.45000005) // -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. +// Computing the standard deviation in float64 is more accurate: // +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary // -// See Also -// -------- -// greater_equal, less, less_equal, equal, not_equal +// Specifying a where argument: // -// Examples -// -------- -// >>> np.greater([4,2],[2,2]) -// array([ True, False]) +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 // -// The ``>`` operator can be used as a shorthand for ``np.greater`` on -// ndarrays. +// Using the mean keyword to save computation time: // -// >>> a = np.array([4, 2]) -// >>> b = np.array([2, 2]) -// >>> a > b -// array([ True, False]) +// >>> import numpy as np +// >>> from timeit import timeit +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> mean = np.mean(a, axis=1, keepdims=True) +// >>> +// >>> g = globals() +// >>> n = 10000 +// >>> t1 = timeit("std = np.std(a, axis=1, mean=mean)", globals=g, number=n) +// >>> t2 = timeit("std = np.std(a, axis=1)", globals=g, number=n) +// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') +// #doctest: +SKIP +// Percentage execution time saved 30% // -//go:linkname Greater py.greater -func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Compute bit-wise inversion, or bit-wise NOT, element-wise. // -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// Base-2 logarithm of `x`. // // Parameters // ---------- // x : array_like -// Only integer and boolean types are handled. +// Input values. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -15205,97 +14697,54 @@ func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// Result. +// y : ndarray +// Base-2 logarithm of `x`. // This is a scalar if `x` is a scalar. // // See Also // -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. +// log, log10, log1p, emath.log2 // // Notes // ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. // -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. // -// Returns the element-wise remainder of division. +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. // -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-inf, 0., 1., 4.]) // -// .. warning:: +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) // -// This should not be confused with: +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. +// Return the base 10 logarithm of the input array, element-wise. // // Parameters // ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// x : array_like +// Input values. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -15315,1771 +14764,1689 @@ func Invert(x *py.Object, out *py.Object) *py.Object // Returns // ------- // y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. // // See Also // -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor +// emath.log10 // // Notes // ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. // -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. // -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. // -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm // -// Returns the quotient and remainder of polynomial division. +// Examples +// -------- +// >>> import numpy as np +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object // -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. +// Pad an array. // // Parameters // ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Return a sorted copy of an array. +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. // -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. // -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. // -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. // -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. // -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. // -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. // -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. // -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. // -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. // -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. // -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. // -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. // -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. // -// .. versionadded:: 1.12.0 +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. // -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. // -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. +// Notes +// ----- +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. // -// .. versionadded:: 1.17.0 +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: // -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) // -// .. versionchanged:: 1.18.0 +// where // -// NaT now sorts to the end of arrays for consistency with NaN. +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. // // Examples // -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) +// >>> import numpy as np +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) // -// Use the `order` keyword to specify a field to use when sorting a -// structured array: +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) // -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) // -// Sort by age, then height if ages are equal: +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) // -// >>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) // +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) // +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) // -//go:linkname Sort py.sort -func Sort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) // -// Compute the truth value of x1 XOR x2, element-wise. +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) // -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) // -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) // -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) // -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) // -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) // -// Simple example showing support of broadcasting +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object // -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) +// Return the Hanning window. // -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// The Hanning window is a taper formed by using a weighted cosine. // -// Divide arguments element-wise. +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. // -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). // -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. +// See Also +// -------- +// bartlett, blackman, hamming, kaiser // -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. +// Notes +// ----- +// The Hanning window is defined as // -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 // -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. // -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) // -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. +// Plot the window and its frequency response. // -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) +// .. plot:: +// :include-source: // -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.hanning(51) +// plt.plot(window) +// plt.title("Hann window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() // -// Set printing options. +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// with np.errstate(divide='ignore', invalid='ignore'): +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of the Hann window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() // -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. // // Parameters // ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: // -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' // -// Other keys that can be used to set a group of types at once are: +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: // -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' // -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. // -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. // -// If set to `False`, disables legacy mode. +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. // -// Unrecognized strings will be ignored with a warning for forward -// compatibility. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the quantile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. // -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 +// .. versionadded:: 2.0.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. // // See Also // -------- -// get_printoptions, printoptions, set_string_function, array2string +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. // // Notes // ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. +// The behavior of `numpy.nanquantile` is the same as that of +// `numpy.quantile` (ignoring nan values). +// For more information, please see `numpy.quantile`. // // Examples // -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) +// >>> import numpy as np +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// np.float64(nan) +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) // -// To put back the default options, you can use: +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 // -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) // -// Also to temporarily override options, use `printoptions` as a context manager: // -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object // +// Return the binary representation of the input number as a string. // +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. // -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. // // Parameters // ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in +// the designated form. If the `width` value is insufficient, an error is +// raised. // // Returns // ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// bin : str +// Binary representation of `num` or two's complement of `num`. // // See Also // -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. // +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. // -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement // -// Compute the weighted average along the specified axis. +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' // -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. +// The two's complement is returned when the input number is negative and +// width is specified: // -// .. versionadded:: 1.7.0 +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' // -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: // -// avg = sum(a * weights) / sum(weights) // -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// .. versionadded:: 1.23.0 +// Returns an element-wise indication of the sign of a number. // -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. // -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. +// For complex inputs, the `sign` function returns ``x / abs(x)``, the +// generalization of the above (and ``0 if x==0``). // -// See Also -// -------- -// mean +// .. versionchanged:: 2.0.0 +// Definition of complex sign changed to follow the Array API standard. // -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. // -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here, :math:`x/|x|`, is the more common +// and useful one, but is different from the one used in numpy prior to +// version 2.0, :math:`x/\sqrt{x*x}`, which is equivalent to +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. // -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 +// Examples +// -------- +// >>> import numpy as np +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign([3-4j, 8j]) +// array([0.6-0.8j, 0. +1.j ]) // -// With ``keepdims=True``, the following result has shape (3, 1). +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) +// Inverse hyperbolic tangent element-wise. // +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. // -// Create a two-dimensional array with the flattened input as a diagonal. +// See Also +// -------- +// emath.arctanh // -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. // -// Returns -// ------- -// out : ndarray -// The 2-D output array. +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. // -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. // -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh // +// Examples +// -------- +// >>> import numpy as np +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) // +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// Compute the bit-wise OR of two arrays element-wise. // -// Interpret a buffer as a 1-dimensional array. +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. // -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// .. versionadded:: 1.20.0 +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. // -// Returns -// ------- -// out : ndarray +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. // -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. +// Examples +// -------- +// >>> import numpy as np // -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: // -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' // -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) // -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647], dtype=int32) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) // -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. // -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) // -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Return the maximum of an array or maximum along an axis. +// Calculate ``exp(x) - 1`` for all elements in the array. // -// `amax` is an alias of `~numpy.max`. +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. // +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. // -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// Remove axes of length one from `a`. +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. // -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 +// Examples +// -------- // -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. // -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. +// >>> import numpy as np +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 // -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// from_dlpack(x, /, *, device=None, copy=None) // -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a view of the input +// object. See [1]_ and [2]_ for more details. // -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// device : device, optional +// Device on which to place the created array. Default: ``None``. +// Must be ``"cpu"`` if passed which may allow importing an array +// that is not already CPU available. +// copy : bool, optional +// Boolean indicating whether or not to copy the input. If ``True``, +// the copy will be made. If ``False``, the function will never copy, +// and will raise ``BufferError`` in case a copy is deemed necessary. +// Passing it requests a copy from the exporter who may or may not +// implement the capability. +// If ``None``, the function will reuse the existing memory buffer if +// possible and copy otherwise. Default: ``None``. // // +// Returns +// ------- +// out : ndarray // -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack // -// Compute the variance along the specified axis. +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html // -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. +// Examples +// -------- +// >>> import torch # doctest: +SKIP +// >>> x = torch.arange(10) # doctest: +SKIP +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) # doctest: +SKIP // -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object // -// .. versionadded:: 1.7.0 +// Set how floating-point errors are handled. // -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. // -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: // -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. +// - ignore: Take no action when the exception occurs. +// - warn: Print a :exc:`RuntimeWarning` (via the Python `warnings` +// module). +// - raise: Raise a :exc:`FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. // -// .. versionadded:: 1.20.0 +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. // // Returns // ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. +// old_settings : dict +// Dictionary containing the old settings. // -// See Also +// See also // -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate // // Notes // ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: // -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. // -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 // // Examples // -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) +// >>> import numpy as np +// >>> orig_settings = np.seterr(all='ignore') # seterr to known value +// >>> np.int16(32000) * np.int16(3) +// np.int16(30464) +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply // -// In single precision, var() can be inaccurate: +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// np.int16(30464) +// >>> np.seterr(**orig_settings) # restore original +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} // -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 // -// Computing the variance in float64 is more accurate: // -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Specifying a where argument: +// Hyperbolic sine, element-wise. // -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. // +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. // -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) // -// Modified Bessel function of the first kind, order 0. +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. // -// Usually denoted :math:`I_0`. +// Examples +// -------- +// >>> import numpy as np +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. // -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True // -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object // -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. +// Generate a Vandermonde matrix. // -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. // -// References +// Parameters // ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. // +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. // +// See Also +// -------- +// polynomial.polynomial.polyvander // -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) // -// In case of ties, leftmost wins. If no wrapper is found, return None +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) // +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) // -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: // -// Load ASCII data from a file and return it in a record array. +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 // -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. // -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. // -// See Also -// -------- -// numpy.genfromtxt : generic function +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. +// Add arguments element-wise. // +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. // -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. // -// Return the binary representation of the input number as a string. +// Examples +// -------- +// >>> import numpy as np +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) // -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. // -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) // -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. +//go:linkname Add py.add +func Add(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. +// Inverse sine, element-wise. // -// .. deprecated:: 1.12.0 +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. // -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin // -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. // -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. // -// The two's complement is returned when the input number is negative and -// width is specified: +// The inverse sine is also known as `asin` or sin^{-1}. // -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm // +// Examples +// -------- +// >>> import numpy as np +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 // +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object // -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// Find the set difference of two arrays. // -// Return a string representation of an array. +// Return the unique values in `ar1` that are not in `ar2`. // // Parameters // ---------- -// a : ndarray +// ar1 : array_like // Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. // -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. // -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) // -// Other keys that can be used to set a group of types at once are: // -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: // -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. // -// .. versionadded:: 1.14.0 +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. // // Returns // ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. // // See Also // -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. +// triu : same thing, only for the upper triangle // // Examples // -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' +// >>> import numpy as np +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) // +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) // // -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object // -// Compute the median along the specified axis. +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object // -// Returns the median of the array elements. +// Return a description for the given data type code. // // Parameters // ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 +// char : str +// Data type code. // // Returns // ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. +// out : str +// Description of the input data type code. // // See Also // -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. +// dtype // // Examples // -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// +// >>> import numpy as np +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer // // -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object // -// Find the unique elements of an array. +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object // -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: +// Compute the arithmetic mean along the specified axis. // -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. // // Parameters // ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// See :ref:`ufuncs-output-type` for more details. // -// .. versionadded:: 1.13.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. // -// .. versionadded:: 1.24 +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. // // See Also // -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. +// average : Weighted average +// std, var, nanmean, nanstd, nanvar // // Notes // ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. // -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. // -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. // // Examples // -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) // -// Return the unique rows of a 2D array +// In single precision, `mean` can be inaccurate: // -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// np.float32(0.54999924) // -// Return the indices of the original array that give the unique values: +// Computing the mean in float64 is more accurate: // -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary // -// Reconstruct the input array from the unique values and inverse: +// Computing the mean in timedelta64 is available: // -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) +// >>> b = np.array([1, 3], dtype="timedelta64[D]") +// >>> np.mean(b) +// np.timedelta64(2,'D') // -// Reconstruct the input values from the unique values and counts: +// Specifying a where argument: // -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 // // // -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Mean py.mean +func Mean(__llgo_va_list ...interface{}) *py.Object // -// Compute the bit-wise XOR of two arrays element-wise. +// Return the normalized sinc function. // -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. // -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// .. note:: // -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. // -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. // -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. // -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". // -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. // -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. // -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. https://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function // -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) +// Examples +// -------- +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) // -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() // -// Change the sign of x1 to that of x2, element-wise. // -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. // -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). // -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. +// Examples +// -------- +// >>> import numpy as np // -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf +// Create a 4 by 4 array // -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) // -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Pass the array to get the indices of the lower triangular elements. // -// Return (x1 == x2) element-wise. +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) // -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) // -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. +// This is syntactic sugar for tril_indices(). // -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) // -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. // -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) // -// >>> np.equal(1, np.ones(1)) -// array([ True]) +// See Also +// -------- +// tril_indices, tril, triu_indices_from // -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. // -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object // -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// geterrobj() +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. // -// Return the current object that defines floating-point error handling. +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. // -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. // // Returns // ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. // // See Also // -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. // // Notes // ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. +// The returned indices are not guaranteed to be sorted according to +// the values. Furthermore, the default selection algorithm ``introselect`` +// is unstable, and hence the returned indices are not guaranteed +// to be the earliest/latest occurrence of the element. +// +// `argpartition` works for real/complex inputs with nan values, +// see `partition` for notes on the enhanced sort order and +// different selection algorithms. // // Examples // -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] +// One dimensional array: // -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] +// >>> import numpy as np +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) # may vary +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) # may vary +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) # may vary // -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> # below is the same as np.partition(x, kth=1) +// >>> np.take_along_axis(x, index_array, axis=-1) +// array([[2, 3, 4], +// [1, 1, 3]]) // -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Compute the truth value of x1 AND x2 element-wise. +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Divide arguments element-wise. // // Parameters // ---------- -// x1, x2 : array_like -// Input arrays. +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -17100,46 +16467,56 @@ func Geterrobj() *py.Object // // Returns // ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. // This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// logical_or, logical_not, logical_xor -// bitwise_and +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. // -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. // -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. // +// Examples +// -------- +// >>> import numpy as np +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) // -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. // -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) // -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Returns element-wise True where signbit is set (less than zero). +// Return the truth value of (x1 >= x2) element-wise. // // Parameters // ---------- -// x : array_like -// The input value(s). +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -17158,641 +16535,463 @@ func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. +// out : bool or ndarray of bool +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, less_equal, equal, not_equal // // Examples // -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) +// >>> import numpy as np +// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) +// array([ True, True, False]) // -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object +// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` +// on ndarrays. // -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a >= b +// array([ True, True, False]) // -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. +// may_share_memory(a, b, /, max_work=None) // -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. // // Returns // ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. +// out : bool // // See Also // -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. +// shares_memory // // Examples // -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// >>> import numpy as np +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True // // // -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object // -// Compute the variance along the specified axis, while ignoring NaNs. +// Take elements from an array along an axis. // -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. // -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: // -// .. versionadded:: 1.8.0 +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] // // Parameters // ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. // -// .. versionadded:: 1.22.0 +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. // // Returns // ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. // // See Also // -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays // // Notes // ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: // -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] // -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) // // Examples // -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 +// >>> import numpy as np +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) // +// In this example if `a` is an ndarray, "fancy" indexing can be used. // -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) // -// Round to nearest integer towards zero. +// If `indices` is not one dimensional, the output also has these dimensions. // -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. // // Parameters // ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. // // Returns // ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). // // See Also // -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals +// bartlett, blackman, hamming, hanning // -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) +// Notes +// ----- +// The Kaiser window is defined as // +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) // +// with // -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, // -// Least squares polynomial fit. +// where :math:`I_0` is the modified zeroth-order Bessel function. // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. // -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. +// The Kaiser can approximate many other windows by varying the beta +// parameter. // -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= // -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. // -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. // -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function // -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. +// Examples +// -------- +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) // -// For more details, see `numpy.linalg.lstsq`. // -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` +// Plot the window and the frequency response. // +// .. plot:: +// :include-source: // -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.kaiser(51, 14) +// plt.plot(window) +// plt.title("Kaiser window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() // -// The warnings can be turned off by +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Kaiser window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() // -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) // -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. // -// Notes -// ----- -// The solution minimizes the squared error +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object // -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// Save an array to a text file. // -// in the equations:: +// Parameters +// ---------- +// fname : filename, file handle or pathlib.Path +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: // -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// * a single specifier, ``fmt='%.4e'``, resulting in numbers formatted +// like ``' (%s+%sj)' % (fmt, fmt)`` +// * a full string specifying every real and imaginary part, e.g. +// ``' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'`` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. ``['%.3e + %.3ej', '(%.15e%+.15ej)']`` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// header : str, optional +// String that will be written at the beginning of the file. +// footer : str, optional +// String that will be written at the end of the file. +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. // -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive // -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): // -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. +// flags: +// ``-`` : left justify // -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation +// ``+`` : Forces to precede result with + or -. // -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// ``0`` : Left pad the number with zeros instead of space (see width). // -// It is convenient to use `poly1d` objects for dealing with polynomials: +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. // -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. // -// High-order polynomials may oscillate wildly: +// specifiers: +// ``c`` : character // -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary +// ``d`` or ``i`` : signed decimal integer // -// Illustration: +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. // -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() +// ``f`` : decimal floating point // +// ``g,G`` : use the shorter of ``e,E`` or ``f`` // +// ``o`` : signed octal // -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// ``s`` : string of characters // -// Return the minimum of an array or minimum along an axis. +// ``u`` : unsigned decimal integer // -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. +// ``x,X`` : unsigned hexadecimal integer // -// .. versionadded:: 1.7.0 +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. // -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. +// Examples +// -------- +// >>> import numpy as np +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation // -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. // -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. // -// .. versionadded:: 1.15.0 +//go:linkname Savetxt py.savetxt +func Savetxt(__llgo_va_list ...interface{}) *py.Object // -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. +// Test element-wise for positive infinity, return result as bool array. // -// .. versionadded:: 1.17.0 +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. // // Returns // ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. // // See Also // -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax +// isinf, isneginf, isfinite, isnan // // Notes // ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). // -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values // // Examples // -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat +// >>> import numpy as np +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(-np.inf) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) // -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) // -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) // -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Return the element-wise square of the input. +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns element-wise True where signbit is set (less than zero). // // Parameters // ---------- // x : array_like -// Input data. +// The input value(s). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -17811,28 +17010,23 @@ func Isnan(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. // This is a scalar if `x` is a scalar. // -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// // Examples // -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> import numpy as np +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) // -// Compute tangent element-wise. +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// Inverse hyperbolic tangent element-wise. // // Parameters // ---------- @@ -17856,281 +17050,318 @@ func Square(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// The corresponding tangent values. +// out : ndarray or scalar +// Array of the same shape as `x`. // This is a scalar if `x` is a scalar. // +// See Also +// -------- +// emath.arctanh +// // Notes // ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. // // References // ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh // // Examples // -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object +// >>> import numpy as np +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) // -// Return an ndarray of the provided type that satisfies requirements. +//go:linkname Atanh py.atanh +func Atanh(__llgo_va_list ...interface{}) *py.Object // -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). +// Return the cumulative product of elements along a given axis. // // Parameters // ---------- // a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. // // Returns // ------- -// out : ndarray -// Array with specified requirements and type if given. +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. // // See Also // -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. +// cumulative_prod : Array API compatible alternative for ``cumprod``. +// :ref:`ufuncs-output-type` // // Notes // ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. // // Examples // -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False +// >>> import numpy as np +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) // -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) // +// The cumulative product for each row (i.e. over the columns) of `a`: // +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) // -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object // -// Return the size of the buffer used in ufuncs. +// +//go:linkname Cumprod py.cumprod +func Cumprod(__llgo_va_list ...interface{}) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// This function is an Array API compatible alternative to `numpy.cumprod`. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. The default +// (None) is only allowed for one-dimensional arrays. For arrays +// with more than one dimension ``axis`` is required. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If ``dtype`` is not specified, it +// defaults to the dtype of ``x``, unless ``x`` has an integer dtype +// with a precision less than that of the default platform integer. +// In that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// include_initial : bool, optional +// Boolean indicating whether to include the initial value (ones) as +// the first value in the output. With ``include_initial=True`` +// the shape of the output is different than the shape of the input. +// Default: ``False``. // // Returns // ------- -// getbufsize : int -// Size of ufunc buffer in bytes. +// cumulative_prod_along_axis : ndarray +// A new array holding the result is returned unless ``out`` is +// specified, in which case a reference to ``out`` is returned. The +// result has the same shape as ``x`` if ``include_initial=False``. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. // +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> np.cumulative_prod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([1, 2, 3, 4, 5, 6]) +// >>> np.cumulative_prod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) // +// The cumulative product for each column (i.e., over the rows) of ``b``: // -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object +// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumulative_prod(b, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of ``b``: +// +// >>> np.cumulative_prod(b, axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) // -// Save an array to a binary file in NumPy ``.npy`` format. +// +// +//go:linkname CumulativeProd py.cumulative_prod +func CumulativeProd(x *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. // // Parameters // ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. // // See Also // -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load +// indices, meshgrid // // Notes // ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. +// Keywords other than `dtype` and `like` are passed to `function`. // // Examples // -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> import numpy as np +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) // +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) // -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) // +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) // -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object // -// Compute the arithmetic mean along the specified axis, ignoring NaNs. // -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object // -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// is_busday( +// dates, +// weekmask='1111100', +// holidays=None, +// busdaycal=None, +// out=None +// ) // -// .. versionadded:: 1.8.0 +// Calculates which of the given dates are valid days, and which are not. // // Parameters // ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. // // Returns // ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. // // See Also // -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. // // Examples // -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// +// >>> import numpy as np +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) // // -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Return the ceiling of the input, element-wise. +// Natural logarithm, element-wise. // -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. // // Parameters // ---------- // x : array_like -// Input data. +// Input value. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -18149,30 +17380,125 @@ func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ke // // Returns // ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. +// y : ndarray +// The natural logarithm of `x`, element-wise. // This is a scalar if `x` is a scalar. // // See Also // -------- -// floor, trunc, rint, fix +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm // // Examples // -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) +// >>> import numpy as np +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -inf]) // -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object // -// Calculate `2**p` for all `p` in the input array. +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. // // Parameters // ---------- -// x : array_like +// x1 : array_like of integer type // Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -18191,1141 +17517,1284 @@ func Ceil(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// power +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. // -// Notes -// ----- -// .. versionadded:: 1.3.0 +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' // +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) // +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): // -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) +// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 // -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. // -// Return the imaginary part of the complex argument. +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Transposes a matrix (or a stack of matrices) ``x``. +// +// This function is Array API compatible. // // Parameters // ---------- -// val : array_like -// Input array. +// x : array_like +// Input array having shape (..., M, N) and whose two innermost +// dimensions form ``MxN`` matrices. // // Returns // ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. +// out : ndarray +// An array containing the transpose for each matrix and having shape +// (..., N, M). // // See Also // -------- -// real, angle, real_if_close +// transpose : Generic transpose method. // // Examples // -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 +// >>> import numpy as np +// >>> np.matrix_transpose([[1, 2], [3, 4]]) +// array([[1, 3], +// [2, 4]]) +// +// >>> np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) +// array([[[1, 3], +// [2, 4]], +// [[5, 7], +// [6, 8]]]) // // // -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object +//go:linkname MatrixTranspose py.matrix_transpose +func MatrixTranspose(__llgo_va_list ...interface{}) *py.Object +//go:linkname Asin py.asin +func Asin(__llgo_va_list ...interface{}) *py.Object // -// Return the angle of the complex argument. +// View inputs as arrays with at least two dimensions. // // Parameters // ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. // // Returns // ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. +// res, res2, ... : ndarray +// An array, or tuple of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. // // See Also // -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. +// atleast_1d, atleast_3d // // Examples // -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 +// >>> import numpy as np +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True // +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// (array([[1]]), array([[1, 2]]), array([[1, 2]])) // // -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object // -// Change elements of an array based on conditional and input values. +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object // -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. +// Counts the number of non-zero values in the array ``a``. // -// Note that `extract` does the exact opposite of `place`. +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. // // Parameters // ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. // // See Also // -------- -// copyto, put, take, extract +// nonzero : Return the coordinates of all the non-zero values. // // Examples // -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) +// >>> import numpy as np +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// // +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // +// Calculate the exponential of all elements in the input array. // -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import numpy as np +// +// >>> import matplotlib.pyplot as plt +// >>> import numpy as np +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') // -// Compute the median along the specified axis, while ignoring NaNs. +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() // -// Returns the median of the array elements. +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. // -// .. versionadded:: 1.9.0 +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. // // Parameters // ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: // -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// .. versionadded:: 1.21.0 // // Returns // ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. +// rep : string +// The string representation of the floating point value // // See Also // -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. +// format_float_scientific // // Examples // -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) +// >>> import numpy as np +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' // // +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object // -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, // -// Return the cumulative product over the given axis. +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). // -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. // -// See Also -// -------- -// cumprod : equivalent function; see for details. +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. // +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. // -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: // -// Compute the arithmetic mean along the specified axis. +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) // -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. +// It uses an optimized BLAS library when possible (see `numpy.linalg`). // // Parameters // ---------- // a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. +// First argument. +// b : array_like +// Second argument. // out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. // // Returns // ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. // // See Also // -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. +// vdot : Complex-conjugating dot product. +// vecdot : Vector dot product of two arrays. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. // // Examples // -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: +// >>> import numpy as np +// >>> np.dot(3, 4) +// 12 // -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 +// Neither argument is complex-conjugated: // -// Computing the mean in float64 is more accurate: +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) // -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary +// For 2-D arrays it is the matrix product: // -// Specifying a where argument: +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) // -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 // // // -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. // // Parameters // ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // // Returns // ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. // // See Also // -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. // -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. // -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. // -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: +// The inverse tangent is also known as `atan` or tan^{-1}. // -// [0 0 0 0 divide over under invalid] +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm // -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// Examples +// -------- // -// If an object is provided, its write method should take one argument, -// a string. +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: // -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. +// >>> import numpy as np +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) // -// See Also -// -------- -// seterr, geterr, geterrcall +// >>> np.pi/4 +// 0.78539816339744828 // -// Examples -// -------- -// Callback upon error: +// Plot arctan: // -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() // -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) +// Inverse hyperbolic sine element-wise. // -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Log error message: +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. // -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. // -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. // -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) +// For complex-valued input, `arcsinh` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. // -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. // +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh // +// Examples +// -------- +// >>> import numpy as np +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) // -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object // -// Compute the q-th quantile of the data along the specified axis. +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. // -// .. versionadded:: 1.15.0 // // Parameters // ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. // +// .. versionadded:: 1.22.0 // keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. // -// .. deprecated:: 1.22.0 +// .. versionadded:: 1.22.0 // // Returns // ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. +// index_array : ndarray +// An array of indices or a single index value. // // See Also // -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile +// argmax, nanargmin // -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) // -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha // -// The different methods then work as follows // -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: +//go:linkname Nanargmax py.nanargmax +func Nanargmax(__llgo_va_list ...interface{}) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. // -// * if g > 0 ; then take j -// * if g = 0 ; then take i +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. // -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. // -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. // -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: // -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M // -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] // -// * alpha = 0 -// * beta = 1 +// Equivalently, eliminating the inner loop, the last two lines would be:: // -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: +// a_1d[indices_1d] = values_1d // -// * alpha = 1/2 -// * beta = 1/2 +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices // -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: +// Examples +// -------- +// >>> import numpy as np // -// * alpha = 0 -// * beta = 0 +// For this sample array // -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) // -// * alpha = 1 -// * beta = 1 +// We can replace the maximum values with: // -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) // -// * alpha = 1/3 -// * beta = 1/3 // -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: // -// * alpha = 3/8 -// * beta = 3/8 +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object // -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. +// Return True if x is a not complex type or an array of complex numbers. // -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. // -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. // -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. // -// Examples +// See Also // -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) +// iscomplexobj, isreal // -// See also `numpy.percentile` for a visualization of most methods. +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. // -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False // // // -//go:linkname Quantile py.quantile -func Quantile(__llgo_va_list ...interface{}) *py.Object +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object // -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. +// Test element-wise for negative infinity, return result as bool array. // // Parameters // ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. // -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. // -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. // -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// See Also +// -------- +// isinf, isposinf, isnan, isfinite // -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). // -// .. versionadded:: 1.22.0 +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isneginf(-np.inf) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. // // Returns // ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. // // See Also // -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. // -// amin, fmin, minimum +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) // -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. +// Use the indices of the non-zero elements as an index array to extract +// these elements: // -// If the input has a integer type the function is equivalent to np.max. +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) // -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) // -// When positive infinity and negative infinity are present: // -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object // +// Return the shape of an array. // +// Parameters +// ---------- +// a : array_like +// Input array. // -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. // -// Return evenly spaced values within a given interval. +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. // -// ``arange`` can be called with a varying number of positional arguments: +// Examples +// -------- +// >>> import numpy as np +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () // -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) // -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. // -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. // -// See the Warning sections below for more information. +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. // // Parameters // ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. // -// .. versionadded:: 1.20.0 +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. // // Returns // ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. // -// Warnings +// See Also // -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). // -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). // -// In such cases, the use of `numpy.linspace` should be preferred. +// flip(m, 1) is equivalent to fliplr(m). // -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. // -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. // -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. // // Examples // -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. +// >>> import numpy as np +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> rng = np.random.default_rng() +// >>> A = rng.normal(size=(3,4,5)) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True // -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. // -// Assuming that `a` is sorted: +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object // -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. // // Parameters // ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. // -// .. versionadded:: 1.7.0 +// .. versionadded:: 1.22.0 // // Returns // ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. // // See Also // -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum // // Notes // ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. // -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. +// If the input has a integer type the function is equivalent to np.max. // // Examples // -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) // +// When positive infinity and negative infinity are present: // +// >>> np.nanmax([1, 2, np.nan, -np.inf]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf // -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object // -// Return the sum along diagonals of the array. // -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. // // Parameters // ---------- // a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. // out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 // // Returns // ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. // // See Also // -------- -// diag, diagonal, diagflat +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). // // Examples // -------- -// >>> np.trace(np.eye(3)) +// >>> import numpy as np +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) // 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, -np.inf]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with np.errstate(invalid="ignore"): +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// np.float64(nan) // -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) // // +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Return the imaginary part of the complex argument. // -// Convert angles from radians to degrees. +// Parameters +// ---------- +// val : array_like +// Input array. // -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. // -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. +// See Also +// -------- +// real, angle, real_if_close // -// See Also -// -------- -// rad2deg : equivalent function +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object // -// Examples -// -------- -// Convert a radian array to degrees +// Get help information for an array, function, class, or module. // -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. // -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. // -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... // -// Calculate ``exp(x) - 1`` for all elements in the array. +// When using a string for `object` it is possible to get multiple results. // -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** // -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. +// When the argument is an array, information about the array is printed. // -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 // // -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. // -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. // -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). // -// Return (x1 != x2) element-wise. +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. // // Parameters // ---------- -// x1, x2 : array_like -// Input arrays. +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -19346,278 +18815,328 @@ func Expm1(x *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. // This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// equal, greater, greater_equal, less, less_equal +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." // // Examples // -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) // -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. +// Consider four points in different quadrants: // -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) +// >>> import numpy as np +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) // -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: // -// Set how floating-point errors are handled. +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) // -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: +// Cross-correlation of two 1-dimensional sequences. // -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. +// This function computes the correlation as generally defined in signal +// processing texts [1]_: // -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline v` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. // // Returns // ------- -// old_settings : dict -// Dictionary containing the old settings. +// out : ndarray +// Discrete cross-correlation of `a` and `v`. // -// See also +// See Also // -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// scipy.signal.correlate : uses FFT which has superior performance +// on large arrays. // // Notes // ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// The definition of correlation above is not unique and sometimes +// correlation may be defined differently. Another common definition is [1]_: // -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} // -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) +// because it does not use the FFT to compute the convolution; in that case, +// `scipy.signal.correlate` might be preferable. +// +// References +// ---------- +// .. [1] Wikipedia, "Cross-correlation", +// https://en.wikipedia.org/wiki/Cross-correlation // // Examples // -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// >>> import numpy as np +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) // -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: // -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) // // // -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object // -// Stack 1-D arrays as columns into a 2-D array. +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None, *, +// device=None) // -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. +// Return a new array with the same shape and type as a given array. // // Parameters // ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 // // Returns // ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. // // See Also // -------- -// stack, hstack, vstack, concatenate +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// Unlike other array creation functions (e.g. `zeros_like`, `ones_like`, +// `full_like`), `empty_like` does not initialize the values of the array, +// and may therefore be marginally faster. However, the values stored in the +// newly allocated array are arbitrary. For reproducible behavior, be sure +// to set each element of the array before reading. // // Examples // -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) +// >>> import numpy as np +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) // // // -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object // -// True if two arrays have the same shape and elements, False otherwise. +// Return the product of array elements over a given axis. // // Parameters // ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. // -// .. versionadded:: 1.19.0 +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. // // Returns // ------- -// b : bool -// Returns True if the arrays are equal. +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. // // See Also // -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` // -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: // -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary // -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True +// The product of an empty array is the neutral element 1: // +// >>> np.prod([]) +// 1.0 // -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// Examples +// -------- +// By default, calculate the product of all elements: // -// Returns an array with axes transposed. +// >>> import numpy as np +// >>> np.prod([1.,2.]) +// 2.0 // -// For a 1-D array, this returns an unchanged view of the original array, as a -// transposed vector is simply the same vector. -// To convert a 1-D array into a 2-D column vector, an additional dimension -// must be added, e.g., ``np.atleast2d(a).T`` achieves this, as does -// ``a[:, np.newaxis]``. -// For a 2-D array, this is the standard matrix transpose. -// For an n-D array, if axes are given, their order indicates how the -// axes are permuted (see Examples). If axes are not provided, then -// ``transpose(a).shape == a.shape[::-1]``. +// Even when the input array is two-dimensional: // -// Parameters -// ---------- -// a : array_like -// Input array. -// axes : tuple or list of ints, optional -// If specified, it must be a tuple or list which contains a permutation -// of [0,1,...,N-1] where N is the number of axes of `a`. The `i`'th axis -// of the returned array will correspond to the axis numbered ``axes[i]`` -// of the input. If not specified, defaults to ``range(a.ndim)[::-1]``, -// which reverses the order of the axes. +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 // -// Returns -// ------- -// p : ndarray -// `a` with its axes permuted. A view is returned whenever possible. +// But we can also specify the axis over which to multiply: // -// See Also -// -------- -// ndarray.transpose : Equivalent method. -// moveaxis : Move axes of an array to new positions. -// argsort : Return the indices that would sort an array. +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) // -// Notes -// ----- -// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors -// when using the `axes` keyword argument. +// Or select specific elements to include: // -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 // -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: // -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True // -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) +// If `x` is of a signed integer type, then the output type +// is the default platform integer: // +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True // +// You can also start the product with a value other than one: // -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> np.prod([1, 2], initial=5) +// 10 // -// Test element-wise for NaT (not a time) and return result as a boolean array. // -// .. versionadded:: 1.13.0 +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the cube-root of an array, element-wise. // // Parameters // ---------- // x : array_like -// Input array with datetime or timedelta data type. +// The values whose cube-roots are required. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -19636,58 +19155,189 @@ func Transpose(a *py.Object, axes *py.Object) *py.Object // // Returns // ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. +// y : ndarray +// An array of the same shape as `x`, containing the +// cube root of each element in `x`. +// If `out` was provided, `y` is a reference to it. // This is a scalar if `x` is a scalar. // -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite // // Examples // -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) +// >>> import numpy as np +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) // -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object // -// Returns a bool array, where True if input element is complex. +// concatenate( +// (a1, a2, ...), +// axis=0, +// out=None, +// dtype=None, +// casting="same_kind" +// ) // -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. +// Join a sequence of arrays along an existing axis. // // Parameters // ---------- -// x : array_like -// Input array. +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// For a description of the options, please see :term:`casting`. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// out : ndarray of bools -// Output array. +// res : ndarray +// The concatenated array. // // See Also // -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. // // Examples // -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) // // // -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object +//go:linkname Concat py.concat +func Concat(__llgo_va_list ...interface{}) *py.Object // -// Find the product of two polynomials. +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. // // .. note:: // This forms part of the old polynomial API. Since version 1.4, the @@ -19695,1216 +19345,1281 @@ func Iscomplex(x *py.Object) *py.Object // A summary of the differences can be found in the // :doc:`transition guide `. // -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. +// If `p` is of length N, this function returns the value:: +// +// p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1] +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. // // Parameters // ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using +// the normal rules. Instead, leading axes of size 1 are inserted, +// to make ``block.ndim`` the same for all blocks. This is primarily useful +// for working with scalars, and means that code like ``np.block([v, 1])`` +// is valid, where ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. // // Returns // ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. +// block_array : ndarray +// The array assembled from the given blocks. // -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. +// The dimensionality of the output is equal to the greatest of: // -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) +// * the dimensionality of all the inputs +// * the depth to which the input list is nested // -// Using poly1d objects: +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` // -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. // +// Notes +// ----- +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. // +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: // -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// AAAbb +// AAAbb +// cccDD // -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD // -// This function may also be used as a decorator. +// Since concatenation happens along the last axis first, `block` is *not* +// capable of producing the following directly:: // -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. +// AAAbb +// cccbb +// cccDD // -// Returns -// ------- -// old_func : function -// The deprecated function. +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. // // Examples // -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: +// The most common use of this function is to build a block matrix: // -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 +// >>> import numpy as np +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) // +// With a list of depth 1, `block` can be used as `hstack`: // +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) // -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) // -// result_type(*arrays_and_dtypes) +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) // -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. +// With a list of depth 2, `block` can be used in place of `vstack`: // -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) // -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) // -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. +// It can also be used in place of `atleast_1d` and `atleast_2d`: // -// Returns -// ------- -// out : dtype -// The result type. +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) // -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) // -// Notes -// ----- -// .. versionadded:: 1.6.0 // -// The specific algorithm used is as follows. // -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. // -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object // -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. +// Return the identity array. // -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// The identity array is a square array with ones on +// the main diagonal. // -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// >>> np.result_type('i4', 'c8') -// dtype('complex128') +// .. versionadded:: 1.20.0 // -// >>> np.result_type(3.0, -2) -// dtype('float64') +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. // +// Examples +// -------- +// >>> import numpy as np +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) // // -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object // -// Test whether any array element along a given axis evaluates to True. +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Returns single boolean if `axis` is ``None`` +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` // -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. // -// .. versionadded:: 1.7.0 +// See Also +// -------- +// gcd : The greatest common divisor // -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. +// Examples +// -------- +// >>> import numpy as np +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. +// Estimate a covariance matrix, given data and weights. // -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. // -// .. versionadded:: 1.20.0 +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 // // Returns // ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. +// out : ndarray +// The covariance matrix of the variables. // // See Also // -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. +// corrcoef : Normalized covariance matrix // // Notes // ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: // -// >>> np.any([-1, 0, 5]) -// True +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) // -// >>> np.any(np.nan) -// True +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. // -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False +// Examples +// -------- +// >>> import numpy as np // -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: // +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) // +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: // -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) // -// Return the complex conjugate, element-wise. +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. // -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. +// Further, note how `x` and `y` are combined: // -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) // -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. // -// Notes -// ----- -// `conj` is an alias for `conjugate`: // -// >>> np.conj is np.conjugate -// True +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object // -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) +// Check whether or not an object can be iterated over. // -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) +// Parameters +// ---------- +// y : object +// Input object. // -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. // -// Return the floor of the input, element-wise. // -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// Examples +// -------- +// >>> import numpy as np +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False // -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: // -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False // -// See Also -// -------- -// ceil, trunc, rint, fix // -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. // -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object // -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) +// Find the coefficients of a polynomial with the given sequence of roots. // -// Set the object that defines floating-point error handling. +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. // -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. // // Parameters // ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: // -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. // -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). // // See Also // -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. // // Notes // ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. // // Examples // -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True // -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object +// Given a sequence of a polynomial's zeros: // -// Return a scalar type which is common to the input arrays. +// >>> import numpy as np // -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) // -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. +// The line above represents z**3 + 0*z**2 + 0*z + 0. // -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) // -// Returns -// ------- -// out : data type code -// Data type code. +// The line above represents z**3 - z/4 // -// See Also -// -------- -// dtype, mintypecode +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random // -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// +// Given a square array object: // +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) // +// Note how in all cases the leading coefficient is always 1. // -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object // -// Integrate along the given axis using the composite trapezoidal rule. // -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. +//go:linkname Poly py.poly +func Poly(__llgo_va_list ...interface{}) *py.Object // -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// View inputs as arrays with at least three dimensions. // // Parameters // ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. // // Returns // ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. +// res1, res2, ... : ndarray +// An array, or tuple of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. // // See Also // -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// atleast_1d, atleast_2d // // Examples // -------- -// Use the trapezoidal rule on evenly spaced points: +// >>> import numpy as np +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) // -// >>> np.trapz([1, 2, 3]) -// 4.0 +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) // -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True // -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) // -// Using a decreasing ``x`` corresponds to integrating in reverse: // -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 // -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object // -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 +// Construct an array from an index array and a list of arrays to choose from. // -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description:: // -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 +// np.choose(a,c) == np.array([c[a[I]][I] for I in np.ndindex(a.shape)]) // -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: +// But this omits some subtleties. Here is a fully general summary: // -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: // +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; // -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; // -// Compute the bi-dimensional histogram of two data samples. +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. // // Parameters // ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: // -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 // -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. +// Returns +// ------- +// merged_array : array +// The merged result. // -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. // // See Also // -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array // // Notes // ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. // // Examples // -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// // -// :func:`pcolormesh ` can display actual edges: +// >>> import numpy as np +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 // -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// +// A couple examples illustrating how choose broadcasts: // -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) // -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) // -// It is also possible to construct a 2-D histogram without specifying bin -// edges: // -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) // -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() +// Returns the element-wise remainder of division. // -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. // -// >>> plt.show() +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. // -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide // -// Return True if x is a not complex type or an array of complex numbers. +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. // -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. +// Examples +// -------- +// >>> import numpy as np +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) // -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) // -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// See Also -// -------- -// iscomplexobj, isreal +// Return the truth value of (x1 < x2) element-wise. // -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. // -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) // +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. // +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) // -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// Evaluate a piecewise-defined function. +// Return an ndarray of the provided type that satisfies requirements. // -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). // // Parameters // ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following // -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. +// .. versionadded:: 1.20.0 // // Returns // ------- // out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// +// Array with specified requirements and type if given. // // See Also // -------- -// choose, select, where +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. // // Notes // ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. // // Examples // -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. +// >>> import numpy as np +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False // +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False // -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object // -// Extract a diagonal or construct a diagonal array. // -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. +// Return the non-negative square-root of an array, element-wise. // -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. // -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. // -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. // -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) +// Examples +// -------- +// >>> import numpy as np +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) // +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) // +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) // -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object // -// Return the indices for the lower-triangle of an (n, m) array. +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. // // Parameters // ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. // // Returns // ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. // -// See also +// See Also // -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. // // Notes // ----- -// .. versionadded:: 1.4.0 +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. // // Examples // -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 +// >>> import numpy as np +// >>> a = np.arange(24).reshape(2,3,4) // >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) // -// These cover almost the whole array (two diagonals right of the main one): +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: // -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) // +// Tuple axis arguments to ufuncs are equivalent: // +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) // -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object // -// Find the sum of two polynomials. // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) // -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. +// Return a contiguous array (ndim >= 1) in memory (C order). // // Parameters // ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. // // See Also // -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. // // Examples // -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) +// Starting with a Fortran-contiguous array: // -// Using poly1d objects: +// >>> import numpy as np +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True // -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 +// Calling ``ascontiguousarray`` makes a C-contiguous copy: // +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False // +// Now, starting with a C-contiguous array: // -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True // -// Protected string evaluation. +// Then, calling ``ascontiguousarray`` returns the same object: // -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True // -// .. warning:: +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. // -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Parameters -// ---------- -// source : str -// The string to evaluate. +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` // -// Returns -// ------- -// obj : object -// The result of evaluating `source`. +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. // -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} +// See Also +// -------- +// lcm : The lowest common multiple // -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax +// Examples +// -------- +// >>> import numpy as np +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) // -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // +// lexsort(keys, axis=-1) // +// Perform an indirect stable sort using a sequence of keys. // -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object +// Given multiple sorting keys, lexsort returns an array of integer indices +// that describes the sort order by multiple keys. The last key in the +// sequence is used for the primary sort order, ties are broken by the +// second-to-last key, and so on. // -// Save several arrays into a single file in compressed ``.npz`` format. +// Parameters +// ---------- +// keys : (k, m, n, ...) array-like +// The `k` keys to be sorted. The *last* key (e.g, the last +// row if `keys` is a 2D array) is the primary sort key. +// Each element of `keys` along the zeroth axis must be +// an array-like object of the same shape. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis +// of each sequence. Separate slices along `axis` sorted over +// independently; see last example. // -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// Returns +// ------- +// indices : (m, n, ...) ndarray of ints +// Array of indices that sort the keys along the specified axis. // -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. // -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> import numpy as np +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] // -// Returns -// ------- -// None +// Sort according to two numerical keys, first by elements +// of ``a``, then breaking ties according to elements of ``b``: // -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. +// >>> a = [1, 5, 1, 4, 3, 4, 4] # First sequence +// >>> b = [9, 4, 0, 4, 0, 2, 1] # Second sequence +// >>> ind = np.lexsort((b, a)) # Sort by `a`, then by `b` +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// >>> [(a[i], b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] // -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. +// Compare against `argsort`, which would sort each key independently. // +// >>> np.argsort((b, a), kind='stable') +// array([[2, 4, 6, 5, 1, 3, 0], +// [0, 2, 4, 3, 5, 6, 1]]) // -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. +// To sort lexicographically with `argsort`, we would need to provide a +// structured array. // -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True +// >>> x = np.array([(ai, bi) for ai, bi in zip(a, b)], +// ... dtype = np.dtype([('x', int), ('y', int)])) +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) // +// The zeroth axis of `keys` always corresponds with the sequence of keys, +// so 2D arrays are treated just like other sequences of keys. // +// >>> arr = np.asarray([b, a]) +// >>> ind2 = np.lexsort(arr) +// >>> np.testing.assert_equal(ind2, ind) // -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Accordingly, the `axis` parameter refers to an axis of *each* key, not of +// the `keys` argument itself. For instance, the array ``arr`` is treated as +// a sequence of two 1-D keys, so specifying ``axis=0`` is equivalent to +// using the default axis, ``axis=-1``. // -// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// >>> np.testing.assert_equal(np.lexsort(arr, axis=0), +// ... np.lexsort(arr, axis=-1)) // -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. +// For higher-dimensional arrays, the axis parameter begins to matter. The +// resulting array has the same shape as each key, and the values are what +// we would expect if `lexsort` were performed on corresponding slices +// of the keys independently. For instance, +// +// >>> x = [[1, 2, 3, 4], +// ... [4, 3, 2, 1], +// ... [2, 1, 4, 3]] +// >>> y = [[2, 2, 1, 1], +// ... [1, 2, 1, 2], +// ... [1, 1, 2, 1]] +// >>> np.lexsort((x, y), axis=1) +// array([[2, 3, 0, 1], +// [2, 0, 3, 1], +// [1, 0, 3, 2]]) +// +// Each row of the result is what we would expect if we were to perform +// `lexsort` on the corresponding row of the keys: +// +// >>> for i in range(3): +// ... print(np.lexsort((x[i], y[i]))) +// [2 3 0 1] +// [2 0 3 1] +// [1 0 3 2] // -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of x1 OR x2 element-wise. // // Parameters // ---------- -// x : array_like -// Only integer and boolean types are handled. +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -20923,766 +20638,594 @@ func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object // // Returns // ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement +// logical_and, logical_not, logical_xor +// bitwise_or // // Examples // -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// >>> import numpy as np +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) // -// Return the product of array elements over a given axis. +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) // -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. // -// See Also -// -------- -// prod : equivalent function; see for details. +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) // +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// promote_types(type1, type2) +// Return numbers spaced evenly on a log scale. // -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). // -// This function is symmetric, but rarely associative. +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported // // Parameters // ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. // // Returns // ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. +// samples : ndarray +// `num` samples, equally spaced on a log scale. // // See Also // -------- -// result_type, dtype, can_cast +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` // -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code // -// >>> np.promote_types('i8', 'f4') -// dtype('float64') +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP // -// >>> np.promote_types('>i8', '>> import numpy as np +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) // -// >>> np.promote_types('i4', 'S8') -// dtype('S11') +// Graphical illustration: // -// An example of a non-associative case: +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() // -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') // -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object // -// Return the indices of the elements that are non-zero. +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object // -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. +// Return the maximum of an array or maximum along an axis. // -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. If this is a tuple of ints, the maximum is selected over +// multiple axes, instead of a single axis or all the axes as before. // -// .. note:: +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. // -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. // -// .. deprecated:: 1.17.0 +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. // -// Use `atleast_1d` explicitly if this behavior is deliberate. +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. // -// Parameters -// ---------- -// a : array_like -// Input array. +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. // // Returns // ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. // // See Also // -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin // // Notes // ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. // // Examples // -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. +// >>> import numpy as np +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.nan +// >>> np.max(b) +// np.float64(nan) +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 // -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: // -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) // -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. // -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 // -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. // -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// Return the indices to access the main diagonal of an n-dimensional array. // -// >>> import matplotlib.pyplot as plt +// See `diag_indices` for full details. // -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) +// Parameters +// ---------- +// arr : array, at least 2-D // -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') +// See Also +// -------- +// diag_indices // -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() +// Examples +// -------- +// >>> import numpy as np // -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Create a 4 by 4 array. // -// Hyperbolic sine, element-wise. +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) // -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. +// Get the indices of the diagonal elements. // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) // -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. +// >>> a[di] +// array([ 0, 5, 10, 15]) // -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) +// This is simply syntactic sugar for diag_indices. // -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) // -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. // -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True // -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object // -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object +// Replaces specified elements of an array with given values. // -// Convert inputs to arrays with at least one dimension. +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: // -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. +// :: +// +// a.flat[ind] = v // // Parameters // ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. // -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. // // See Also // -------- -// atleast_2d, atleast_3d +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays // // Examples // -------- -// >>> np.atleast_1d(1.0) -// array([1.]) +// >>> import numpy as np +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) // -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) // -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] // // +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Find the unique elements of an array. // -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: // -// View inputs as arrays with at least two dimensions. +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array // // Parameters // ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// sorted : bool, optional +// If True, the unique elements are sorted. Elements may be sorted in +// practice even if ``sorted=False``, but this could change without +// notice. +// +// .. versionadded:: 2.3 // // Returns // ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. // // See Also // -------- -// atleast_1d, atleast_3d +// repeat : Repeat elements of an array. +// sort : Return a sorted copy of an array. // -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. // -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True +// .. versionchanged:: 1.21 +// Like np.sort, NaN will sort to the end of the values. +// For complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. // -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// .. versionchanged:: 2.0 +// For multi-dimensional inputs, ``unique_inverse`` is reshaped +// such that the input can be reconstructed using +// ``np.take(unique, unique_inverse, axis=axis)``. The result is +// now not 1-dimensional when ``axis=None``. // +// Note that in NumPy 2.0.0 a higher dimensional array was returned also +// when ``axis`` was not ``None``. This was reverted, but +// ``inverse.reshape(-1)`` can be used to ensure compatibility with both +// versions. // +// Examples +// -------- +// >>> import numpy as np +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) // -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// Return the unique rows of a 2D array // -// Do a keyword search on docstrings. +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) // -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. +// Return the indices of the original array that give the unique values: // -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) // -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... +// Reconstruct the input values from the unique values and counts: // +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved // // -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object // -// Roll array elements along a given axis. +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object // -// Elements that roll beyond the last position are re-introduced at -// the first. +// Return the angle of the complex argument. // // Parameters // ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). // // Returns // ------- -// res : ndarray -// Output array, with the same shape as `a`. +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. // // See Also // -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. +// arctan2 +// absolute // // Notes // ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. +// This function passes the imaginary and real parts of the argument to +// `arctan2` to compute the result; consequently, it follows the convention +// of `arctan2` when the magnitude of the argument is zero. See example. // // Examples // -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// +// >>> import numpy as np +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// >>> np.angle([0., -0., complex(0., -0.), complex(-0., -0.)]) # convention +// array([ 0. , 3.14159265, -0. , -3.14159265]) // // -//go:linkname Roll py.roll -func Roll(__llgo_va_list ...interface{}) *py.Object // -// shares_memory(a, b, /, max_work=None) +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object // -// Determine if two arrays share memory. +// packbits(a, /, axis=None, bitorder='big') // -// .. warning:: +// Packs the elements of a binary-valued array into bits in a uint8 array. // -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. +// The result is padded to full bytes by inserting zero bits at the end. // // Parameters // ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. // // Returns // ------- -// out : bool +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). // // See Also // -------- -// may_share_memory +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. // // Examples // -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. +// >>> import numpy as np +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) // -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. // -// See Also -// -------- -// any : equivalent function; see for details. // // -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Decompose the elements of x into mantissa and twos exponent. +// Return the complex conjugate, element-wise. // -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. // // Parameters // ---------- // x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. +// Input value. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -21701,47 +21244,43 @@ func Sometrue(__llgo_va_list ...interface{}) *py.Object // // Returns // ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. // This is a scalar if `x` is a scalar. // -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// // Notes // ----- -// Complex dtypes are not supported, they will raise a TypeError. +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True // // Examples // -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// >>> import numpy as np +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) // -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Return the truncated value of the input, element-wise. +// Compute the absolute values element-wise. // -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. // // Parameters // ---------- // x : array_like -// Input data. +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -21761,1518 +21300,1953 @@ func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.O // Returns // ------- // y : ndarray or scalar -// The truncated value of each element in `x`. +// The absolute values of `x`, the returned values are always floats. // This is a scalar if `x` is a scalar. // // See Also // -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 +// absolute : Absolute values including `complex` types. // // Examples // -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) +// >>> import numpy as np +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) // -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object // -// Save an array to a text file. +// Returns an array with axes transposed. +// +// For a 1-D array, this returns an unchanged view of the original array, as a +// transposed vector is simply the same vector. +// To convert a 1-D array into a 2-D column vector, an additional dimension +// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does +// ``a[:, np.newaxis]``. +// For a 2-D array, this is the standard matrix transpose. +// For an n-D array, if axes are given, their order indicates how the +// axes are permuted (see Examples). If axes are not provided, then +// ``transpose(a).shape == a.shape[::-1]``. // // Parameters // ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: +// a : array_like +// Input array. +// axes : tuple or list of ints, optional +// If specified, it must be a tuple or list which contains a permutation +// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative +// indices can also be used to specify axes. The i-th axis of the returned +// array will correspond to the axis numbered ``axes[i]`` of the input. +// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses +// the order of the axes. // -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. +// Returns +// ------- +// p : ndarray +// `a` with its axes permuted. A view is returned whenever possible. // -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. +// See Also +// -------- +// ndarray.transpose : Equivalent method. +// moveaxis : Move axes of an array to new positions. +// argsort : Return the indices that would sort an array. // -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. +// Notes +// ----- +// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors +// when using the `axes` keyword argument. // -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) // -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) +// >>> np.transpose(a, (-1, 0, -2)).shape +// (5, 3, 4) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (deg + 1, deg + 1) or (deg + 1, deg + 1, K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. // -// .. versionadded:: 1.14.0 +// The warnings can be turned off by // +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.exceptions.RankWarning) // // See Also // -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. // // Notes // ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): +// The solution minimizes the squared error // -// flags: -// ``-`` : left justify +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 // -// ``+`` : Forces to precede result with + or -. +// in the equations:: // -// ``0`` : Left pad the number with zeros instead of space (see width). +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] // -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `~exceptions.RankWarning` when the least-squares fit is +// badly conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import numpy as np +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary // -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. +// It is convenient to use `poly1d` objects for dealing with polynomials: // -// specifiers: -// ``c`` : character +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary // -// ``d`` or ``i`` : signed decimal integer +// High-order polynomials may oscillate wildly: // -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.exceptions.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary // -// ``f`` : decimal floating point +// Illustration: // -// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() // -// ``o`` : signed octal // -// ``s`` : string of characters // -// ``u`` : unsigned decimal integer +//go:linkname Polyfit py.polyfit +func Polyfit(__llgo_va_list ...interface{}) *py.Object // -// ``x,X`` : unsigned hexadecimal integer +// Split an array into multiple sub-arrays vertically (row-wise). // -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. // -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. // // Examples // -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// >>> import numpy as np +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), +// array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), +// array([[12., 13., 14., 15.]]), +// array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), +// array([[[4., 5.], +// [6., 7.]]])] // // // -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object // -// Load ASCII data stored in a comma-separated file. +// Round to nearest integer towards zero. // -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values have the same data-type as the input. // // Parameters // ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// x : array_like +// An array to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// An array with the same dimensions and data-type as the input. +// If second argument is not supplied then a new array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value ``out`` is then a reference to that array. // // See Also // -------- -// numpy.genfromtxt : generic function to load ASCII data. +// rint, trunc, floor, ceil +// around : Round to given number of decimals // -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. +// Examples +// -------- +// >>> import numpy as np +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) // // // -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object // -// packbits(a, /, axis=None, bitorder='big') +// busday_count( +// begindates, +// enddates, +// weekmask='1111100', +// holidays=[], +// busdaycal=None, +// out=None +// ) // -// Packs the elements of a binary-valued array into bits in a uint8 array. +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. // -// The result is padded to full bytes by inserting zero bits at the end. +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. // // Parameters // ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. // // Returns // ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. // // See Also // -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. // // Examples // -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) +// >>> import numpy as np +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 // -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. // +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object // +// Return the size of the buffer used in ufuncs. // -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. // -// Construct an array by executing a function over each coordinate. +// Examples +// -------- +// >>> import numpy as np +// >>> np.getbufsize() +// 8192 // -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. // // Parameters // ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. // // Returns // ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. // // See Also // -------- -// indices, meshgrid +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// vecdot : Vector dot product of two arrays. +// einsum : Einstein summation convention. // // Notes // ----- -// Keywords other than `dtype` and `like` are passed to `function`. +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b // // Examples // -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) +// Ordinary inner product for vectors: // -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) +// >>> import numpy as np +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 // -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) +// Some multidimensional examples: // -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) // +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) // +// An example where `b` is a scalar: // -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) // -// Return a string representation of a number in the given base system. // -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). // -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. +// Logarithm of the sum of exponentiations of the inputs in base-2. // -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. // -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. // +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. // +// Examples +// -------- +// >>> import numpy as np +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 // -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// putmask(a, mask, values) +// Numerical negative, element-wise. // -// Changes elements of an array based on conditional and input values. +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. // -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. +// Examples +// -------- +// >>> import numpy as np +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// +// Find the unique elements and counts of an input array `x`. +// +// This function is an Array API compatible alternative to:: +// +// np.unique(x, return_counts=True, equal_nan=False, sorted=False) +// +// but returns a namedtuple for easier access to each output. +// +// .. note:: +// This function currently always returns a sorted result, however, +// this could change in any NumPy minor release. // // Parameters // ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. +// x : array_like +// Input array. It will be flattened if it is not already 1-D. +// +// Returns +// ------- +// out : namedtuple +// The result containing: +// +// * values - The unique elements of an input array. +// * counts - The corresponding counts for each unique element. // // See Also // -------- -// place, put, take, copyto +// unique : Find the unique elements of an array. // // Examples // -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) +// >>> import numpy as np +// >>> x = [1, 1, 2] +// >>> uniq = np.unique_counts(x) +// >>> uniq.values +// array([1, 2]) +// >>> uniq.counts +// array([2, 1]) // -// If `values` is smaller than `a` it is repeated: // -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) +//go:linkname UniqueCounts py.unique_counts +func UniqueCounts(x *py.Object) *py.Object // +// Construct an array by repeating A the number of times given by reps. // +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. // -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. // -// Return selected slices of an array along given axis. +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by prepending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). // -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. // // Parameters // ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. // // Returns // ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. +// c : ndarray +// The tiled output array. // // See Also // -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape // // Examples // -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a +// >>> import numpy as np +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) // array([[1, 2], // [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) +// [1, 2], +// [3, 4]]) // +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) // // -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object // -// Load data from a text file. +// Show libraries and system information on which NumPy was built +// and is being used // // Parameters // ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. // -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None // -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. // -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed // -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. // -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. // -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. +// Return the complex conjugate, element-wise. // -// .. versionadded:: 1.16.0 +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. // -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. // -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// Notes +// ----- +// `conj` is an alias for `conjugate`: // -// .. versionadded:: 1.20.0 +// >>> np.conj is np.conjugate +// True // -// Returns -// ------- -// out : ndarray -// Data read from the text file. +// Examples +// -------- +// >>> import numpy as np +// >>> np.conjugate(1+2j) +// (1-2j) // -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) // -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object // -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. +// Returns the discrete, linear convolution of two one-dimensional sequences. // -// .. versionadded:: 1.10.0 +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. // -// The strings produced by the Python float.hex method can be used as -// input for floats. +// If `v` is longer than `a`, the arrays are swapped before computation. // -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. // -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) +// Notes +// ----- +// The discrete convolution operation is defined as // -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} // -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. // -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution // -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: // -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. +// >>> import numpy as np +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) // -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: // -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) // -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) +// The two arrays are of the same length, so there +// is only one position where they completely overlap: // -// This idea can be extended to automatically handle values specified in -// many different formats: +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) // -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) // -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` // -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object // -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') // -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '`. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', +// end with a Z to indicate UTC time. If 'local', convert to the local +// timezone first, and suffix with a +-#### timezone offset. If a tzinfo +// object, then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. // -// >>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> import numpy as np +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') // -// >>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) +// Note that we picked datetimes that cross a DST boundary. Passing in a +// ``pytz`` timezone object will print the appropriate offset // +// >>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' // -// Note that `place` does the exact opposite of `extract`. // -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. +// First array elements raised to powers from second array, element-wise. // -// See Also -// -------- -// take, put, copyto, compress, place +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. // -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). // +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// If `condition` is boolean: +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. // -// >>> arr[condition] -// array([0, 3, 6, 9]) +// See Also +// -------- +// power : power function that preserves type // +// Examples +// -------- +// >>> import numpy as np // +// Cube each element in a list. // -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) // -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// Raise the bases to different exponents. // -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) // -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False +// The effect of broadcasting. // -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) // -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). // -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) // -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read +// To get complex results, give the argument ``dtype=complex``. // -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) // -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// with load('foo.npz') as data: -// a = data['a'] +// Returns x1 * 2**x2, element-wise. // -// The underlying file descriptor is closed when exiting the 'with' -// block. +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. // -// Examples -// -------- -// Store data to disk, and load it again: +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. // -// Store compressed data to disk, and load it again: +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. // -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. // -// Mem-map the stored array, and then access the second row -// directly from disk: +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. // -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) +// Examples +// -------- +// >>> import numpy as np +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) // +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) // +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// promote_types(type1, type2) // -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. // -// Compute the multidimensional histogram of some data. +// This function is symmetric, but rarely associative. // // Parameters // ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. // -// The first form should be preferred. +// Returns +// ------- +// out : dtype +// The promoted data type. // -// bins : sequence or int, optional -// The bin specification: +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. // -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. // -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. +// .. versionchanged:: 1.23.0 // -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. // // See Also // -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram +// result_type, dtype, can_cast // // Examples // -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) +// >>> import numpy as np +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') // +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') // -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// An example of a non-associative case: // -// Return a partitioned copy of an array. +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object // -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. +// Roll array elements along a given axis. // -// .. versionadded:: 1.8.0 +// Elements that roll beyond the last position are re-introduced at +// the first. // // Parameters // ---------- // a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. // // Returns // ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. +// res : ndarray +// Output array, with the same shape as `a`. // // See Also // -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. // // Notes // ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. +// Supports rolling over multiple dimensions simultaneously. // // Examples // -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// >>> import numpy as np +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) // +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) // -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object // -// Estimate a covariance matrix, given data and weights. // -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// See the notes for an outline of the algorithm. +// Trigonometric inverse cosine, element-wise. // -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. +// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. // -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. +// Parameters +// ---------- +// x : array_like +// `x`-coordinate on the unit circle. +// For real arguments, the domain is [-1, 1]. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. // -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos // -// .. versionadded:: 1.20 +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. // -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -// See Also -// -------- -// corrcoef : Normalized covariance matrix +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. // -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: +// The inverse `cos` is also known as `acos` or cos^-1. // -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm // -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. +// Examples +// -------- +// >>> import numpy as np // -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: +// We expect the arccos of 1 to be 0, and of -1 to be pi: // -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) // -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: +// Plot arccos: // -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() // -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. +//go:linkname Acos py.acos +func Acos(__llgo_va_list ...interface{}) *py.Object // -// Further, note how `x` and `y` are combined: +// Return the minimum of an array or minimum along an axis. // -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) +// `amin` is an alias of `~numpy.min`. // +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method // // -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// Return the Kaiser window. +// concatenate( +// (a1, a2, ...), +// axis=0, +// out=None, +// dtype=None, +// casting="same_kind" +// ) // -// The Kaiser window is a taper formed by using a Bessel function. +// Join a sequence of arrays along an existing axis. // // Parameters // ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// For a description of the options, please see :term:`casting`. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). +// res : ndarray +// The concatenated array. // // See Also // -------- -// bartlett, blackman, hamming, hanning +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. // // Notes // ----- -// The Kaiser window is defined as +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. // -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) // -// with +// This function will not preserve masking of MaskedArray inputs. // -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) // -// where :math:`I_0` is the modified zeroth-order Bessel function. // -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. // -// The Kaiser can approximate many other windows by varying the beta -// parameter. +//go:linkname Concatenate py.concatenate +func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object // -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= +// Return the current print options. // -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys // -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - sign : str +// - formatter : dict of callables +// - floatmode : str +// - legacy : str or False // -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions // // Examples // -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// >>> import numpy as np // +// >>> np.get_printoptions() +// {'edgeitems': 3, 'threshold': 1000, ..., 'override_repr': None} // -// Plot the window and the frequency response: +// >>> np.get_printoptions()['linewidth'] +// 75 +// >>> np.set_printoptions(linewidth=100) +// >>> np.get_printoptions()['linewidth'] +// 100 // -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() // -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() // +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // +// Return (x1 != x2) element-wise. // -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Difference (subtraction) of two polynomials. +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal // -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. +// Examples +// -------- +// >>> import numpy as np +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. // // Parameters // ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. +// out : ndarray +// Array of ones with the given shape, dtype, and order. // // See Also // -------- -// polyval, polydiv, polymul, polyadd +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. // // Examples // -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// +// >>> import numpy as np +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) // +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) // -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) // -// Evaluate a polynomial at specific values. +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) // -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. // -// If `p` is of length N, this function returns the value: // -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object // -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. +// Sum of array elements over a given axis. // // Parameters // ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. If +// axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. // // Returns // ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. // // See Also // -------- -// poly1d: A polynomial class. +// ndarray.sum : Equivalent method. +// add: ``numpy.add.reduce`` equivalent function. +// cumsum : Cumulative sum of array elements. +// trapezoid : Integration of array values using composite trapezoidal rule. +// +// mean, average // // Notes // ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. // -// If `x` is a subtype of `ndarray` the return value will be of the same type. +// The sum of an empty array is the neutral element 0: // -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. // // Examples // -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) +// >>> import numpy as np +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// np.int32(1) +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: // +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// np.int8(-128) // +// You can also start the sum with a value other than zero: // -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// asfortranarray(a, dtype=None, *, like=None) +// >>> np.sum([10], initial=5) +// 15 // -// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. // // Parameters // ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: // -// .. versionadded:: 1.20.0 +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' // -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: // -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' // -// Examples -// -------- -// Starting with a C-contiguous array: +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. // -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. // -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the percentile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// See the notes for more details. // -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False +// .. versionadded:: 2.0.0 // -// Now, starting with a Fortran-contiguous array: +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. // -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. // -// Then, calling ``asfortranarray`` returns the same object: +// Notes +// ----- +// The behavior of `numpy.percentile` with percentage `q` is +// that of `numpy.quantile` with argument ``q/100``. +// For more information, please see `numpy.quantile`. // -// >>> y = np.asfortranarray(x) -// >>> x is y -// True +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) // -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) // -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) // -// copyto(dst, src, casting='same_kind', where=True) +// The different methods can be visualized graphically: // -// Copies values from one array to another, broadcasting as necessary. +// .. plot:: // -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. +// import matplotlib.pyplot as plt // -// .. versionadded:: 1.7.0 +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() // -// Parameters +// References // ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 // -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) // // +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Compute the bit-wise XOR of two arrays element-wise. // -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. // // Parameters // ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. +// x1, x2 : array_like +// Only integer and boolean types are handled. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -23293,1423 +23267,1499 @@ func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object // // Returns // ------- -// y : ndarray -// y = floor(`x1`/`x2`) +// out : ndarray or scalar +// Result. // This is a scalar if both `x1` and `x2` are scalars. // // See Also // -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. // // Examples // -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) +// >>> import numpy as np // -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: // -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Find the unique elements of an array, and counts, inverse, and indices. +// +// This function is an Array API compatible alternative to:: +// +// np.unique(x, return_index=True, return_inverse=True, +// return_counts=True, equal_nan=False, sorted=False) +// +// but returns a namedtuple for easier access to each output. +// +// .. note:: +// This function currently always returns a sorted result, however, +// this could change in any NumPy minor release. +// +// Parameters +// ---------- +// x : array_like +// Input array. It will be flattened if it is not already 1-D. +// +// Returns +// ------- +// out : namedtuple +// The result containing: +// +// * values - The unique elements of an input array. +// * indices - The first occurring indices for each unique element. +// * inverse_indices - The indices from the set of unique elements +// that reconstruct `x`. +// * counts - The corresponding counts for each unique element. +// +// See Also +// -------- +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = [1, 1, 2] +// >>> uniq = np.unique_all(x) +// >>> uniq.values +// array([1, 2]) +// >>> uniq.indices +// array([0, 2]) +// >>> uniq.inverse_indices +// array([0, 0, 1]) +// >>> uniq.counts +// array([2, 1]) +// +// +//go:linkname UniqueAll py.unique_all +func UniqueAll(x *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. // -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// .. versionadded:: 1.10.0 // -// Logarithm of the sum of exponentiations of the inputs. +// `numpy.digitize` is implemented in terms of `numpy.searchsorted`. +// This means that a binary search is used to bin the values, which scales +// much better for larger number of bins than the previous linear search. +// It also removes the requirement for the input array to be 1-dimensional. // -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. +// For monotonically *increasing* `bins`, the following are equivalent:: // -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') // -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. // -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 // -// Notes -// ----- -// .. versionadded:: 1.3.0 +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) // -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 // -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object // -// Return the indices to access the main diagonal of an array. +// Evaluate a piecewise-defined function. // -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. // // Parameters // ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. // -// ndim : int, optional -// The number of dimensions. // // See Also // -------- -// diag_indices_from +// choose, select, where // // Notes // ----- -// .. versionadded:: 1.4.0 +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- // // Examples // -------- -// Create a set of indices to access the diagonal of a (4, 4) array: +// >>> import numpy as np // -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) +// Define the signum function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. // -// Now, we create indices to manipulate a 3-D array: +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) // -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. // -// And use it to set the diagonal of an array of zeros to 1: +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) // -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) // // // -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object // -// Check if the array is Fortran contiguous but *not* C contiguous. +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. // -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. // // Parameters // ---------- -// a : ndarray -// Input array. +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). // // Returns // ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. // +// See Also +// -------- +// ogrid, mgrid, meshgrid // // Examples // -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> import numpy as np +// >>> a = np.arange(10).reshape(2, 5) // >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) // -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) // -// >>> np.isfortran(np.array([1, 2], order='F')) -// False // // +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object // -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. // -// Create a new 1-dimensional array from an iterable object. +// One is returned for slices that are all-NaN or empty. // // Parameters // ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. // -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. // -// .. versionadded:: 1.20.0 +// .. versionadded:: 1.22.0 // // Returns // ------- -// out : ndarray -// The output array. +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. // -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. // // Examples // -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) +// >>> import numpy as np +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) // -// A carefully constructed subarray dtype will lead to higher dimensional -// results: // -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) // -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// Return numbers spaced evenly on a log scale (a geometric progression). +// Return the roots of a polynomial with coefficients given in p. // -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: // -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] // // Parameters // ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 +// p : array_like +// Rank-1 array of polynomial coefficients. // // Returns // ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. +// out : ndarray +// An array containing the roots of the polynomial. // -// See Also +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also // -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. // // Notes // ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. // // Examples // -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// >>> import numpy as np +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) // -// Note that the above may not produce exact integers: // -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) // -// Negative, decreasing, and complex inputs are allowed: +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object // -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use // -// Graphical illustration of `endpoint` parameter: +// .. versionadded:: 1.24.0 // -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. // -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat // -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. // -// Evaluates the Einstein summation convention on the operands. +// Examples +// -------- +// >>> import numpy as np +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) // -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object // -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. +// Return a partitioned copy of an array. // -// See the notes and examples for clarification. +// Creates a copy of the array and partially sorts it in such a way that +// the value of the element in k-th position is in the position it would be +// in a sorted array. In the output array, all elements smaller than the k-th +// element are located to the left of this element and all equal or greater +// are located to its right. The ordering of the elements in the two +// partitions on the either side of the k-th element in the output array is +// undefined. // // Parameters // ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. // -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. // // Returns // ------- -// output : ndarray -// The calculation based on the Einstein summation convention. +// partitioned_array : ndarray +// Array of the same type and shape as `a`. // // See Also // -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting // // Notes // ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: // -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= // -// .. versionadded:: 1.10.0 +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. // -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. // -// .. versionadded:: 1.12.0 +// The sort order of ``np.nan`` is bigger than ``np.inf``. // -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) # may vary // -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: // -// See :py:func:`numpy.einsum_path` for more details. +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] // -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) +// The next example shows the use of multiple values passed to `kth`. // -// Trace of a matrix: +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) // -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: // -// Extract the diagonal (requires explicit form): +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] // -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) // -// Sum over an axis (requires explicit form): +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) +// Convert angles from radians to degrees. // -// For higher dimensional arrays summing a single axis can be done with ellipsis: +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. // -// Compute a matrix transpose, or reorder any number of axes: +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. // -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) +// Notes +// ----- +// rad2deg(x) is ``180 * x / pi``. // -// Vector inner products: +// Examples +// -------- +// >>> import numpy as np +// >>> np.rad2deg(np.pi/2) +// 90.0 // -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object // -// Matrix vector multiplication: +// Find the union of two arrays. // -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) +// Return the unique, sorted array of values that are in either of the two +// input arrays. // -// Broadcasting and scalar multiplication: +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. // -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. // -// Vector outer product: +// Examples +// -------- +// >>> import numpy as np +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) // -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) +// To find the union of more than two arrays, use functools.reduce: // -// Tensor contraction: +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) // -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) // -// Writeable returned arrays (since version 1.10.0): +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object // -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) +// Find the indices of array elements that are non-zero, grouped by element. // -// Example of ellipsis use: +// Parameters +// ---------- +// a : array_like +// Input data. // -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. // -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: +// See Also +// -------- +// where, nonzero // -// >>> a = np.ones(64).reshape(2,4,8) +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. // -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. // -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) // -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms // -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') // -// Greedy `einsum` (faster optimal path approximation): ~160ms +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object // -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// Return a string representation of the data in an array. // -// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. // -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. // +// See Also +// -------- +// array2string, array_repr, set_printoptions // +// Examples +// -------- +// >>> import numpy as np +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' // -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object // -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. // -// Ones are returned for slices that are all-NaN or empty. +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object // -// .. versionadded:: 1.12.0 +// Gives a new shape to an array without changing its data. // // Parameters // ---------- // a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. +// Array to be reshaped. +// shape : int or tuple of ints +// The new shape should be compatible with the original shape. If +// an integer, then the result will be a 1-D array of that length. +// One shape dimension can be -1. In this case, the value is +// inferred from the length of the array and remaining dimensions. +// order : {'C', 'F', 'A'}, optional +// Read the elements of ``a`` using this index order, and place the +// elements into the reshaped array using this index order. 'C' +// means to read / write the elements using C-like index order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to read / write the +// elements using Fortran-like index order, with the first index +// changing fastest, and the last index changing slowest. Note that +// the 'C' and 'F' options take no account of the memory layout of +// the underlying array, and only refer to the order of indexing. +// 'A' means to read / write the elements in Fortran-like index +// order if ``a`` is Fortran *contiguous* in memory, C-like order +// otherwise. +// newshape : int or tuple of ints +// .. deprecated:: 2.1 +// Replaced by ``shape`` argument. Retained for backward +// compatibility. +// copy : bool, optional +// If ``True``, then the array data is copied. If ``None``, a copy will +// only be made if it's required by ``order``. For ``False`` it raises +// a ``ValueError`` if a copy cannot be avoided. Default: ``None``. // // Returns // ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. +// reshaped_array : ndarray +// This will be a new view object if possible; otherwise, it will +// be a copy. Note there is no guarantee of the *memory layout* (C- or +// Fortran- contiguous) of the returned array. // // See Also // -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. +// ndarray.reshape : Equivalent method. +// +// Notes +// ----- +// It is not always possible to change the shape of an array without copying +// the data. +// +// The ``order`` keyword gives the index ordering both for *fetching* +// the values from ``a``, and then *placing* the values into the output +// array. For example, let's say you have an array: +// +// >>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) // // Examples // -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) +// >>> import numpy as np +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) // // +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, shape *py.Object, order *py.Object) *py.Object // -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) +// Return the elements of an array that satisfy some condition. // -// Return a new array of given shape and type, filled with zeros. +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. // // Parameters // ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. // // Returns // ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. // // See Also // -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. +// take, put, copyto, compress, place // // Examples // -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> import numpy as np +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. // -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. +// If `condition` is boolean: // -// See Also -// -------- +// >>> arr[condition] +// array([0, 3, 6, 9]) // -// cosh, arcsinh, sinh, arctanh, tanh // -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. // -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object // -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. +// Return the gradient of an N-dimensional array. // -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. // -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: // -//go:linkname Arccosh py.arccosh -func Arccosh(x *py.Object, out *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. // -// Inverse sine, element-wise. +// If `axis` is given, the number of varargs must equal the number of axes +// specified in the axis parameter. +// Default: 1. (see Examples below). // -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. // -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. +// Returns +// ------- +// gradient : ndarray or tuple of ndarray +// A tuple of ndarrays (or a single ndarray if there is only one +// dimension) corresponding to the derivatives of f with respect +// to each dimension. Each derivative has the same shape as f. // -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// Examples +// -------- +// >>> import numpy as np +// >>> f = np.array([1, 2, 4, 7, 11, 16]) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) // -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: // -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) // -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. +// Or a non uniform one: // -// The inverse sine is also known as `asin` or sin^{-1}. +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.]) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) // -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: // -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]])) +// (array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), +// array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])) // -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 // -// Inverse hyperbolic sine element-wise. +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), dx, y) +// (array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), +// array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])) // -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// It is possible to specify how boundaries are treated using `edge_order` // -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) // -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated // -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) // -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. +// The `varargs` argument defines the spacing between sample points in the +// input array. It can take two forms: +// +// 1. An array, specifying coordinates, which may be unevenly spaced: +// +// >>> x = np.array([0., 2., 3., 6., 8.]) +// >>> y = x ** 2 +// >>> np.gradient(y, x, edge_order=2) +// array([ 0., 4., 6., 12., 16.]) +// +// 2. A scalar, representing the fixed sample distance: +// +// >>> dx = 2 +// >>> x = np.array([0., 2., 4., 6., 8.]) +// >>> y = x ** 2 +// >>> np.gradient(y, dx, edge_order=2) +// array([ 0., 4., 8., 12., 16.]) +// +// It's possible to provide different data for spacing along each dimension. +// The number of arguments must match the number of dimensions in the input +// data. +// +// >>> dx = 2 +// >>> dy = 3 +// >>> x = np.arange(0, 6, dx) +// >>> y = np.arange(0, 9, dy) +// >>> xs, ys = np.meshgrid(x, y) +// >>> zs = xs + 2 * ys +// >>> np.gradient(zs, dy, dx) # Passing two scalars +// (array([[2., 2., 2.], +// [2., 2., 2.], +// [2., 2., 2.]]), +// array([[1., 1., 1.], +// [1., 1., 1.], +// [1., 1., 1.]])) +// +// Mixing scalars and arrays is also allowed: +// +// >>> np.gradient(zs, y, dx) # Passing one array and one scalar +// (array([[2., 2., 2.], +// [2., 2., 2.], +// [2., 2., 2.]]), +// array([[1., 1., 1.], +// [1., 1., 1.], +// [1., 1., 1.]])) // -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: // -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh +// .. math:: // -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] // -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: // -// Returns x1 * 2**x2, element-wise. +// .. math:: // -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. // -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: // -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. +// .. math:: // -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) // -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: // -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. +// .. math:: // -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) // -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. // -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. // -// Multiply arguments element-wise. // -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. // -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. // -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. +// See Also +// -------- +// stack, hstack, vstack, concatenate // -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) // -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) // -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. // -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object // -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Returns a bool array, where True if input element is real. // -// Numerical positive, element-wise. +// If element has complex type with zero imaginary part, the return value +// for that element is True. // -// .. versionadded:: 1.13.0 +// Parameters +// ---------- +// x : array_like +// Input array. // -// Parameters -// ---------- -// x : array_like or scalar -// Input array. +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. // -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) // -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. // -// Examples -// -------- +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) // -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) +// The function does not work on string arrays. // -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False // -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. // -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) // -// Return Pearson product-moment correlation coefficients. +// isreal should not be used with object arrays // -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) // -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } // -// The values of `R` are between -1 and 1, inclusive. // -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object // -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. +// Return the cross product of two (arrays of) vectors. // -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. // -// .. versionadded:: 1.20 +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. // // Returns // ------- -// R : ndarray -// The correlation coefficient matrix of the variables. +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. // // See Also // -------- -// cov : Covariance matrix +// inner : Inner product +// outer : Outer product. +// linalg.cross : An Array API compatible variation of ``np.cross``, +// which accepts (arrays of) 3-element vectors only. +// ix_ : Construct index arrays. // // Notes // ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. +// Supports full broadcasting of the inputs. // -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. +// Dimension-2 input arrays were deprecated in 2.0.0. If you do need this +// functionality, you can use:: +// +// def cross2d(x, y): +// return x[..., 0] * y[..., 1] - x[..., 1] * y[..., 0] // // Examples // -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. +// Vector cross-product. // // >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) // -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. +// One vector with dimension 2. // -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. // -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) // -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) +// The orientation of `c` can be changed using the `axisc` keyword. // +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) // +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. // -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) // -// Range of values (maximum - minimum) along an axis. // -// The name of the function comes from the acronym for 'peak to peak'. // -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. +// Compute bit-wise inversion, or bit-wise NOT, element-wise. // -// .. versionadded:: 1.15.0 +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. // -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. +// For signed integer inputs, the bit-wise NOT of the absolute value is +// returned. In a two's-complement system, this operation effectively flips +// all the bits, resulting in a representation that corresponds to the +// negative of the input plus one. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range :math:`-2^{N-1}` to +// :math:`+2^{N-1}-1`. // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. // -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. // -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) +// Notes +// ----- +// ``numpy.bitwise_not`` is an alias for `invert`: // -// >>> np.ptp(x, axis=1) -// array([8, 6]) +// >>> np.bitwise_not is np.invert +// True // -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement // -// >>> np.ptp(x) -// 10 +// Examples +// -------- +// >>> import numpy as np // -// This example shows that a negative value can be returned when -// the input is an array of signed integers. +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: // -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// np.uint8(242) +// >>> np.binary_repr(x, width=8) +// '11110010' // -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: +// The result depends on the bit-width: // -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// np.uint16(65522) +// >>> np.binary_repr(x, width=16) +// '1111111111110010' // +// When using signed integer types, the result is the bit-wise NOT of +// the unsigned type, interpreted as a signed integer: // +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' // -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // // Shift the bits of an integer to the right. // @@ -24755,6 +24805,7 @@ func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py // // Examples // -------- +// >>> import numpy as np // >>> np.binary_repr(10) // '1010' // >>> np.right_shift(10, 1) @@ -24773,380 +24824,259 @@ func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py // >>> x1 >> x2 // array([5, 2, 1]) // -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) +//go:linkname BitwiseRightShift py.bitwise_right_shift +func BitwiseRightShift(__llgo_va_list ...interface{}) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // +// Calculate the absolute value element-wise. // -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// ``np.abs`` is a shorthand for this function. // -// Get help information for an array, function, class, or module. +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. // -// See Also -// -------- -// source, lookfor +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 // -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. +// Plot the function over ``[-10, 10]``: // -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... +// >>> import matplotlib.pyplot as plt // -// When using a string for `object` it is possible to get multiple results. +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() // -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** +// Plot the function over the complex plane: // -// When the argument is an array, information about the array is printed. +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() // -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. // +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) // +//go:linkname Absolute py.absolute +func Absolute(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. +// Return the natural logarithm of one plus the input array, element-wise. // -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// Calculates ``log(1 + x)``. // -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. // -// Returns -// ------- -// None +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. // -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. // -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. // -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. // -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. // -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm // -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) +// Examples +// -------- +// >>> import numpy as np +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 // -// Using `savez` with \*args, the arrays are saved with default names. +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// vecdot(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) // -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// Vector dot product of two arrays. // -// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// Let :math:`\mathbf{a}` be a vector in `x1` and :math:`\mathbf{b}` be +// a corresponding vector in `x2`. The dot product is defined as: // -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// .. math:: +// \mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} \overline{a_i}b_i // +// where the sum is over the last dimension (unless `axis` is specified) and +// where :math:`\overline{a_i}` denotes the complex conjugate if :math:`a_i` +// is complex and the identity otherwise. // +// .. versionadded:: 2.0.0 // -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// the broadcasted shape of `x1` and `x2` with the last axis removed. +// If not provided or None, a freshly-allocated array is used. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. +// Returns +// ------- +// y : ndarray +// The vector dot product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. // -// Returns the qth percentile(s) of the array elements. +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the last dimension of `x2`. // -// .. versionadded:: 1.9.0 +// If a scalar value is passed in. // -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: +// See Also +// -------- +// vdot : same but flattens arguments first +// matmul : Matrix-matrix product. +// vecmat : Vector-matrix product. +// matvec : Matrix-vector product. +// einsum : Einstein summation convention. // -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' +// Examples +// -------- +// >>> import numpy as np // -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: +// Get the projected size along a given normal for an array of vectors. // -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' +// >>> v = np.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]]) +// >>> n = np.array([0., 0.6, 0.8]) +// >>> np.vecdot(v, n) +// array([ 3., 8., 10.]) // -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. +//go:linkname Vecdot py.vecdot +func Vecdot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. +// Difference (subtraction) of two polynomials. // -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. // -// interpolation : str, optional -// Deprecated name for the method keyword argument. +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. // -// .. deprecated:: 1.22.0 +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. // // Returns // ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. // // See Also // -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` +// polyval, polydiv, polymul, polyadd // // Examples // -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) // -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) // -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 +// >>> import numpy as np // +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) // // -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // -// Base-2 logarithm of `x`. +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. // // Parameters // ---------- // x : array_like -// Input values. +// Input array. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -25165,711 +25095,1061 @@ func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, // // Returns // ------- -// y : ndarray -// Base-2 logarithm of `x`. +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. // This is a scalar if `x` is a scalar. // -// See Also +// Examples // -------- -// log, log10, log1p, emath.log2 +// >>> import numpy as np +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 // -// Notes -// ----- -// .. versionadded:: 1.3.0 +// Plot the function over ``[-10, 10]``: // -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. +// >>> import matplotlib.pyplot as plt // -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() // -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. +// Plot the function over the complex plane: // -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() // -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size +// not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 // -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) // -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object // -// Return the scalar type of highest precision of the same kind as the input. +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. // // Parameters // ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. // // Returns // ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. // // Examples // -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary +// >>> import numpy as np +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) // -// >>> np.maximum_sctype(str) -// +// To return the indices of the values common to the input arrays +// along with the intersected values: // -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) // // // -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object // -// View inputs as arrays with at least three dimensions. +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. // // Parameters // ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. +// arr : array_like +// Input array. +// obj : slice, int, array-like of ints or bools +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. // // Returns // ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. // // See Also // -------- -// atleast_1d, atleast_2d +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. // // Examples // -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) +// >>> import numpy as np +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) // -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) // -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True // -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) // +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object // +// Return an antiderivative (indefinite integral) of a polynomial. // -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. // -// Return the Hanning window. +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part // -// The Hanning window is a taper formed by using a weighted cosine. +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. // // Parameters // ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. // -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. // // See Also // -------- -// bartlett, blackman, hamming, kaiser +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method // -// Notes -// ----- -// The Hanning window is defined as +// Examples +// -------- // -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 +// The defining property of the antiderivative: // -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. +// >>> import numpy as np // -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True // -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// The integration constants default to zero, but can be specified: // -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary // -// Plot the window and its frequency response: +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: // -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 // -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() // // +//go:linkname Polyint py.polyint +func Polyint(__llgo_va_list ...interface{}) *py.Object +//go:linkname Asinh py.asinh +func Asinh(__llgo_va_list ...interface{}) *py.Object +//go:linkname Minimum py.minimum +func Minimum(__llgo_va_list ...interface{}) *py.Object // -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object +// Find indices where elements should be inserted to maintain order. // -// Return the Bartlett window. +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. // -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ // // Parameters // ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. // // Returns // ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. // // See Also // -------- -// blackman, hamming, hanning, kaiser +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. // // Notes // ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) +// Binary search is used to find the required insertion points. // -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. // -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// This function uses the same algorithm as the builtin python +// `bisect.bisect_left` (``side='left'``) and `bisect.bisect_right` +// (``side='right'``) functions, which is also vectorized +// in the `v` argument. // // Examples // -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): +// >>> import numpy as np +// >>> np.searchsorted([11,12,13,14,15], 13) +// 2 +// >>> np.searchsorted([11,12,13,14,15], 13, side='right') +// 3 +// >>> np.searchsorted([11,12,13,14,15], [-10, 20, 12, 13]) +// array([0, 5, 1, 2]) // -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() +// When `sorter` is used, the returned indices refer to the sorted +// array of `a` and not `a` itself: // -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() +// >>> a = np.array([40, 10, 20, 30]) +// >>> sorter = np.argsort(a) +// >>> sorter +// array([1, 2, 3, 0]) # Indices that would sort the array 'a' +// >>> result = np.searchsorted(a, 25, sorter=sorter) +// >>> result +// 2 +// >>> a[sorter[result]] +// 30 # The element at index 2 of the sorted array is 30. // // +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object // -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. // -// Expand the shape of an array. +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. // -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. // // Parameters // ---------- // a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : {int, float}, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. // -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 // -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. +// mean : array_like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this std function. +// +// .. versionadded:: 2.0.0 +// +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. +// +// .. versionadded:: 2.0.0 // // Returns // ------- -// result : ndarray -// View of `a` with the number of dimensions increased. +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. // // See Also // -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. // // Examples // -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) +// >>> import numpy as np +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary // -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: // -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) // -// The following is equivalent to ``x[:, np.newaxis]``: +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) +// Inverse hyperbolic cosine, element-wise. // -// ``axis`` may also be a tuple: +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. // -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) +// See Also +// -------- // -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: +// cosh, arcsinh, sinh, arctanh, tanh // -// >>> np.newaxis is None -// True +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. // +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. // +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh // -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// Examples +// -------- +// >>> import numpy as np +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 // -// Create nditers for use in nested loops +//go:linkname Arccosh py.arccosh +func Arccosh(x *py.Object, out *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) // -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. +// Convert the input to an array. // // Parameters // ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer +// .. versionadded:: 2.0.0 +// copy : bool, optional +// If ``True``, then the object is copied. If ``None`` then the object is +// copied only if needed, i.e. if ``__array__`` returns a copy, if obj +// is a nested sequence, or if a copy is needed to satisfy any of +// the other requirements (``dtype``, ``order``, etc.). +// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. +// Default: ``None``. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. // -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name +// .. versionadded:: 1.20.0 // // Returns // ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first +// out : ndarray +// Array interpretation of ``a``. No copy is performed if the input +// is already an ndarray with matching dtype and order. If ``a`` is a +// subclass of ndarray, a base class ndarray is returned. // // See Also // -------- -// nditer +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. // // Examples // -------- +// Convert a list into an array: // -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] +// >>> a = [1, 2] +// >>> import numpy as np +// >>> np.asarray(a) +// array([1, 2]) // -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 +// Existing arrays are not copied: // -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True // -// A new 1-D array initialized from text data in a string. +// If `dtype` is set, array is copied only if dtype does not match: // -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.shares_memory(np.asarray(a, dtype=np.float32), a) +// True +// >>> np.shares_memory(np.asarray(a, dtype=np.float64), a) +// False // -// .. versionadded:: 1.18.0 -// Complex dtypes. +// Contrary to `asanyarray`, ndarray subclasses are not passed through: // -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True // -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object // -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. +// Return specified diagonals. // -// .. versionadded:: 1.20.0 +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). // // Returns // ------- -// arr : ndarray -// The constructed array. +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. // // Raises // ------ // ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. +// If the dimension of `a` is less than 2. // // See Also // -------- -// frombuffer, fromfile, fromiter +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. // // Examples // -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) +// >>> import numpy as np +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) // -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// A 3-D example: // -// dot(a, b, out=None) +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) // -// Dot product of two arrays. Specifically, +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. // -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. // -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. +// See Also +// -------- +// real_if_close, imag, angle // -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 // -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. // -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: // -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +//go:linkname Real py.real +func Real(val *py.Object) *py.Object // -// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// Return the string representation of an array. // // Parameters // ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. // // Returns // ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. +// string : str +// The string representation of an array. // // See Also // -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. +// array_str, array2string, set_printoptions // // Examples // -------- -// >>> np.dot(3, 4) -// 12 +// >>> import numpy as np +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' // -// Neither argument is complex-conjugated: +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' // -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) // -// For 2-D arrays it is the matrix product: // -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. // +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. // -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. // -// Roll the specified axis backwards, until it lies in a given position. +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=int32) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) // -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. // // Parameters // ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. In the case of a single +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. // -// .. table:: -// :align: left +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. // -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ +// .. versionadded:: 1.24 // -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 // // Returns // ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. +// stacked : ndarray +// The array formed by stacking the given arrays. // // See Also // -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays +// horizontally (column-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) // -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) // // +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Given the "legs" of a right triangle, return its hypotenuse. // -// Convert angles from degrees to radians. +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) // // Parameters // ---------- -// x : array_like -// Angles in degrees. +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -25888,353 +26168,326 @@ func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object // // Returns // ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. // -// See Also +// Examples // -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. +// >>> import numpy as np +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) // -// Notes -// ----- -// .. versionadded:: 1.3.0 +// Example showing broadcast of scalar_like argument: // -// ``deg2rad(x)`` is ``x * pi / 180``. +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) // -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Matvec py.matvec +func Matvec(__llgo_va_list ...interface{}) *py.Object // -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// Broadcast an array to a new shape. +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. // // Parameters // ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. // // Returns // ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. // // See Also // -------- -// broadcast -// broadcast_arrays -// broadcast_shapes +// blackman, hamming, hanning, kaiser // // Notes // ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// +// The Bartlett window is defined as // -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) // -// Deprecates a function and includes the deprecation in its docstring. +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. // -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. // -// See Also +// Examples // -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) // -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. +// Plot the window and its frequency response (requires SciPy and matplotlib). // -// Returns -// ------- -// obj : object +// .. plot:: +// :include-source: // +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.bartlett(51) +// plt.plot(window) +// plt.title("Bartlett window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// with np.errstate(divide='ignore', invalid='ignore'): +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Bartlett window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() // // -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object // -// Print or write to a file the source code for a NumPy object. +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object // -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. +// `trapz` is deprecated in NumPy 2.0. // -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. +// Please use `trapezoid` instead, or one of the numerical integration +// functions in `scipy.integrate`. // -// See Also -// -------- -// lookfor, info // -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object // -// The source code is only returned for objects written in Python. +// Apply a function to 1-D slices along the given axis. // -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. // +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: // +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] // -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) +// Equivalently, eliminating the inner loop, this can be expressed as:: // -// Convert the input to an ndarray, but pass ndarray subclasses through. +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) // // Parameters // ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. // // Returns // ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. // // See Also // -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. +// apply_over_axes : Apply a function repeatedly over multiple axes. // -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. +// Examples +// -------- +// >>> import numpy as np +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) // -// If a scalar value is passed in. +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. // -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) // -// Notes -// ----- +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. // -// The behavior depends on the arguments in the following way. +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) // -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. // -// ``matmul`` differs from ``dot`` in two important ways: +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object // -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// Evenly round to the given number of decimals. // -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` +// for more details. // -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. // -// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. // -// Examples -// -------- -// For 2-D arrays it is the matrix product: +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc // -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) // -// For 2-D mixed with 1-D, the result is the usual. +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: // -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 // +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: // -// Broadcasting is conventional for stacks of arrays +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' // -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. // -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: // -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) // -// Scalar multiplication raises an error. // -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF // -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. +// Examples +// -------- +// >>> import numpy as np +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) // -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) // -// .. versionadded:: 1.10.0 // -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// Compute the bit-wise AND of two arrays element-wise. +// Compute hyperbolic tangent element-wise. // -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. // // Parameters // ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). +// x : array_like +// Input array. // out : ndarray, None, or tuple of ndarray and None, optional // A location into which the result is stored. If provided, it must have // a shape that the inputs broadcast to. If not provided or None, @@ -26253,148 +26506,234 @@ func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // // Returns // ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. // -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function // // Examples // -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: +// >>> import numpy as np +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) // -// >>> np.bitwise_and(13, 17) -// 1 +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True // -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object // -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. +// The differences between consecutive elements of an array. // -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. // -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// .. deprecated:: 2.0 +// Use :func:`isin` instead of `in1d` for new code. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. // -// Compute the Heaviside step function. +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. // -// The Heaviside step function is defined as:: +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. // -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. // -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. // -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. // -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. +// Examples +// -------- +// >>> import numpy as np +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) // -// Notes -// ----- -// .. versionadded:: 1.13.0 // -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object // -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) +// Find the sum of two polynomials. // -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. // -// Return the real part of the complex argument. +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. // // Parameters // ---------- -// val : array_like -// Input array. +// a1, a2 : array_like or poly1d object +// Input polynomials. // // Returns // ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. // // See Also // -------- -// real_if_close, imag, angle +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval // // Examples // -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 +// >>> import numpy as np +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 // // // -//go:linkname Real py.real -func Real(val *py.Object) *py.Object +//go:linkname Polyadd py.polyadd +func Polyadd(__llgo_va_list ...interface{}) *py.Object // // Kronecker product of two arrays. // @@ -26437,6 +26776,7 @@ func Real(val *py.Object) *py.Object // // Examples // -------- +// >>> import numpy as np // >>> np.kron([1,10,100], [5,6,7]) // array([ 5, 6, 7, ..., 500, 600, 700]) // >>> np.kron([5,6,7], [1,10,100]) @@ -26466,267 +26806,350 @@ func Real(val *py.Object) *py.Object //go:linkname Kron py.kron func Kron(a *py.Object, b *py.Object) *py.Object // -// Upper triangle of an array. +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() // -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. +// It is also possible to construct a 2-D histogram without specifying bin +// edges: // -// Please refer to the documentation for `tril` for further details. +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) // -// See Also -// -------- -// tril : lower triangle of an array +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. // -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() // -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() // +// >>> plt.show() // // -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object // -// The differences between consecutive elements of an array. +// An array with ones at and below the given diagonal and zeros elsewhere. // // Parameters // ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. // // Examples // -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) +// >>> import numpy as np +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) // +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) // // -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object // -// Returns the discrete, linear convolution of two one-dimensional sequences. +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object // -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. +// Returns True if first argument is a typecode lower/equal in type hierarchy. // -// If `v` is longer than `a`, the arrays are swapped before computation. +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. // // Parameters // ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one // // Returns // ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. +// out : bool // // See Also // -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. // -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: // -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False // -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True // -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: +// Similar types of different sizes are not subdtypes of each other: // -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False // -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: +// but both are subtypes of `floating`: // -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True // -// The two arrays are of the same length, so there -// is only one position where they completely overlap: +// For convenience, dtype-like objects are allowed too: // -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) +// >>> np.issubdtype('S1', np.bytes_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True // // // -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object // -// Return numbers spaced evenly on a log scale. +// Return evenly spaced numbers over a specified interval. // -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. // -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. +// The endpoint of the interval can optionally be excluded. // -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` // // Parameters // ---------- // start : array_like -// ``base ** start`` is the starting value of the sequence. +// The starting value of the sequence. // stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. // Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional // The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be +// is inferred from `start` and `stop`. The inferred dtype will never be // an integer; `float` is chosen even if the arguments would produce an // array of integers. // axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. // +// .. versionadded:: 2.0.0 // // Returns // ------- // samples : ndarray -// `num` samples, equally spaced on a log scale. +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// // // See Also // -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. // :ref:`how-to-partition` // -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// // Examples // -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// >>> import numpy as np +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) // // Graphical illustration: // // >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> N = 8 // >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) // >>> plt.plot(x1, y, 'o') // [] // >>> plt.plot(x2, y + 0.5, 'o') @@ -26737,305 +27160,429 @@ func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object // // // -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +//go:linkname Linspace py.linspace +func Linspace(__llgo_va_list ...interface{}) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) // -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// Divide arguments element-wise. // -// This is syntactic sugar for triu_indices(). +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. // -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. // -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. // -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. // +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. // -// See Also -// -------- -// triu_indices, triu, tril_indices_from +// Examples +// -------- +// >>> import numpy as np +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) // -// Notes -// ----- -// .. versionadded:: 1.4.0 +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. // +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) // +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object // -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// Return the Blackman window. // -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. // // Parameters // ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. // -// amax, fmax, maximum +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser // // Notes // ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. +// The Blackman window is defined as // -// If the input has a integer type the function is equivalent to np.min. +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. // // Examples // -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) // -// When positive infinity and negative infinity are present: +// Plot the window and the frequency response. // -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf +// .. plot:: +// :include-source: // +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.blackman(51) +// plt.plot(window) +// plt.title("Blackman window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() # doctest: +SKIP +// +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// with np.errstate(divide='ignore', invalid='ignore'): +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Blackman window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() // // -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object // -// Move axes of an array to new positions. +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object // -// Other axes remain in their original order. +// Return a tuple of coordinate matrices from coordinate vectors. // -// .. versionadded:: 1.11.0 +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. // // Parameters // ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be used with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. // // Returns // ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. +// X1, X2,..., XN : tuple of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. // // See Also // -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// :ref:`how-to-index` // // Examples // -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) +// >>> import numpy as np +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) // -// These all achieve the same result: +// The result of `meshgrid` is a coordinate grid: // -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. // +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True // +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() // -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object // -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) // -// .. versionadded:: 1.8.0 +// Create an array. // // Parameters // ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If ``True`` (default), then the array data is copied. If ``None``, +// a copy will only be made if ``__array__`` returns a copy, if obj is +// a nested sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). Note that any copy of +// the data is shallow, i.e., for arrays with object dtype, the new +// array will point to the same objects. See Examples for `ndarray.copy`. +// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. +// Default: ``True``. +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. // -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=None`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 // // Returns // ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. +// out : ndarray +// An array object satisfying the specified requirements. // // See Also // -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// copy: Return an array copy of the given object. +// // // Notes // ----- -// See `partition` for notes on the different selection algorithms. +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. // // Examples // -------- -// One dimensional array: +// >>> import numpy as np +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) // -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) +// Upcasting: // -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) // -// Multi-dimensional array: +// More than one dimension: // -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) // +// Minimum dimensions 2: // +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) // -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// Type provided: // -// Compute the truth value of x1 OR x2 element-wise. +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3], dtype=int32) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.asmatrix('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.asmatrix('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Multiply arguments element-wise. // // Parameters // ---------- // x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. +// Input arrays to be multiplied. // If ``x1.shape != x2.shape``, they must be broadcastable to a common // shape (which becomes the shape of the output). // out : ndarray, None, or tuple of ndarray and None, optional @@ -27056,145 +27603,108 @@ func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object // // Returns // ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. +// y : ndarray +// The product of `x1` and `x2`, element-wise. // This is a scalar if both `x1` and `x2` are scalars. // -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. // // Examples // -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) +// >>> import numpy as np +// >>> np.multiply(2.0, 4.0) +// 8.0 // -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) // -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. // -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) // -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object // -// einsum_path(subscripts, *operands, optimize='greedy') +// Set the size of the buffer used in ufuncs. // -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. +// .. versionchanged:: 2.0 +// The scope of setting the buffer is tied to the `numpy.errstate` +// context. Exiting a ``with errstate():`` will also restore the bufsize. // // Parameters // ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. +// size : int +// Size of buffer. // // Returns // ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot +// bufsize : int +// Previous size of ufunc buffer in bytes. // // Examples // -------- +// When exiting a `numpy.errstate` context manager the bufsize is restored: // -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. +// >>> import numpy as np +// >>> with np.errstate(): +// ... np.setbufsize(4096) +// ... print(np.getbufsize()) +// ... +// 8192 +// 4096 +// >>> np.getbufsize() +// 8192 // -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il // // -// A more complex index transformation example. +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object // -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') +// Return the number of elements along a given axis. // -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. // +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. // -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object From e03fc4126c9ca2b2c64a0de9f484490d4496fdce Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Sat, 16 Aug 2025 02:08:07 +0800 Subject: [PATCH 49/88] Release-as: numpy/v1.26.4 --- .github/workflows/verification.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index cb894fa3..8b5b7aab 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -156,3 +156,19 @@ jobs: # env: # LLPKG_PATH: ${{ env.LLPKG_PATH }} # run: llpkgstore demotest + - name: Create Git tag + run: | + echo "Creating Git tag: numpy/v0.1.0" + + # Configure git user for tag creation + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + + # Create the tag + git tag "numpy/v0.1.0" + + # Push the tag to remote repository + echo "Pushing tag to remote repository..." + git push origin "numpy/v0.1.0" + + echo "✅ Git tag numpy/v0.1.0 created and pushed successfully" \ No newline at end of file From e2f85c116811776b5c931720492f054a41b46cb5 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Sat, 16 Aug 2025 02:11:32 +0800 Subject: [PATCH 50/88] del --- numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpyg.cfg | 8 - numpy/numpy.go | 27710 ---------------------------------------------- 4 files changed, 27725 deletions(-) delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 8ce9049a..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/PengPengPeng717/llpkg/numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 932c66b2..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "libVersion": "2.3.2", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 9f86641a..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27710 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// Compute the q-th quantile of the data along the specified axis. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities of the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// The recommended options, numbered as they appear in [1]_, are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. For backward compatibility -// with previous versions of NumPy, the following discontinuous variations -// of the default 'linear' (7.) option are available: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// See Notes for details. -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the quantile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// See the notes for more details. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis -// of the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a sample `a` from an underlying distribution, `quantile` provides a -// nonparametric estimate of the inverse cumulative distribution function. -// -// By default, this is done by interpolating between adjacent elements in -// ``y``, a sorted copy of `a`:: -// -// (1-g)*y[j] + g*y[j+1] -// -// where the index ``j`` and coefficient ``g`` are the integral and -// fractional components of ``q * (n-1)``, and ``n`` is the number of -// elements in the sample. -// -// This is a special case of Equation 1 of H&F [1]_. More generally, -// -// - ``j = (q*n + m - 1) // 1``, and -// - ``g = (q*n + m - 1) % 1``, -// -// where ``m`` may be defined according to several different conventions. -// The preferred convention may be selected using the ``method`` parameter: -// -// =============================== =============== =============== -// ``method`` number in H&F ``m`` -// =============================== =============== =============== -// ``interpolated_inverted_cdf`` 4 ``0`` -// ``hazen`` 5 ``1/2`` -// ``weibull`` 6 ``q`` -// ``linear`` (default) 7 ``1 - q`` -// ``median_unbiased`` 8 ``q/3 + 1/3`` -// ``normal_unbiased`` 9 ``q/4 + 3/8`` -// =============================== =============== =============== -// -// Note that indices ``j`` and ``j + 1`` are clipped to the range ``0`` to -// ``n - 1`` when the results of the formula would be outside the allowed -// range of non-negative indices. The ``- 1`` in the formulas for ``j`` and -// ``g`` accounts for Python's 0-based indexing. -// -// The table above includes only the estimators from H&F that are continuous -// functions of probability `q` (estimators 4-9). NumPy also provides the -// three discontinuous estimators from H&F (estimators 1-3), where ``j`` is -// defined as above, ``m`` is defined as follows, and ``g`` is a function -// of the real-valued ``index = q*n + m - 1`` and ``j``. -// -// 1. ``inverted_cdf``: ``m = 0`` and ``g = int(index - j > 0)`` -// 2. ``averaged_inverted_cdf``: ``m = 0`` and -// ``g = (1 + int(index - j > 0)) / 2`` -// 3. ``closest_observation``: ``m = -1/2`` and -// ``g = 1 - int((index == j) & (j%2 == 1))`` -// -// For backward compatibility with previous versions of NumPy, `quantile` -// provides four additional discontinuous estimators. Like -// ``method='linear'``, all have ``m = 1 - q`` so that ``j = q*(n-1) // 1``, -// but ``g`` is defined as follows. -// -// - ``lower``: ``g = 0`` -// - ``midpoint``: ``g = 0.5`` -// - ``higher``: ``g = 1`` -// - ``nearest``: ``g = (q*(n-1) % 1) > 0.5`` -// -// **Weighted quantiles:** -// More formally, the quantile at probability level :math:`q` of a cumulative -// distribution function :math:`F(y)=P(Y \leq y)` with probability measure -// :math:`P` is defined as any number :math:`x` that fulfills the -// *coverage conditions* -// -// .. math:: P(Y < x) \leq q \quad\text{and}\quad P(Y \leq x) \geq q -// -// with random variable :math:`Y\sim P`. -// Sample quantiles, the result of `quantile`, provide nonparametric -// estimation of the underlying population counterparts, represented by the -// unknown :math:`F`, given a data vector `a` of length ``n``. -// -// Some of the estimators above arise when one considers :math:`F` as the -// empirical distribution function of the data, i.e. -// :math:`F(y) = \frac{1}{n} \sum_i 1_{a_i \leq y}`. -// Then, different methods correspond to different choices of :math:`x` that -// fulfill the above coverage conditions. Methods that follow this approach -// are ``inverted_cdf`` and ``averaged_inverted_cdf``. -// -// For weighted quantiles, the coverage conditions still hold. The -// empirical cumulative distribution is simply replaced by its weighted -// version, i.e. -// :math:`P(Y \leq t) = \frac{1}{\sum_i w_i} \sum_i w_i 1_{x_i \leq t}`. -// Only ``method="inverted_cdf"`` supports weights. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> import numpy as np -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// .. versionadded:: 2.0.0 -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapezoid : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// >>> import numpy as np -// -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapezoid([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapezoid([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapezoid([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapezoid([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapezoid(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapezoid(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapezoid`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapezoid(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapezoid(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapezoid py.trapezoid -func Trapezoid(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> import numpy as np -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) # doctest: +SKIP -// array([nan, 1., 1.]) -// RuntimeWarning: invalid value encountered in divide -// -// >>> oldsettings = np.seterr(all='warn', invalid='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'warn', 'invalid': 'raise'} -// >>> np.arange(3.) / np.arange(3.) -// Traceback (most recent call last): -// ... -// FloatingPointError: invalid value encountered in divide -// >>> oldsettings = np.seterr(**oldsettings) # restore original -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : {int, float}, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. See notes for details about use of `ddof`. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// mean : array like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this var function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// There are several common variants of the array variance calculation. -// Assuming the input `a` is a one-dimensional NumPy array and ``mean`` is -// either provided as an argument or computed as ``a.mean()``, NumPy -// computes the variance of an array as:: -// -// N = len(a) -// d2 = abs(a - mean)**2 # abs is for complex `a` -// var = d2.sum() / (N - ddof) # note use of `ddof` -// -// Different values of the argument `ddof` are useful in different -// contexts. NumPy's default ``ddof=0`` corresponds with the expression: -// -// .. math:: -// -// \frac{\sum_i{|a_i - \bar{a}|^2 }}{N} -// -// which is sometimes called the "population variance" in the field of -// statistics because it applies the definition of variance to `a` as if `a` -// were a complete population of possible observations. -// -// Many other libraries define the variance of an array differently, e.g.: -// -// .. math:: -// -// \frac{\sum_i{|a_i - \bar{a}|^2}}{N - 1} -// -// In statistics, the resulting quantity is sometimes called the "sample -// variance" because if `a` is a random sample from a larger population, -// this calculation provides an unbiased estimate of the variance of the -// population. The use of :math:`N-1` in the denominator is often called -// "Bessel's correction" because it corrects for bias (toward lower values) -// in the variance estimate introduced when the sample mean of `a` is used -// in place of the true mean of the population. For this quantity, use -// ``ddof=1``. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// np.float32(0.20250003) -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// Using the mean keyword to save computation time: -// -// >>> import numpy as np -// >>> from timeit import timeit -// >>> -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> mean = np.mean(a, axis=1, keepdims=True) -// >>> -// >>> g = globals() -// >>> n = 10000 -// >>> t1 = timeit("var = np.var(a, axis=1, mean=mean)", globals=g, number=n) -// >>> t2 = timeit("var = np.var(a, axis=1)", globals=g, number=n) -// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') -// #doctest: +SKIP -// Percentage execution time saved 32% -// -// -// -//go:linkname Var py.var -func Var(__llgo_va_list ...interface{}) *py.Object -// -// Returns the unique elements of an input array `x`. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, equal_nan=False, sorted=False) -// -// .. versionchanged:: 2.3 -// The algorithm was changed to a faster one that does not rely on -// sorting, and hence the results are no longer implicitly sorted. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : ndarray -// The unique elements of an input array. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.unique_values([1, 1, 2]) -// array([1, 2]) # may vary -// -// -// -//go:linkname UniqueValues py.unique_values -func UniqueValues(x *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// np.uint8(255) -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// np.float64(nan) -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a 4 by 4 array -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// >>> import numpy as np -// -// Convert a list into an array. If all elements are finite, then -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The row and column indices, respectively. The row indices are sorted -// in non-decreasing order, and the correspdonding column indices are -// strictly increasing for each row. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Examples -// -------- -// >>> import numpy as np -// -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il1 -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Note that row indices (first array) are non-decreasing, and the corresponding -// column indices (second array) are strictly increasing for each row. -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> il2 = np.tril_indices(4, 2) -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> import numpy as np -// -// Beginning with an array of integers from 0 to 5 (inclusive), -// elements less than ``3`` are negated, elements greater than ``3`` -// are squared, and elements not meeting either of these conditions -// (exactly ``3``) are replaced with a `default` value of ``42``. -// -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [-x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, -1, -2, 42, 16, 25]) -// -// When multiple conditions are satisfied, the first one encountered in -// `condlist` is used. -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. If both ``a_min`` and ``a_max`` are ``None``, -// the elements of the returned array stay the same. Both are broadcasted -// against ``a``. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// min, max : array_like or None -// Array API compatible alternatives for ``a_min`` and ``a_max`` -// arguments. Either ``a_min`` and ``a_max`` or ``min`` and ``max`` -// can be passed at the same time. Default: ``None``. -// -// .. versionadded:: 2.1.0 -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, -// in general, the actual implementation will vary with data type. -// The 'mergesort' option is retained for backwards compatibility. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// stable : bool, optional -// Sort stability. If ``True``, the returned array will maintain -// the relative order of ``a`` values which compare as equal. -// If ``False`` or ``None``, this is not guaranteed. Internally, -// this option selects ``kind='stable'``. Default: ``None``. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// For performance, ``sort`` makes a temporary copy if needed to make the data -// `contiguous `_ -// in memory along the sort axis. For even better performance and reduced -// memory consumption, ensure that the array is already contiguous along the -// sort axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// quicksort has been changed to: -// `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt -// `_ -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. -// Radix sort is an O(n) sort instead of O(n log n). -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> import numpy as np -// -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.asmatrix('1 1; 1 1') -// >>> B = np.asmatrix('2 2; 2 2') -// >>> C = np.asmatrix('3 4; 5 6') -// >>> D = np.asmatrix('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// -// .. versionchanged:: 2.0 -// The sign parameter can now be an integer type, previously -// types were floating-point types. -// -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> import numpy as np -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// Split an array into a sequence of arrays along the given axis. -// -// The ``axis`` parameter specifies the dimension along which the array will -// be split. For example, if ``axis=0`` (the default) it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// The result is a tuple of arrays split along ``axis``. -// -// .. versionadded:: 2.1.0 -// -// Parameters -// ---------- -// x : ndarray -// The array to be unstacked. -// axis : int, optional -// Axis along which the array will be split. Default: ``0``. -// -// Returns -// ------- -// unstacked : tuple of ndarrays -// The unstacked arrays. -// -// See Also -// -------- -// stack : Join a sequence of arrays along a new axis. -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Notes -// ----- -// ``unstack`` serves as the reverse operation of :py:func:`stack`, i.e., -// ``stack(unstack(x, axis=axis), axis=axis) == x``. -// -// This function is equivalent to ``tuple(np.moveaxis(x, axis, 0))``, since -// iterating on an array iterates along the first axis. -// -// Examples -// -------- -// >>> arr = np.arange(24).reshape((2, 3, 4)) -// >>> np.unstack(arr) -// (array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]), -// array([[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]])) -// >>> np.unstack(arr, axis=1) -// (array([[ 0, 1, 2, 3], -// [12, 13, 14, 15]]), -// array([[ 4, 5, 6, 7], -// [16, 17, 18, 19]]), -// array([[ 8, 9, 10, 11], -// [20, 21, 22, 23]])) -// >>> arr2 = np.stack(np.unstack(arr, axis=1), axis=1) -// >>> arr2.shape -// (2, 3, 4) -// >>> np.all(arr == arr2) -// np.True_ -// -// -// -//go:linkname Unstack py.unstack -func Unstack(x *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. In the case of a single -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default, -// axis=None, will compute the median along a flattened version of -// the array. If a sequence of axes, the array is first flattened -// along the given axes, then the median is computed along the -// resulting flattened axis. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// np.float64(3.5) -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> np.median(a, axis=(0, 1)) -// np.float64(3.5) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// np.float64(3.5) -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will -// use the method chosen to calculate the optimal bin width and -// consequently the number of bins (see the Notes section for more detail -// on the estimators) from the data that falls within the requested range. -// While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Minimum bin width between the 'sturges' and 'fd' estimators. -// Provides good all-around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (minimum bin width of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Additionally, if the data is of integer dtype, then the binwidth will never -// be less than 1. -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. In the case of a single -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the bit-wise NOT of the absolute value is -// returned. In a two's-complement system, this operation effectively flips -// all the bits, resulting in a representation that corresponds to the -// negative of the input plus one. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range :math:`-2^{N-1}` to -// :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// ``numpy.bitwise_not`` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> import numpy as np -// -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// np.uint8(242) -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// np.uint16(65522) -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types, the result is the bit-wise NOT of -// the unsigned type, interpreted as a signed integer: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseInvert py.bitwise_invert -func BitwiseInvert(__llgo_va_list ...interface{}) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> orig_settings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// >>> old_settings = np.seterr(**orig_settings) # restore original -// >>> old_handler = np.seterrcall(None) # restore original -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// Parameters -// ---------- -// arrays : sequence of ndarrays -// Each array must have the same shape. In the case of a single ndarray -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> rng = np.random.default_rng() -// >>> arrays = [rng.normal(size=(3,4)) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int, array-like of ints or bools -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionchanged:: 2.1.2 -// Boolean indices are now treated as a mask of elements to insert, -// rather than being cast to the integers 0 and 1. -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. This is because of the difference between basic -// and advanced :ref:`indexing `. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(6).reshape(3, 2) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.insert(a, 1, 6) -// array([0, 6, 1, 2, 3, 4, 5]) -// >>> np.insert(a, 1, 6, axis=1) -// array([[0, 6, 1], -// [2, 6, 3], -// [4, 6, 5]]) -// -// Difference between sequence and scalars, -// showing how ``obj=[1]`` behaves different from ``obj=1``: -// -// >>> np.insert(a, [1], [[7],[8],[9]], axis=1) -// array([[0, 7, 1], -// [2, 8, 3], -// [4, 9, 5]]) -// >>> np.insert(a, 1, [[7],[8],[9]], axis=1) -// array([[0, 7, 8, 9, 1], -// [2, 7, 8, 9, 3], -// [4, 7, 8, 9, 5]]) -// >>> np.array_equal(np.insert(a, 1, [7, 8, 9], axis=1), -// ... np.insert(a, [1], [[7],[8],[9]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([0, 1, 2, 3, 4, 5]) -// >>> np.insert(b, [2, 2], [6, 7]) -// array([0, 1, 6, 7, 2, 3, 4, 5]) -// -// >>> np.insert(b, slice(2, 4), [7, 8]) -// array([0, 1, 7, 2, 8, 3, 4, 5]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([0, 1, 7, 0, 2, 3, 4, 5]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, -// a ``.npy`` extension will be appended to the filename if it does not -// already have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for -// disallowing pickles include security (loading pickled data can execute -// arbitrary code) and portability (pickled objects may not be loadable -// on different Python installations, for example if the stored objects -// require libraries that are not available, and not all pickled data is -// compatible between different versions of Python). -// Default: True -// fix_imports : bool, optional -// The `fix_imports` flag is deprecated and has no effect. -// -// .. deprecated:: 2.1 -// This flag is ignored since NumPy 1.17 and was only needed to -// support loading in Python 2 some files written in Python 3. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(__llgo_va_list ...interface{}) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> import numpy as np -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(__llgo_va_list ...interface{}) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// >>> import numpy as np -// -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to zero or a positive integer. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=-1 (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=0 -// Only the memory bounds of a and b are checked. -// This is equivalent to using ``may_share_memory()``. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided( -// ... x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided( -// ... x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// busday_offset( -// dates, -// offsets, -// roll='raise', -// weekmask='1111100', -// holidays=None, -// busdaycal=None, -// out=None -// ) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> import numpy as np -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// np.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// np.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// np.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// np.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// np.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// np.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// np.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// np.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for -// disallowing pickles include security (loading pickled data can execute -// arbitrary code) and portability (pickled objects may not be loadable -// on different Python installations, for example if the stored objects -// require libraries that are not available, and not all pickled data is -// compatible between different versions of Python). -// Default: True -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` -// object is returned. This is a dictionary-like object which can be queried -// for its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(__llgo_va_list ...interface{}) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// >>> import numpy as np -// -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Pow py.pow -func Pow(__llgo_va_list ...interface{}) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// -// .. versionchanged:: 2.0 -// The sign parameter can now be an integer type, previously -// types were floating-point types. -// -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string ``'1.21'`` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to ``'1.25'`` approximates printing of 1.25 which mainly means -// that numeric scalars are printed without their type information, e.g. -// as ``3.0`` rather than ``np.float64(3.0)``. -// -// If set to ``'2.1'``, shape information is not given when arrays are -// summarized (i.e., multiple elements replaced with ``...``). -// -// If set to ``'2.2'``, the transition to use scientific notation for -// printing ``np.float16`` and ``np.float32`` types may happen later or -// not at all for larger values. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionchanged:: 1.22.0 -// .. versionchanged:: 2.2 -// -// override_repr: callable, optional -// If set a passed function will be used for generating arrays' repr. -// Other options will be ignored. -// -// See Also -// -------- -// get_printoptions, printoptions, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> import numpy as np -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9], shape=(10,)) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` -// as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ], shape=(10,)) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// >>> import numpy as np -// -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Acosh py.acosh -func Acosh(__llgo_va_list ...interface{}) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// -// Consider four points in different quadrants: -// -// >>> import numpy as np -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Atan2 py.atan2 -func Atan2(__llgo_va_list ...interface{}) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> import numpy as np -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Determine if a provided dtype is of a specified data type ``kind``. -// -// This function only supports built-in NumPy's data types. -// Third-party dtypes are not yet supported. -// -// Parameters -// ---------- -// dtype : dtype -// The input dtype. -// kind : dtype or str or tuple of dtypes/strs. -// dtype or dtype kind. Allowed dtype kinds are: -// * ``'bool'`` : boolean kind -// * ``'signed integer'`` : signed integer data types -// * ``'unsigned integer'`` : unsigned integer data types -// * ``'integral'`` : integer data types -// * ``'real floating'`` : real-valued floating-point data types -// * ``'complex floating'`` : complex floating-point data types -// * ``'numeric'`` : numeric data types -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// issubdtype -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isdtype(np.float32, np.float64) -// False -// >>> np.isdtype(np.float32, "real floating") -// True -// >>> np.isdtype(np.complex128, ("real floating", "complex floating")) -// True -// -// -// -//go:linkname Isdtype py.isdtype -func Isdtype(dtype *py.Object, kind *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> rng = np.random.default_rng() -// >>> A = rng.normal(size=(2,3,5)) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// stable : bool, optional -// Sort stability. If ``True``, the returned array will maintain -// the relative order of ``a`` values which compare as equal. -// If ``False`` or ``None``, this is not guaranteed. Internally, -// this option selects ``kind='stable'``. Default: ``None``. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> import numpy as np -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> np.array_equal([1, 2], [1, 2]) -// True -// -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// -// >>> np.array_equal([1, 2], [1, 4]) -// False -// -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// with magnitudes much smaller than one (see Notes). -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : array_like -// The relative tolerance parameter (see Notes). -// atol : array_like -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True.:: -// -// absolute(a - b) <= (atol + rtol * absolute(b)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The default value of `atol` is not appropriate when the reference value -// `b` has magnitude smaller than one. For example, it is unlikely that -// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet -// ``allclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure -// to select `atol` for the use case at hand, especially for defining the -// threshold below which a non-zero value in `a` will be considered "close" -// to a very small or zero value in `b`. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> import numpy as np -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// The copy made of the data is shallow, i.e., for arrays with object dtype, -// the new array will point to the same objects. -// See Examples from `ndarray.copy`. -// -// Examples -// -------- -// >>> import numpy as np -// -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, device=None, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname BitwiseLeftShift py.bitwise_left_shift -func BitwiseLeftShift(__llgo_va_list ...interface{}) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` -// for more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// cumulative_sum : Array API compatible alternative for ``cumsum``. -// sum : Sum array elements. -// trapezoid : Integration of array values using composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, respectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// linalg.outer : An Array API compatible variation of ``np.outer``, -// which accepts 1-dimensional inputs only. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> import numpy as np -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// >>> a = np.array([1, 2], dtype=int) -// >>> c = np.append(a, []) -// >>> c -// array([1., 2.]) -// >>> c.dtype -// float64 -// -// Default dtype for empty ndarrays is `float64` thus making the output of dtype -// `float64` when appended with dtype `int64` -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : {int, float}, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// mean : array_like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this var function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einsum: -// Similar verbose interface is provided by the -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// The `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` -// :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` -// :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, -// :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, -// :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` -// produces a view of ``a`` with no changes. A further example -// ``np.einsum('ij,jk', a, b)`` describes traditional matrix multiplication -// and is equivalent to :py:func:`np.matmul(a,b) `. -// Repeated subscript labels in one operand take the diagonal. -// For example, ``np.einsum('ii', a)`` is equivalent to -// :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a) ` -// if ``a`` is a 1-D array, and ``np.einsum('ii->i', a)`` -// is like :py:func:`np.diag(a) ` if ``a`` is a square 2-D array. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// ``np.einsum('...i->...', a)`` is like -// :py:func:`np.sum(a, axis=-1) ` for array ``a`` of any shape. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts and -// operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands -// this can greatly increase the computational efficiency at the cost of -// a larger memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive -// search. For iterative calculations it may be advisable to calculate -// the optimal path once and reuse that path by supplying it as an argument. -// An example is given below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done -// with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing -// the 'optimal' path and repeatedly applying it, using an `einsum_path` -// insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, -// ... optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, -// ... optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// >>> import numpy as np -// -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// Please note that the ``dtype`` of `weights` will also become the -// ``dtype`` of the returned accumulator (`hist`), so it must be -// large enough to hold accumulated values as well. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. If `weights` are given, -// ``hist.dtype`` will be taken from `weights`. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// import numpy as np -// -// rng = np.random.RandomState(10) # deterministic random data -// a = np.hstack((rng.normal(size=1000), -// rng.normal(loc=5, scale=2, size=1000))) -// plt.hist(a, bins='auto') # arguments are passed to np.histogram -// plt.title("Histogram with 'auto' bins") -// plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// values ``a[i, ..., i]`` with indices ``i`` all identical. This function -// modifies the input array in-place without returning a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled in-place. -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez_compressed(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., -// ``savez_compressed(fn, x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for -// disallowing pickles include security (loading pickled data can execute -// arbitrary code) and portability (pickled objects may not be loadable -// on different Python installations, for example if the stored objects -// require libraries that are not available, and not all pickled data is -// compatible between different versions of Python). -// Default: True -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` -// object is returned. This is a dictionary-like object which can be queried -// for its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> import numpy as np -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(__llgo_va_list ...interface{}) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> import numpy as np -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(__llgo_va_list ...interface{}) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.1.0 -// -// copy : bool, optional -// If ``True``, then the object is copied. If ``None`` then the object is -// copied only if needed, i.e. if ``__array__`` returns a copy, if obj -// is a nested sequence, or if a copy is needed to satisfy any of -// the other requirements (``dtype``, ``order``, etc.). -// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. -// Default: ``None``. -// -// .. versionadded:: 2.1.0 -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> import numpy as np -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or tuple of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// (array([1]), array([3, 4])) -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(-np.inf) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> import numpy as np -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// -// Compute tensor dot product along specified axes. -// -// Given two tensors, `a` and `b`, and an array_like object containing -// two array_like objects, ``(a_axes, b_axes)``, sum the products of -// `a`'s and `b`'s elements (components) over the axes specified by -// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative -// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions -// of `a` and the first ``N`` dimensions of `b` are summed over. -// -// Parameters -// ---------- -// a, b : array_like -// Tensors to "dot". -// -// axes : int or (2,) array_like -// * integer_like -// If an int N, sum over the last N axes of `a` and the first N axes -// of `b` in order. The sizes of the corresponding axes must match. -// * (2,) array_like -// Or, a list of axes to be summed over, first sequence applying to `a`, -// second to `b`. Both elements array_like must be of the same length. -// -// Returns -// ------- -// output : ndarray -// The tensor dot product of the input. -// -// See Also -// -------- -// dot, einsum -// -// Notes -// ----- -// Three common use cases are: -// * ``axes = 0`` : tensor product :math:`a\otimes b` -// * ``axes = 1`` : tensor dot product :math:`a\cdot b` -// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` -// -// When `axes` is integer_like, the sequence of axes for evaluation -// will be: from the -Nth axis to the -1th axis in `a`, -// and from the 0th axis to (N-1)th axis in `b`. -// For example, ``axes = 2`` is the equal to -// ``axes = [[-2, -1], [0, 1]]``. -// When N-1 is smaller than 0, or when -N is larger than -1, -// the element of `a` and `b` are defined as the `axes`. -// -// When there is more than one axis to sum over - and they are not the last -// (first) axes of `a` (`b`) - the argument `axes` should consist of -// two sequences of the same length, with the first axis to sum over given -// first in both sequences, the second axis second, and so forth. -// The calculation can be referred to ``numpy.einsum``. -// -// The shape of the result consists of the non-contracted axes of the -// first tensor, followed by the non-contracted axes of the second. -// -// Examples -// -------- -// An example on integer_like: -// -// >>> a_0 = np.array([[1, 2], [3, 4]]) -// >>> b_0 = np.array([[5, 6], [7, 8]]) -// >>> c_0 = np.tensordot(a_0, b_0, axes=0) -// >>> c_0.shape -// (2, 2, 2, 2) -// >>> c_0 -// array([[[[ 5, 6], -// [ 7, 8]], -// [[10, 12], -// [14, 16]]], -// [[[15, 18], -// [21, 24]], -// [[20, 24], -// [28, 32]]]]) -// -// An example on array_like: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// A slower but equivalent way of computing the same... -// -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as ``a.shape`` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as ``a.shape``. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), -// ... axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> import numpy as np -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// np.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -//go:linkname Subtract py.subtract -func Subtract(__llgo_va_list ...interface{}) *py.Object -// -// Find the unique elements of `x` and indices to reconstruct `x`. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, return_inverse=True, equal_nan=False, sorted=False) -// -// but returns a namedtuple for easier access to each output. -// -// .. note:: -// This function currently always returns a sorted result, however, -// this could change in any NumPy minor release. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : namedtuple -// The result containing: -// -// * values - The unique elements of an input array. -// * inverse_indices - The indices from the set of unique elements -// that reconstruct `x`. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = [1, 1, 2] -// >>> uniq = np.unique_inverse(x) -// >>> uniq.values -// array([1, 2]) -// >>> uniq.inverse_indices -// array([0, 0, 1]) -// -// -//go:linkname UniqueInverse py.unique_inverse -func UniqueInverse(x *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.hamming(51) -// plt.plot(window) -// plt.title("Hamming window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Hamming window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. If this -// is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// .. versionchanged:: 2.0 -// Before NumPy 2.0, ``any`` did not return booleans for object dtype -// input arrays. -// This behavior is still available via ``np.logical_or.reduce``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False, True ], -// ... [False, False, False]], axis=0) -// array([ True, False, True]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any([[np.nan], [np.inf]], axis=1, keepdims=True) -// array([[ True], -// [ True]]) -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> a = np.array([[1, 0, 0], -// ... [0, 0, 1], -// ... [0, 0, 0]]) -// >>> np.any(a, axis=0) -// array([ True, False, True]) -// >>> np.any(a, axis=1) -// array([ True, True, False]) -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// vecmat(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) -// -// Vector-matrix dot product of two arrays. -// -// Given a vector (or stack of vector) :math:`\mathbf{v}` in ``x1`` and -// a matrix (or stack of matrices) :math:`\mathbf{A}` in ``x2``, the -// vector-matrix product is defined as: -// -// .. math:: -// \mathbf{b} \cdot \mathbf{A} = \sum_{i=0}^{n-1} \overline{v_i}A_{ij} -// -// where the sum is over the last dimension of ``x1`` and the one-but-last -// dimensions in ``x2`` (unless `axes` is specified) and where -// :math:`\overline{v_i}` denotes the complex conjugate if :math:`v` -// is complex and the identity otherwise. (For a non-conjugated vector-matrix -// product, use ``np.matvec(x2.mT, x1)``.) -// -// .. versionadded:: 2.2.0 -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// the broadcasted shape of ``x1`` and ``x2`` with the summation axis -// removed. If not provided or None, a freshly-allocated array is used. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The vector-matrix product of the inputs. -// -// Raises -// ------ -// ValueError -// If the last dimensions of ``x1`` and the one-but-last dimension of -// ``x2`` are not the same size. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vecdot : Vector-vector product. -// matvec : Matrix-vector product. -// matmul : Matrix-matrix product. -// einsum : Einstein summation convention. -// -// Examples -// -------- -// Project a vector along X and Y. -// -// >>> v = np.array([0., 4., 2.]) -// >>> a = np.array([[1., 0., 0.], -// ... [0., 1., 0.], -// ... [0., 0., 0.]]) -// >>> np.vecmat(v, a) -// array([ 0., 4., 0.]) -// -//go:linkname Vecmat py.vecmat -func Vecmat(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> import numpy as np -// -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arccos py.arccos -func Arccos(x *py.Object, out *py.Object) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> import numpy as np -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// This function is an Array API compatible alternative to `numpy.cumsum`. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is only allowed for one-dimensional arrays. For arrays -// with more than one dimension ``axis`` is required. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If ``dtype`` is not specified, it defaults -// to the dtype of ``x``, unless ``x`` has an integer dtype with -// a precision less than that of the default platform integer. -// In that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` -// for more details. -// include_initial : bool, optional -// Boolean indicating whether to include the initial value (zeros) as -// the first value in the output. With ``include_initial=True`` -// the shape of the output is different than the shape of the input. -// Default: ``False``. -// -// Returns -// ------- -// cumulative_sum_along_axis : ndarray -// A new array holding the result is returned unless ``out`` is -// specified, in which case a reference to ``out`` is returned. The -// result has the same shape as ``x`` if ``include_initial=False``. -// -// See Also -// -------- -// sum : Sum array elements. -// trapezoid : Integration of array values using composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumulative_sum(a)[-1]`` may not be equal to ``sum(a)`` for -// floating-point values since ``sum`` may use a pairwise summation routine, -// reducing the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 4, 5, 6]) -// >>> a -// array([1, 2, 3, 4, 5, 6]) -// >>> np.cumulative_sum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumulative_sum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumulative_sum(b,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumulative_sum(b,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumulative_sum(c)[-1]`` may not be equal to ``sum(c)`` -// -// >>> c = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> np.cumulative_sum(c)[-1] -// 1000000.0050045159 -// >>> c.sum() -// 1000000.0050000029 -// -// -// -//go:linkname CumulativeSum py.cumulative_sum -func CumulativeSum(x *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this -// many digits. If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The `vdot` function handles complex numbers differently than `dot`: -// if the first argument is complex, it is replaced by its complex conjugate -// in the dot product calculation. `vdot` also handles multidimensional -// arrays differently than `dot`: it does not perform a matrix product, but -// flattens the arguments to 1-D arrays before taking a vector dot product. -// -// Consequently, when the arguments are 2-D arrays of the same shape, this -// function effectively returns their -// `Frobenius inner product `_ -// (also known as the *trace inner product* or the *standard inner product* -// on a vector space of matrices). -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// >>> import numpy as np -// -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return element-wise quotient and remainder simultaneously. -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 > x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// -// See Also -// -------- -// greater_equal, less, less_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.greater([4,2],[2,2]) -// array([ True, False]) -// -// The ``>`` operator can be used as a shorthand for ``np.greater`` on -// ndarrays. -// -// >>> a = np.array([4, 2]) -// >>> b = np.array([2, 2]) -// >>> a > b -// array([ True, False]) -// -//go:linkname Greater py.greater -func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> import numpy as np -// -// >>> orig_handler = np.seterrcall(err_handler) -// >>> orig_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(orig_handler) -// -// >>> np.seterr(**orig_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(orig_handler) -// -// >>> np.seterr(**orig_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. Any content before the comment delimiter is -// discarded. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field -// names in a structured dtype. If `names` is None, the names of the -// dtype fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` -// is a file object. The special value 'bytes' enables backward -// compatibility workarounds that ensure that you receive byte arrays -// when possible and passes latin1 encoded strings to converters. -// Override this value to receive unicode arrays and pass strings -// as input to converters. If set to None the system default is used. -// The default value is 'bytes'. -// -// .. versionchanged:: 2.0 -// Before NumPy 2, the default was ``'bytes'`` for Python 2 -// compatibility. The default is now ``None``. -// -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When variables are named (either by a flexible dtype or with a `names` -// sequence), there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// * Custom converters may receive unexpected values due to dtype -// discovery. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO("1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, 'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO("11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, 'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> import numpy as np -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Numerical positive, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `element` and `test_elements`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `element` plus the max-min value of `test_elements`. -// `assume_unique` has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `element` and `test_elements`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// Notes -// ----- -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(test_elements)) > -// (log10(max(test_elements)-min(test_elements)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// Examples -// -------- -// >>> import numpy as np -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// `axis=None`, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The array of weights must be the same shape as `a` if no axis is -// specified, otherwise the weights must have dimensions and shape -// consistent with `a` along the specified axis. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// The calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// where the sum is over all included elements. -// The only constraint on the values of `weights` is that `sum(weights)` -// must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a general pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When `weights` does not have the same shape as `a`, and `axis=None`. -// ValueError -// When `weights` does not have dimensions and shape consistent with `a` -// along specified `axis`. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> import numpy as np -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// >>> data = np.arange(8).reshape((2, 2, 2)) -// >>> data -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.average(data, axis=(0, 1), weights=[[1./4, 3./4], [1., 1./2]]) -// array([3.4, 4.4]) -// >>> np.average(data, axis=0, weights=[[1./4, 3./4], [1., 1./2]]) -// Traceback (most recent call last): -// ... -// ValueError: Shape of weights must be consistent -// with shape of a along specified axis. -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the percentile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// The behavior of `numpy.nanpercentile` with percentage `q` is that of -// `numpy.quantile` with argument ``q/100`` (ignoring nan values). -// For more information, please see `numpy.quantile`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// np.float64(nan) -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is None. -// -// .. versionchanged:: 2.0 -// Before NumPy 2, the default was ``'bytes'`` for Python 2 -// compatibility. The default is now ``None``. -// -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith("-") else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats, such as hex values: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Or a format where the ``-`` sign comes after the number: -// -// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") -// >>> conv = lambda x: -float(x[:-1]) if x.endswith("-") else float(x) -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// bitwise_count(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Computes the number of 1-bits in the absolute value of ``x``. -// Analogous to the builtin `int.bit_count` or ``popcount`` in C++. -// -// Parameters -// ---------- -// x : array_like, unsigned int -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding number of 1-bits in the input. -// Returns uint8 for all integer types -// This is a scalar if `x` is a scalar. -// -// References -// ---------- -// .. [1] https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel -// -// .. [2] Wikipedia, "Hamming weight", -// https://en.wikipedia.org/wiki/Hamming_weight -// -// .. [3] http://aggregate.ee.engr.uky.edu/MAGIC/#Population%20Count%20(Ones%20Count) -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.bitwise_count(1023) -// np.uint8(10) -// >>> a = np.array([2**i - 1 for i in range(16)]) -// >>> np.bitwise_count(a) -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], -// dtype=uint8) -// -//go:linkname BitwiseCount py.bitwise_count -func BitwiseCount(x *py.Object, out *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Examples -// -------- -// >>> import numpy as np -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Returns an array with axes transposed. -// -// For a 1-D array, this returns an unchanged view of the original array, as a -// transposed vector is simply the same vector. -// To convert a 1-D array into a 2-D column vector, an additional dimension -// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does -// ``a[:, np.newaxis]``. -// For a 2-D array, this is the standard matrix transpose. -// For an n-D array, if axes are given, their order indicates how the -// axes are permuted (see Examples). If axes are not provided, then -// ``transpose(a).shape == a.shape[::-1]``. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axes : tuple or list of ints, optional -// If specified, it must be a tuple or list which contains a permutation -// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative -// indices can also be used to specify axes. The i-th axis of the returned -// array will correspond to the axis numbered ``axes[i]`` of the input. -// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses -// the order of the axes. -// -// Returns -// ------- -// p : ndarray -// `a` with its axes permuted. A view is returned whenever possible. -// -// See Also -// -------- -// ndarray.transpose : Equivalent method. -// moveaxis : Move axes of an array to new positions. -// argsort : Return the indices that would sort an array. -// -// Notes -// ----- -// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors -// when using the `axes` keyword argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) -// >>> np.transpose(a, (-1, 0, -2)).shape -// (5, 3, 4) -// -// -// -//go:linkname PermuteDims py.permute_dims -func PermuteDims(a *py.Object, axes *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> import numpy as np -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> import numpy as np -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> rng = np.random.default_rng() -// >>> A = rng.normal(size=(2,3,5)) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The row and column indices, respectively. The row indices are sorted -// in non-decreasing order, and the correspdonding column indices are -// strictly increasing for each row. -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Examples -// -------- -// >>> import numpy as np -// -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu1 -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Note that row indices (first array) are non-decreasing, and the corresponding -// column indices (second array) are strictly increasing for each row. -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> iu2 = np.triu_indices(4, 2) -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. If this -// is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` -// for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// .. versionchanged:: 2.0 -// Before NumPy 2.0, ``all`` did not return booleans for object dtype -// input arrays. -// This behavior is still available via ``np.logical_and.reduce``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete. If you only want to check if an array is Fortran -// contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> import numpy as np -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// Remove values along a dimension which are zero along all other. -// -// Parameters -// ---------- -// filt : array_like -// Input array. -// trim : {"fb", "f", "b"}, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. By default, zeros are trimmed on both sides. -// Front and back refer to the edges of a dimension, with "front" referring -// to the side with the lowest index 0, and "back" referring to the highest -// index (or index -1). -// axis : int or sequence, optional -// If None, `filt` is cropped such that the smallest bounding box is -// returned that still contains all values which are not zero. -// If an axis is specified, `filt` will be sliced in that dimension only -// on the sides specified by `trim`. The remaining area will be the -// smallest that still contains all values wich are not zero. -// -// .. versionadded:: 2.2.0 -// -// Returns -// ------- -// trimmed : ndarray or sequence -// The result of trimming the input. The number of dimensions and the -// input data type are preserved. -// -// Notes -// ----- -// For all-zero arrays, the first axis is trimmed first. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, trim='b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// Multiple dimensions are supported. -// -// >>> b = np.array([[0, 0, 2, 3, 0, 0], -// ... [0, 1, 0, 3, 0, 0], -// ... [0, 0, 0, 0, 0, 0]]) -// >>> np.trim_zeros(b) -// array([[0, 2, 3], -// [1, 0, 3]]) -// -// >>> np.trim_zeros(b, axis=-1) -// array([[0, 2, 3], -// [1, 0, 3], -// [0, 0, 0]]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object, axis *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> import numpy as np -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Atan py.atan -func Atan(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, device=None, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// Notes -// ----- -// Unlike other array creation functions (e.g. `zeros`, `ones`, `full`), -// `empty` does not initialize the values of the array, and may therefore be -// marginally faster. However, the values stored in the newly allocated array -// are arbitrary. For reproducible behavior, be sure to set each element of -// the array before reading. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> import numpy as np -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and -// the ``bins`` argument to `histogram`. Some key differences: -// -// +------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +====================================+===============+===================+ -// | PEP 3141 numeric objects | ``True`` | ``True`` | -// | (including builtins) | | | -// +------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other | ``False`` | ``False`` | -// | sequence objects | | | -// +------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> np.isscalar(3.1) -// True -// -// >>> np.isscalar(np.array(3.1)) -// False -// -// >>> np.isscalar([3.1]) -// False -// -// >>> np.isscalar(False) -// True -// -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.nan -// >>> np.min(b) -// np.float64(nan) -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `numpy.int8`, `numpy.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> import numpy as np -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), -// ... axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of ``arr``. This must match the -// dimension of ``arr``, but dimensions Ni and Nj only need to broadcast -// against ``arr``. -// axis : int or None, optional -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// .. versionchanged:: 2.3 -// The default value is now ``-1``. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// >>> import numpy as np -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// *args : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : tuple of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// (array([[1, 2, 3], -// [1, 2, 3]]), -// array([[4, 4, 4], -// [5, 5, 5]])) -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), -// array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Examples -// -------- -// >>> import numpy as np -// -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// with magnitudes much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : array_like -// The relative tolerance parameter (see Notes). -// atol : array_like -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent.:: -// -// absolute(a - b) <= (atol + rtol * absolute(b)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. -// -// The default value of `atol` is not appropriate when the reference value -// `b` has magnitude smaller than one. For example, it is unlikely that -// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet -// ``isclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure -// to select `atol` for the use case at hand, especially for defining the -// threshold below which a non-zero value in `a` will be considered "close" -// to a very small or zero value in `b`. -// -// `isclose` is not defined for non-numeric data types. -// :class:`bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy may need to use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``setuptools``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using -// that is likely preferred for build systems other than ``setuptools``:: -// -// $ numpy-config --cflags -// -I/path/to/site-packages/numpy/_core/include -// -// # Or rely on pkg-config: -// $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir) -// $ pkg-config --cflags -// -I/path/to/site-packages/numpy/_core/include -// -// Examples -// -------- -// >>> np.get_include() -// '.../site-packages/numpy/core/include' # may vary -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Copies an array to a specified data type. -// -// This function is an Array API compatible alternative to -// `numpy.ndarray.astype`. -// -// Parameters -// ---------- -// x : ndarray -// Input NumPy array to cast. ``array_likes`` are explicitly not -// supported here. -// dtype : dtype -// Data type of the result. -// copy : bool, optional -// Specifies whether to copy an array when the specified dtype matches -// the data type of the input array ``x``. If ``True``, a newly allocated -// array must always be returned. If ``False`` and the specified dtype -// matches the data type of the input array, the input array must be -// returned; otherwise, a newly allocated array must be returned. -// Defaults to ``True``. -// device : str, optional -// The device on which to place the returned array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.1.0 -// -// Returns -// ------- -// out : ndarray -// An array having the specified data type. -// -// See Also -// -------- -// ndarray.astype -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([1, 2, 3]); arr -// array([1, 2, 3]) -// >>> np.astype(arr, np.float64) -// array([1., 2., 3.]) -// -// Non-copy case: -// -// >>> arr = np.array([1, 2, 3]) -// >>> arr_noncpy = np.astype(arr, arr.dtype, copy=False) -// >>> np.shares_memory(arr, arr_noncpy) -// True -// -// -// -//go:linkname Astype py.astype -func Astype(x *py.Object, dtype *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, NumPy scalar, or array -// Data type, NumPy scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 2.0 -// This function does not support Python scalars anymore and does not -// apply any value-based logic for 0-D arrays and NumPy scalars. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> import numpy as np -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// *args : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// >>> import numpy as np -// -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : tuple of ndarrays -// A tuple of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> import numpy as np -// >>> rng = np.random.default_rng() -// >>> r = rng.normal(size=(100,3)) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(-np.inf) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, -np.inf]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2, 5, 4]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> import numpy as np -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='>> import numpy as np -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// ddof : {int, float}, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. See Notes for details about use of `ddof`. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// mean : array_like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this std function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// There are several common variants of the array standard deviation -// calculation. Assuming the input `a` is a one-dimensional NumPy array -// and ``mean`` is either provided as an argument or computed as -// ``a.mean()``, NumPy computes the standard deviation of an array as:: -// -// N = len(a) -// d2 = abs(a - mean)**2 # abs is for complex `a` -// var = d2.sum() / (N - ddof) # note use of `ddof` -// std = var**0.5 -// -// Different values of the argument `ddof` are useful in different -// contexts. NumPy's default ``ddof=0`` corresponds with the expression: -// -// .. math:: -// -// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N}} -// -// which is sometimes called the "population standard deviation" in the field -// of statistics because it applies the definition of standard deviation to -// `a` as if `a` were a complete population of possible observations. -// -// Many other libraries define the standard deviation of an array -// differently, e.g.: -// -// .. math:: -// -// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N - 1}} -// -// In statistics, the resulting quantity is sometimes called the "sample -// standard deviation" because if `a` is a random sample from a larger -// population, this calculation provides the square root of an unbiased -// estimate of the variance of the population. The use of :math:`N-1` in the -// denominator is often called "Bessel's correction" because it corrects for -// bias (toward lower values) in the variance estimate introduced when the -// sample mean of `a` is used in place of the true mean of the population. -// The resulting estimate of the standard deviation is still biased, but less -// than it would have been without the correction. For this quantity, use -// ``ddof=1``. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the standard deviation is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// np.float32(0.45000005) -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// Using the mean keyword to save computation time: -// -// >>> import numpy as np -// >>> from timeit import timeit -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> mean = np.mean(a, axis=1, keepdims=True) -// >>> -// >>> g = globals() -// >>> n = 10000 -// >>> t1 = timeit("std = np.std(a, axis=1, mean=mean)", globals=g, number=n) -// >>> t2 = timeit("std = np.std(a, axis=1)", globals=g, number=n) -// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') -// #doctest: +SKIP -// Percentage execution time saved 30% -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.hanning(51) -// plt.plot(window) -// plt.title("Hann window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// with np.errstate(divide='ignore', invalid='ignore'): -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of the Hann window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the quantile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// The behavior of `numpy.nanquantile` is the same as that of -// `numpy.quantile` (ignoring nan values). -// For more information, please see `numpy.quantile`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// np.float64(nan) -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in -// the designated form. If the `width` value is insufficient, an error is -// raised. -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns ``x / abs(x)``, the -// generalization of the above (and ``0 if x==0``). -// -// .. versionchanged:: 2.0.0 -// Definition of complex sign changed to follow the Array API standard. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here, :math:`x/|x|`, is the more common -// and useful one, but is different from the one used in numpy prior to -// version 2.0, :math:`x/\sqrt{x*x}`, which is equivalent to -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign([3-4j, 8j]) -// array([0.6-0.8j, 0. +1.j ]) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// >>> import numpy as np -// -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647], dtype=int32) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> import numpy as np -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// from_dlpack(x, /, *, device=None, copy=None) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a view of the input -// object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// device : device, optional -// Device on which to place the created array. Default: ``None``. -// Must be ``"cpu"`` if passed which may allow importing an array -// that is not already CPU available. -// copy : bool, optional -// Boolean indicating whether or not to copy the input. If ``True``, -// the copy will be made. If ``False``, the function will never copy, -// and will raise ``BufferError`` in case a copy is deemed necessary. -// Passing it requests a copy from the exporter who may or may not -// implement the capability. -// If ``None``, the function will reuse the existing memory buffer if -// possible and copy otherwise. Default: ``None``. -// -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch # doctest: +SKIP -// >>> x = torch.arange(10) # doctest: +SKIP -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) # doctest: +SKIP -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a :exc:`RuntimeWarning` (via the Python `warnings` -// module). -// - raise: Raise a :exc:`FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> import numpy as np -// >>> orig_settings = np.seterr(all='ignore') # seterr to known value -// >>> np.int16(32000) * np.int16(3) -// np.int16(30464) -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// np.int16(30464) -// >>> np.seterr(**orig_settings) # restore original -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype -// -// Examples -// -------- -// >>> import numpy as np -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// np.float32(0.54999924) -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Computing the mean in timedelta64 is available: -// -// >>> b = np.array([1, 3], dtype="timedelta64[D]") -// >>> np.mean(b) -// np.timedelta64(2,'D') -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. https://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a 4 by 4 array -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// The returned indices are not guaranteed to be sorted according to -// the values. Furthermore, the default selection algorithm ``introselect`` -// is unstable, and hence the returned indices are not guaranteed -// to be the earliest/latest occurrence of the element. -// -// `argpartition` works for real/complex inputs with nan values, -// see `partition` for notes on the enhanced sort order and -// different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> import numpy as np -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) # may vary -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) # may vary -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) # may vary -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> # below is the same as np.partition(x, kth=1) -// >>> np.take_along_axis(x, index_array, axis=-1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 >= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : bool or ndarray of bool -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, less_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) -// array([ True, True, False]) -// -// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` -// on ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a >= b -// array([ True, True, False]) -// -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.kaiser(51, 14) -// plt.plot(window) -// plt.title("Kaiser window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Kaiser window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename, file handle or pathlib.Path -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, ``fmt='%.4e'``, resulting in numbers formatted -// like ``' (%s+%sj)' % (fmt, fmt)`` -// * a full string specifying every real and imaginary part, e.g. -// ``' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'`` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. ``['%.3e + %.3ej', '(%.15e%+.15ej)']`` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// header : str, optional -// String that will be written at the beginning of the file. -// footer : str, optional -// String that will be written at the end of the file. -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(__llgo_va_list ...interface{}) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(-np.inf) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Atanh py.atanh -func Atanh(__llgo_va_list ...interface{}) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// cumulative_prod : Array API compatible alternative for ``cumprod``. -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(__llgo_va_list ...interface{}) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// This function is an Array API compatible alternative to `numpy.cumprod`. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. The default -// (None) is only allowed for one-dimensional arrays. For arrays -// with more than one dimension ``axis`` is required. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If ``dtype`` is not specified, it -// defaults to the dtype of ``x``, unless ``x`` has an integer dtype -// with a precision less than that of the default platform integer. -// In that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// include_initial : bool, optional -// Boolean indicating whether to include the initial value (ones) as -// the first value in the output. With ``include_initial=True`` -// the shape of the output is different than the shape of the input. -// Default: ``False``. -// -// Returns -// ------- -// cumulative_prod_along_axis : ndarray -// A new array holding the result is returned unless ``out`` is -// specified, in which case a reference to ``out`` is returned. The -// result has the same shape as ``x`` if ``include_initial=False``. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> np.cumulative_prod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([1, 2, 3, 4, 5, 6]) -// >>> np.cumulative_prod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of ``b``: -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumulative_prod(b, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of ``b``: -// -// >>> np.cumulative_prod(b, axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname CumulativeProd py.cumulative_prod -func CumulativeProd(x *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// is_busday( -// dates, -// weekmask='1111100', -// holidays=None, -// busdaycal=None, -// out=None -// ) -// -// Calculates which of the given dates are valid days, and which are not. -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> import numpy as np -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Transposes a matrix (or a stack of matrices) ``x``. -// -// This function is Array API compatible. -// -// Parameters -// ---------- -// x : array_like -// Input array having shape (..., M, N) and whose two innermost -// dimensions form ``MxN`` matrices. -// -// Returns -// ------- -// out : ndarray -// An array containing the transpose for each matrix and having shape -// (..., N, M). -// -// See Also -// -------- -// transpose : Generic transpose method. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.matrix_transpose([[1, 2], [3, 4]]) -// array([[1, 3], -// [2, 4]]) -// -// >>> np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) -// array([[[1, 3], -// [2, 4]], -// [[5, 7], -// [6, 8]]]) -// -// -// -//go:linkname MatrixTranspose py.matrix_transpose -func MatrixTranspose(__llgo_va_list ...interface{}) *py.Object -//go:linkname Asin py.asin -func Asin(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or tuple of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// (array([[1]]), array([[1, 2]]), array([[1, 2]])) -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import numpy as np -// -// >>> import matplotlib.pyplot as plt -// >>> import numpy as np -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// vecdot : Vector dot product of two arrays. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> import numpy as np -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsinh` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(__llgo_va_list ...interface{}) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// >>> import numpy as np -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isneginf(-np.inf) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> rng = np.random.default_rng() -// >>> A = rng.normal(size=(3,4,5)) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, -np.inf]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, -np.inf]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with np.errstate(invalid="ignore"): -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// np.float64(nan) -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// -// Consider four points in different quadrants: -// -// >>> import numpy as np -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts [1]_: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline v` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// scipy.signal.correlate : uses FFT which has superior performance -// on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes -// correlation may be defined differently. Another common definition is [1]_: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) -// because it does not use the FFT to compute the convolution; in that case, -// `scipy.signal.correlate` might be preferable. -// -// References -// ---------- -// .. [1] Wikipedia, "Cross-correlation", -// https://en.wikipedia.org/wiki/Cross-correlation -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None, *, -// device=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// Unlike other array creation functions (e.g. `zeros_like`, `ones_like`, -// `full_like`), `empty_like` does not initialize the values of the array, -// and may therefore be marginally faster. However, the values stored in the -// newly allocated array are arbitrary. For reproducible behavior, be sure -// to set each element of the array before reading. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> import numpy as np -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the cube-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the -// cube root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// -// concatenate( -// (a1, a2, ...), -// axis=0, -// out=None, -// dtype=None, -// casting="same_kind" -// ) -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// For a description of the options, please see :term:`casting`. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concat py.concat -func Concat(__llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value:: -// -// p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1] -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using -// the normal rules. Instead, leading axes of size 1 are inserted, -// to make ``block.ndim`` the same for all blocks. This is primarily useful -// for working with scalars, and means that code like ``np.block([v, 1])`` -// is valid, where ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Notes -// ----- -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is *not* -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix: -// -// >>> import numpy as np -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack`: -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in place of `atleast_1d` and `atleast_2d`: -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// >>> import numpy as np -// -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// -// Given a sequence of a polynomial's zeros: -// -// >>> import numpy as np -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or tuple of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description:: -// -// np.choose(a,c) == np.array([c[a[I]][I] for I in np.ndindex(a.shape)]) -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> import numpy as np -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> import numpy as np -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, lexsort returns an array of integer indices -// that describes the sort order by multiple keys. The last key in the -// sequence is used for the primary sort order, ties are broken by the -// second-to-last key, and so on. -// -// Parameters -// ---------- -// keys : (k, m, n, ...) array-like -// The `k` keys to be sorted. The *last* key (e.g, the last -// row if `keys` is a 2D array) is the primary sort key. -// Each element of `keys` along the zeroth axis must be -// an array-like object of the same shape. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis -// of each sequence. Separate slices along `axis` sorted over -// independently; see last example. -// -// Returns -// ------- -// indices : (m, n, ...) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> import numpy as np -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort according to two numerical keys, first by elements -// of ``a``, then breaking ties according to elements of ``b``: -// -// >>> a = [1, 5, 1, 4, 3, 4, 4] # First sequence -// >>> b = [9, 4, 0, 4, 0, 2, 1] # Second sequence -// >>> ind = np.lexsort((b, a)) # Sort by `a`, then by `b` -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// >>> [(a[i], b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Compare against `argsort`, which would sort each key independently. -// -// >>> np.argsort((b, a), kind='stable') -// array([[2, 4, 6, 5, 1, 3, 0], -// [0, 2, 4, 3, 5, 6, 1]]) -// -// To sort lexicographically with `argsort`, we would need to provide a -// structured array. -// -// >>> x = np.array([(ai, bi) for ai, bi in zip(a, b)], -// ... dtype = np.dtype([('x', int), ('y', int)])) -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// The zeroth axis of `keys` always corresponds with the sequence of keys, -// so 2D arrays are treated just like other sequences of keys. -// -// >>> arr = np.asarray([b, a]) -// >>> ind2 = np.lexsort(arr) -// >>> np.testing.assert_equal(ind2, ind) -// -// Accordingly, the `axis` parameter refers to an axis of *each* key, not of -// the `keys` argument itself. For instance, the array ``arr`` is treated as -// a sequence of two 1-D keys, so specifying ``axis=0`` is equivalent to -// using the default axis, ``axis=-1``. -// -// >>> np.testing.assert_equal(np.lexsort(arr, axis=0), -// ... np.lexsort(arr, axis=-1)) -// -// For higher-dimensional arrays, the axis parameter begins to matter. The -// resulting array has the same shape as each key, and the values are what -// we would expect if `lexsort` were performed on corresponding slices -// of the keys independently. For instance, -// -// >>> x = [[1, 2, 3, 4], -// ... [4, 3, 2, 1], -// ... [2, 1, 4, 3]] -// >>> y = [[2, 2, 1, 1], -// ... [1, 2, 1, 2], -// ... [1, 1, 2, 1]] -// >>> np.lexsort((x, y), axis=1) -// array([[2, 3, 0, 1], -// [2, 0, 3, 1], -// [1, 0, 3, 2]]) -// -// Each row of the result is what we would expect if we were to perform -// `lexsort` on the corresponding row of the keys: -// -// >>> for i in range(3): -// ... print(np.lexsort((x[i], y[i]))) -// [2 3 0 1] -// [2 0 3 1] -// [1 0 3 2] -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. If this is a tuple of ints, the maximum is selected over -// multiple axes, instead of a single axis or all the axes as before. -// -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.nan -// >>> np.max(b) -// np.float64(nan) -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// sorted : bool, optional -// If True, the unique elements are sorted. Elements may be sorted in -// practice even if ``sorted=False``, but this could change without -// notice. -// -// .. versionadded:: 2.3 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// sort : Return a sorted copy of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged:: 1.21 -// Like np.sort, NaN will sort to the end of the values. -// For complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// .. versionchanged:: 2.0 -// For multi-dimensional inputs, ``unique_inverse`` is reshaped -// such that the input can be reconstructed using -// ``np.take(unique, unique_inverse, axis=axis)``. The result is -// now not 1-dimensional when ``axis=None``. -// -// Note that in NumPy 2.0.0 a higher dimensional array was returned also -// when ``axis`` was not ``None``. This was reverted, but -// ``inverse.reshape(-1)`` can be used to ensure compatibility with both -// versions. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// This function passes the imaginary and real parts of the argument to -// `arctan2` to compute the result; consequently, it follows the convention -// of `arctan2` when the magnitude of the argument is zero. See example. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// >>> np.angle([0., -0., complex(0., -0.), complex(-0., -0.)]) # convention -// array([ 0. , 3.14159265, -0. , -3.14159265]) -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// -// Returns an array with axes transposed. -// -// For a 1-D array, this returns an unchanged view of the original array, as a -// transposed vector is simply the same vector. -// To convert a 1-D array into a 2-D column vector, an additional dimension -// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does -// ``a[:, np.newaxis]``. -// For a 2-D array, this is the standard matrix transpose. -// For an n-D array, if axes are given, their order indicates how the -// axes are permuted (see Examples). If axes are not provided, then -// ``transpose(a).shape == a.shape[::-1]``. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axes : tuple or list of ints, optional -// If specified, it must be a tuple or list which contains a permutation -// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative -// indices can also be used to specify axes. The i-th axis of the returned -// array will correspond to the axis numbered ``axes[i]`` of the input. -// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses -// the order of the axes. -// -// Returns -// ------- -// p : ndarray -// `a` with its axes permuted. A view is returned whenever possible. -// -// See Also -// -------- -// ndarray.transpose : Equivalent method. -// moveaxis : Move axes of an array to new positions. -// argsort : Return the indices that would sort an array. -// -// Notes -// ----- -// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors -// when using the `axes` keyword argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) -// >>> np.transpose(a, (-1, 0, -2)).shape -// (5, 3, 4) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (deg + 1, deg + 1) or (deg + 1, deg + 1, K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.exceptions.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `~exceptions.RankWarning` when the least-squares fit is -// badly conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import numpy as np -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.exceptions.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(__llgo_va_list ...interface{}) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), -// array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), -// array([[12., 13., 14., 15.]]), -// array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), -// array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values have the same data-type as the input. -// -// Parameters -// ---------- -// x : array_like -// An array to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// An array with the same dimensions and data-type as the input. -// If second argument is not supplied then a new array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value ``out`` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// busday_count( -// begindates, -// enddates, -// weekmask='1111100', -// holidays=[], -// busdaycal=None, -// out=None -// ) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> import numpy as np -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.getbufsize() -// 8192 -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// vecdot : Vector dot product of two arrays. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> import numpy as np -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Examples -// -------- -// >>> import numpy as np -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// -// Find the unique elements and counts of an input array `x`. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, return_counts=True, equal_nan=False, sorted=False) -// -// but returns a namedtuple for easier access to each output. -// -// .. note:: -// This function currently always returns a sorted result, however, -// this could change in any NumPy minor release. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : namedtuple -// The result containing: -// -// * values - The unique elements of an input array. -// * counts - The corresponding counts for each unique element. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = [1, 1, 2] -// >>> uniq = np.unique_counts(x) -// >>> uniq.values -// array([1, 2]) -// >>> uniq.counts -// array([2, 1]) -// -// -//go:linkname UniqueCounts py.unique_counts -func UniqueCounts(x *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by prepending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> import numpy as np -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or -// a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', -// end with a Z to indicate UTC time. If 'local', convert to the local -// timezone first, and suffix with a +-#### timezone offset. If a tzinfo -// object, then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// >>> import numpy as np -// -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric inverse cosine, element-wise. -// -// The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``. -// -// Parameters -// ---------- -// x : array_like -// `x`-coordinate on the unit circle. -// For real arguments, the domain is [-1, 1]. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> import numpy as np -// -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Acos py.acos -func Acos(__llgo_va_list ...interface{}) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// concatenate( -// (a1, a2, ...), -// axis=0, -// out=None, -// dtype=None, -// casting="same_kind" -// ) -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// For a description of the options, please see :term:`casting`. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - sign : str -// - formatter : dict of callables -// - floatmode : str -// - legacy : str or False -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> np.get_printoptions() -// {'edgeitems': 3, 'threshold': 1000, ..., 'override_repr': None} -// -// >>> np.get_printoptions()['linewidth'] -// 75 -// >>> np.set_printoptions(linewidth=100) -// >>> np.get_printoptions()['linewidth'] -// 100 -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. If -// axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// add: ``numpy.add.reduce`` equivalent function. -// cumsum : Cumulative sum of array elements. -// trapezoid : Integration of array values using composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// np.int32(1) -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// np.int8(-128) -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the percentile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// See the notes for more details. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// The behavior of `numpy.percentile` with percentage `q` is -// that of `numpy.quantile` with argument ``q/100``. -// For more information, please see `numpy.quantile`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// >>> import numpy as np -// -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Find the unique elements of an array, and counts, inverse, and indices. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, return_index=True, return_inverse=True, -// return_counts=True, equal_nan=False, sorted=False) -// -// but returns a namedtuple for easier access to each output. -// -// .. note:: -// This function currently always returns a sorted result, however, -// this could change in any NumPy minor release. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : namedtuple -// The result containing: -// -// * values - The unique elements of an input array. -// * indices - The first occurring indices for each unique element. -// * inverse_indices - The indices from the set of unique elements -// that reconstruct `x`. -// * counts - The corresponding counts for each unique element. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = [1, 1, 2] -// >>> uniq = np.unique_all(x) -// >>> uniq.values -// array([1, 2]) -// >>> uniq.indices -// array([0, 2]) -// >>> uniq.inverse_indices -// array([0, 0, 1]) -// >>> uniq.counts -// array([2, 1]) -// -// -//go:linkname UniqueAll py.unique_all -func UniqueAll(x *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `numpy.digitize` is implemented in terms of `numpy.searchsorted`. -// This means that a binary search is used to bin the values, which scales -// much better for larger number of bins than the previous linear search. -// It also removes the requirement for the input array to be 1-dimensional. -// -// For monotonically *increasing* `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// >>> import numpy as np -// -// Define the signum function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> import numpy as np -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array and partially sorts it in such a way that -// the value of the element in k-th position is in the position it would be -// in a sorted array. In the output array, all elements smaller than the k-th -// element are located to the left of this element and all equal or greater -// are located to its right. The ordering of the elements in the two -// partitions on the either side of the k-th element in the output array is -// undefined. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// The sort order of ``np.nan`` is bigger than ``np.inf``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) # may vary -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Gives a new shape to an array without changing its data. -// -// Parameters -// ---------- -// a : array_like -// Array to be reshaped. -// shape : int or tuple of ints -// The new shape should be compatible with the original shape. If -// an integer, then the result will be a 1-D array of that length. -// One shape dimension can be -1. In this case, the value is -// inferred from the length of the array and remaining dimensions. -// order : {'C', 'F', 'A'}, optional -// Read the elements of ``a`` using this index order, and place the -// elements into the reshaped array using this index order. 'C' -// means to read / write the elements using C-like index order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to read / write the -// elements using Fortran-like index order, with the first index -// changing fastest, and the last index changing slowest. Note that -// the 'C' and 'F' options take no account of the memory layout of -// the underlying array, and only refer to the order of indexing. -// 'A' means to read / write the elements in Fortran-like index -// order if ``a`` is Fortran *contiguous* in memory, C-like order -// otherwise. -// newshape : int or tuple of ints -// .. deprecated:: 2.1 -// Replaced by ``shape`` argument. Retained for backward -// compatibility. -// copy : bool, optional -// If ``True``, then the array data is copied. If ``None``, a copy will -// only be made if it's required by ``order``. For ``False`` it raises -// a ``ValueError`` if a copy cannot be avoided. Default: ``None``. -// -// Returns -// ------- -// reshaped_array : ndarray -// This will be a new view object if possible; otherwise, it will -// be a copy. Note there is no guarantee of the *memory layout* (C- or -// Fortran- contiguous) of the returned array. -// -// See Also -// -------- -// ndarray.reshape : Equivalent method. -// -// Notes -// ----- -// It is not always possible to change the shape of an array without copying -// the data. -// -// The ``order`` keyword gives the index ordering both for *fetching* -// the values from ``a``, and then *placing* the values into the output -// array. For example, let's say you have an array: -// -// >>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, shape *py.Object, order *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes -// specified in the axis parameter. -// Default: 1. (see Examples below). -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// Returns -// ------- -// gradient : ndarray or tuple of ndarray -// A tuple of ndarrays (or a single ndarray if there is only one -// dimension) corresponding to the derivatives of f with respect -// to each dimension. Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> import numpy as np -// >>> f = np.array([1, 2, 4, 7, 11, 16]) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.]) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]])) -// (array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), -// array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])) -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), dx, y) -// (array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), -// array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])) -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// The `varargs` argument defines the spacing between sample points in the -// input array. It can take two forms: -// -// 1. An array, specifying coordinates, which may be unevenly spaced: -// -// >>> x = np.array([0., 2., 3., 6., 8.]) -// >>> y = x ** 2 -// >>> np.gradient(y, x, edge_order=2) -// array([ 0., 4., 6., 12., 16.]) -// -// 2. A scalar, representing the fixed sample distance: -// -// >>> dx = 2 -// >>> x = np.array([0., 2., 4., 6., 8.]) -// >>> y = x ** 2 -// >>> np.gradient(y, dx, edge_order=2) -// array([ 0., 4., 8., 12., 16.]) -// -// It's possible to provide different data for spacing along each dimension. -// The number of arguments must match the number of dimensions in the input -// data. -// -// >>> dx = 2 -// >>> dy = 3 -// >>> x = np.arange(0, 6, dx) -// >>> y = np.arange(0, 9, dy) -// >>> xs, ys = np.meshgrid(x, y) -// >>> zs = xs + 2 * ys -// >>> np.gradient(zs, dy, dx) # Passing two scalars -// (array([[2., 2., 2.], -// [2., 2., 2.], -// [2., 2., 2.]]), -// array([[1., 1., 1.], -// [1., 1., 1.], -// [1., 1., 1.]])) -// -// Mixing scalars and arrays is also allowed: -// -// >>> np.gradient(zs, y, dx) # Passing one array and one scalar -// (array([[2., 2., 2.], -// [2., 2., 2.], -// [2., 2., 2.]]), -// array([[1., 1., 1.], -// [1., 1., 1.], -// [1., 1., 1.]])) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero imaginary part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// linalg.cross : An Array API compatible variation of ``np.cross``, -// which accepts (arrays of) 3-element vectors only. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// Supports full broadcasting of the inputs. -// -// Dimension-2 input arrays were deprecated in 2.0.0. If you do need this -// functionality, you can use:: -// -// def cross2d(x, y): -// return x[..., 0] * y[..., 1] - x[..., 1] * y[..., 0] -// -// Examples -// -------- -// Vector cross-product. -// -// >>> import numpy as np -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the bit-wise NOT of the absolute value is -// returned. In a two's-complement system, this operation effectively flips -// all the bits, resulting in a representation that corresponds to the -// negative of the input plus one. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range :math:`-2^{N-1}` to -// :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// ``numpy.bitwise_not`` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> import numpy as np -// -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// np.uint8(242) -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// np.uint16(65522) -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types, the result is the bit-wise NOT of -// the unsigned type, interpreted as a signed integer: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname BitwiseRightShift py.bitwise_right_shift -func BitwiseRightShift(__llgo_va_list ...interface{}) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// vecdot(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) -// -// Vector dot product of two arrays. -// -// Let :math:`\mathbf{a}` be a vector in `x1` and :math:`\mathbf{b}` be -// a corresponding vector in `x2`. The dot product is defined as: -// -// .. math:: -// \mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} \overline{a_i}b_i -// -// where the sum is over the last dimension (unless `axis` is specified) and -// where :math:`\overline{a_i}` denotes the complex conjugate if :math:`a_i` -// is complex and the identity otherwise. -// -// .. versionadded:: 2.0.0 -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// the broadcasted shape of `x1` and `x2` with the last axis removed. -// If not provided or None, a freshly-allocated array is used. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The vector dot product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : same but flattens arguments first -// matmul : Matrix-matrix product. -// vecmat : Vector-matrix product. -// matvec : Matrix-vector product. -// einsum : Einstein summation convention. -// -// Examples -// -------- -// >>> import numpy as np -// -// Get the projected size along a given normal for an array of vectors. -// -// >>> v = np.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]]) -// >>> n = np.array([0., 0.6, 0.8]) -// >>> np.vecdot(v, n) -// array([ 3., 8., 10.]) -// -//go:linkname Vecdot py.vecdot -func Vecdot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> import numpy as np -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size -// not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int, array-like of ints or bools -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// -// The defining property of the antiderivative: -// -// >>> import numpy as np -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(__llgo_va_list ...interface{}) *py.Object -//go:linkname Asinh py.asinh -func Asinh(__llgo_va_list ...interface{}) *py.Object -//go:linkname Minimum py.minimum -func Minimum(__llgo_va_list ...interface{}) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python -// `bisect.bisect_left` (``side='left'``) and `bisect.bisect_right` -// (``side='right'``) functions, which is also vectorized -// in the `v` argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.searchsorted([11,12,13,14,15], 13) -// 2 -// >>> np.searchsorted([11,12,13,14,15], 13, side='right') -// 3 -// >>> np.searchsorted([11,12,13,14,15], [-10, 20, 12, 13]) -// array([0, 5, 1, 2]) -// -// When `sorter` is used, the returned indices refer to the sorted -// array of `a` and not `a` itself: -// -// >>> a = np.array([40, 10, 20, 30]) -// >>> sorter = np.argsort(a) -// >>> sorter -// array([1, 2, 3, 0]) # Indices that would sort the array 'a' -// >>> result = np.searchsorted(a, 25, sorter=sorter) -// >>> result -// 2 -// >>> a[sorter[result]] -// 30 # The element at index 2 of the sorted array is 30. -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : {int, float}, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// mean : array_like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this std function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(x *py.Object, out *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// copy : bool, optional -// If ``True``, then the object is copied. If ``None`` then the object is -// copied only if needed, i.e. if ``__array__`` returns a copy, if obj -// is a nested sequence, or if a copy is needed to satisfy any of -// the other requirements (``dtype``, ``order``, etc.). -// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. -// Default: ``None``. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of ``a``. No copy is performed if the input -// is already an ndarray with matching dtype and order. If ``a`` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> import numpy as np -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.shares_memory(np.asarray(a, dtype=np.float32), a) -// True -// >>> np.shares_memory(np.asarray(a, dtype=np.float64), a) -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=int32) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. In the case of a single -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays -// horizontally (column-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -//go:linkname Matvec py.matvec -func Matvec(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib). -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.bartlett(51) -// plt.plot(window) -// plt.title("Bartlett window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// with np.errstate(divide='ignore', invalid='ignore'): -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Bartlett window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// `trapz` is deprecated in NumPy 2.0. -// -// Please use `trapezoid` instead, or one of the numerical integration -// functions in `scipy.integrate`. -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` -// for more details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// .. deprecated:: 2.0 -// Use :func:`isin` instead of `in1d` for new code. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// Examples -// -------- -// >>> import numpy as np -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(__llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.bytes_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(__llgo_va_list ...interface{}) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.blackman(51) -// plt.plot(window) -// plt.title("Blackman window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() # doctest: +SKIP -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// with np.errstate(divide='ignore', invalid='ignore'): -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Blackman window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return a tuple of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be used with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// Returns -// ------- -// X1, X2,..., XN : tuple of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// :ref:`how-to-index` -// -// Examples -// -------- -// >>> import numpy as np -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If ``True`` (default), then the array data is copied. If ``None``, -// a copy will only be made if ``__array__`` returns a copy, if obj is -// a nested sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). Note that any copy of -// the data is shallow, i.e., for arrays with object dtype, the new -// array will point to the same objects. See Examples for `ndarray.copy`. -// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. -// Default: ``True``. -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=None`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// copy: Return an array copy of the given object. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3], dtype=int32) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.asmatrix('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.asmatrix('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// .. versionchanged:: 2.0 -// The scope of setting the buffer is tied to the `numpy.errstate` -// context. Exiting a ``with errstate():`` will also restore the bufsize. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// Returns -// ------- -// bufsize : int -// Previous size of ufunc buffer in bytes. -// -// Examples -// -------- -// When exiting a `numpy.errstate` context manager the bufsize is restored: -// -// >>> import numpy as np -// >>> with np.errstate(): -// ... np.setbufsize(4096) -// ... print(np.getbufsize()) -// ... -// 8192 -// 4096 -// >>> np.getbufsize() -// 8192 -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object From a09c535d3c50013a5649c232352111f2be30261d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Sat, 16 Aug 2025 02:13:12 +0800 Subject: [PATCH 51/88] Release-as: numpy/v1.26.4 --- numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpyg.cfg | 8 + numpy/numpy.go | 27200 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 27215 insertions(+) create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..c3e8b3d3 --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/Bigdata-shiyang/test/numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..096a39c3 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,8 @@ +{ + "name": "numpy", + "libName": "numpy", + "libVersion": "1.26.4", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..303742a9 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27200 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// +// Gives a new shape to an array without changing its data. +// +// Parameters +// ---------- +// a : array_like +// Array to be reshaped. +// newshape : int or tuple of ints +// The new shape should be compatible with the original shape. If +// an integer, then the result will be a 1-D array of that length. +// One shape dimension can be -1. In this case, the value is +// inferred from the length of the array and remaining dimensions. +// order : {'C', 'F', 'A'}, optional +// Read the elements of `a` using this index order, and place the +// elements into the reshaped array using this index order. 'C' +// means to read / write the elements using C-like index order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to read / write the +// elements using Fortran-like index order, with the first index +// changing fastest, and the last index changing slowest. Note that +// the 'C' and 'F' options take no account of the memory layout of +// the underlying array, and only refer to the order of indexing. +// 'A' means to read / write the elements in Fortran-like index +// order if `a` is Fortran *contiguous* in memory, C-like order +// otherwise. +// +// Returns +// ------- +// reshaped_array : ndarray +// This will be a new view object if possible; otherwise, it will +// be a copy. Note there is no guarantee of the *memory layout* (C- or +// Fortran- contiguous) of the returned array. +// +// See Also +// -------- +// ndarray.reshape : Equivalent method. +// +// Notes +// ----- +// It is not always possible to change the shape of an array without copying +// the data. +// +// The `order` keyword gives the index ordering both for *fetching* the values +// from `a`, and then *placing* the values into the output array. +// For example, let's say you have an array: +// +// >>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// Compute tensor dot product along specified axes. +// +// Given two tensors, `a` and `b`, and an array_like object containing +// two array_like objects, ``(a_axes, b_axes)``, sum the products of +// `a`'s and `b`'s elements (components) over the axes specified by +// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative +// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions +// of `a` and the first ``N`` dimensions of `b` are summed over. +// +// Parameters +// ---------- +// a, b : array_like +// Tensors to "dot". +// +// axes : int or (2,) array_like +// * integer_like +// If an int N, sum over the last N axes of `a` and the first N axes +// of `b` in order. The sizes of the corresponding axes must match. +// * (2,) array_like +// Or, a list of axes to be summed over, first sequence applying to `a`, +// second to `b`. Both elements array_like must be of the same length. +// +// Returns +// ------- +// output : ndarray +// The tensor dot product of the input. +// +// See Also +// -------- +// dot, einsum +// +// Notes +// ----- +// Three common use cases are: +// * ``axes = 0`` : tensor product :math:`a\otimes b` +// * ``axes = 1`` : tensor dot product :math:`a\cdot b` +// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` +// +// When `axes` is integer_like, the sequence for evaluation will be: first +// the -Nth axis in `a` and 0th axis in `b`, and the -1th axis in `a` and +// Nth axis in `b` last. +// +// When there is more than one axis to sum over - and they are not the last +// (first) axes of `a` (`b`) - the argument `axes` should consist of +// two sequences of the same length, with the first axis to sum over given +// first in both sequences, the second axis second, and so forth. +// +// The shape of the result consists of the non-contracted axes of the +// first tensor, followed by the non-contracted axes of the second. +// +// Examples +// -------- +// A "traditional" example: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 >= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : bool or ndarray of bool +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) +// array([ True, True, False]) +// +// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` +// on ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a >= b +// array([ True, True, False]) +// +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Sign py.sign +func Sign(__llgo_va_list ...interface{}) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 > x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// +// See Also +// -------- +// greater_equal, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.greater([4,2],[2,2]) +// array([ True, False]) +// +// The ``>`` operator can be used as a shorthand for ``np.greater`` on +// ndarrays. +// +// >>> a = np.array([4, 2]) +// >>> b = np.array([2, 2]) +// >>> a > b +// array([ True, False]) +// +//go:linkname Greater py.greater +func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '`. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(__llgo_va_list ...interface{}) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Returns an array with axes transposed. +// +// For a 1-D array, this returns an unchanged view of the original array, as a +// transposed vector is simply the same vector. +// To convert a 1-D array into a 2-D column vector, an additional dimension +// must be added, e.g., ``np.atleast2d(a).T`` achieves this, as does +// ``a[:, np.newaxis]``. +// For a 2-D array, this is the standard matrix transpose. +// For an n-D array, if axes are given, their order indicates how the +// axes are permuted (see Examples). If axes are not provided, then +// ``transpose(a).shape == a.shape[::-1]``. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axes : tuple or list of ints, optional +// If specified, it must be a tuple or list which contains a permutation +// of [0,1,...,N-1] where N is the number of axes of `a`. The `i`'th axis +// of the returned array will correspond to the axis numbered ``axes[i]`` +// of the input. If not specified, defaults to ``range(a.ndim)[::-1]``, +// which reverses the order of the axes. +// +// Returns +// ------- +// p : ndarray +// `a` with its axes permuted. A view is returned whenever possible. +// +// See Also +// -------- +// ndarray.transpose : Equivalent method. +// moveaxis : Move axes of an array to new positions. +// argsort : Return the indices that would sort an array. +// +// Notes +// ----- +// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors +// when using the `axes` keyword argument. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(__llgo_va_list ...interface{}) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '`. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(x *py.Object, out *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object From ad9235ea4bbb28693171a254c20720ca81ed3ad7 Mon Sep 17 00:00:00 2001 From: Askeladd <1351914167@qq.com> Date: Sun, 17 Aug 2025 17:04:53 +0800 Subject: [PATCH 52/88] only for presentation --- .github/workflows/verification.yml | 4 +- README.md | 2 +- bzip2/_demo/compress/compress.go | 60 - bzip2/_demo/compress/test.txt | 1 - bzip2/_demo/decompress/decompress.go | 76 - bzip2/bzip2_autogen_link.go | 5 - bzip2/bzlib.go | 136 - bzip2/go.mod | 5 - bzip2/go.sum | 2 - bzip2/llcppg.cfg | 22 - bzip2/llcppg.pub | 2 - bzip2/llpkg.cfg | 8 - bzip3/_demo/test/test.go | 31 - bzip3/bzip3_autogen_link.go | 5 - bzip3/go.mod | 5 - bzip3/go.sum | 2 - bzip3/libbz3.go | 188 - bzip3/llcppg.cfg | 22 - bzip3/llcppg.pub | 1 - bzip3/llpkg.cfg | 8 - cargs/_demo/test/test.go | 59 - cargs/cargs.go | 228 - cargs/cargs_autogen_link.go | 5 - cargs/go.mod | 5 - cargs/go.sum | 2 - cargs/llcppg.cfg | 22 - cargs/llcppg.pub | 3 - cargs/llpkg.cfg | 8 - cjson/_demo/hello/hello.go | 50 - cjson/cJSON.go | 416 - cjson/cJSON_Utils.go | 84 - cjson/cjson_autogen_link.go | 5 - cjson/go.mod | 5 - cjson/go.sum | 2 - cjson/llcppg.cfg | 36 - cjson/llcppg.pub | 3 - cjson/llpkg.cfg | 14 - libtool/_demo/test/test.go | 54 - libtool/go.mod | 5 - libtool/go.sum | 2 - libtool/libtool_autogen_link.go | 5 - libtool/llcppg.cfg | 25 - libtool/llcppg.pub | 20 - libtool/llpkg.cfg | 8 - libtool/lt_dlloader.go | 75 - libtool/lt_error.go | 38 - libtool/lt_system.go | 8 - libtool/ltdl.go | 150 - libxml2/HTMLparser.go | 226 - libxml2/HTMLtree.go | 66 - libxml2/SAX.go | 116 - libxml2/SAX2.go | 118 - libxml2/_demo/hello/hello.go | 23 - libxml2/c14n.go | 29 - libxml2/catalog.go | 170 - libxml2/chvalid.go | 59 - libxml2/debugXML.go | 124 - libxml2/dict.go | 60 - libxml2/encoding.go | 150 - libxml2/entities.go | 86 - libxml2/globals.go | 15 - libxml2/go.mod | 5 - libxml2/go.sum | 2 - libxml2/hash.go | 126 - libxml2/libxml2_autogen_link.go | 8 - libxml2/list.go | 109 - libxml2/llcppg.cfg | 59 - libxml2/llcppg.pub | 337 - libxml2/llpkg.cfg | 14 - libxml2/nanoftp.go | 93 - libxml2/nanohttp.go | 57 - libxml2/parser.go | 627 - libxml2/parserInternals.go | 321 - libxml2/pattern.go | 78 - libxml2/relaxng.go | 163 - libxml2/schemasInternals.go | 358 - libxml2/schematron.go | 112 - libxml2/threads.go | 66 - libxml2/tree.go | 1227 -- libxml2/uri.go | 97 - libxml2/valid.go | 294 - libxml2/xinclude.go | 54 - libxml2/xlink.go | 80 - libxml2/xmlIO.go | 237 - libxml2/xmlautomata.go | 78 - libxml2/xmlerror.go | 908 - libxml2/xmlexports.go | 12 - libxml2/xmlmemory.go | 95 - libxml2/xmlmodule.go | 30 - libxml2/xmlreader.go | 360 - libxml2/xmlregexp.go | 62 - libxml2/xmlsave.go | 67 - libxml2/xmlschemas.go | 158 - libxml2/xmlschemastypes.go | 131 - libxml2/xmlstring.go | 151 - libxml2/xmlunicode.go | 504 - libxml2/xmlversion.go | 9 - libxml2/xmlwriter.go | 324 - libxml2/xpath.go | 335 - libxml2/xpathInternals.go | 398 - libxml2/xpointer.go | 14 - libxslt/_demo/withdeplibxml/demo.go | 68 - libxslt/attributes.go | 18 - libxslt/documents.go | 42 - libxslt/exslt.go | 3 - libxslt/exsltconfig.go | 8 - libxslt/exsltexports.go | 3 - libxslt/extensions.go | 148 - libxslt/extra.go | 19 - libxslt/functions.go | 43 - libxslt/go.mod | 8 - libxslt/go.sum | 4 - libxslt/imports.go | 28 - libxslt/keys.go | 22 - libxslt/libxslt_autogen_link.go | 9 - libxslt/llcppg.cfg | 37 - libxslt/llcppg.pub | 58 - libxslt/llpkg.cfg | 15 - libxslt/namespaces.go | 27 - libxslt/numbersInternals.go | 43 - libxslt/pattern.go | 43 - libxslt/preproc.go | 15 - libxslt/security.go | 64 - libxslt/templates.go | 41 - libxslt/transform.go | 116 - libxslt/variables.go | 56 - libxslt/xslt.go | 19 - libxslt/xsltInternals.go | 490 - libxslt/xsltconfig.go | 8 - libxslt/xsltexports.go | 3 - libxslt/xsltlocale.go | 25 - libxslt/xsltutils.go | 158 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpyg.cfg | 8 - numpy/numpy.go | 27200 ------------------------- sqlite3/_demo/hello/hello.go | 67 - sqlite3/go.mod | 5 - sqlite3/go.sum | 2 - sqlite3/llcppg.cfg | 23 - sqlite3/llcppg.pub | 46 - sqlite3/llpkg.cfg | 8 - sqlite3/sqlite3.go | 7935 -------- sqlite3/sqlite3_autogen_link.go | 5 - sqlite3/sqlite3ext.go | 9 - zlib/_demo/crc32demo/demo.go | 18 - zlib/_demo/efficiency/efficiency.go | 39 - zlib/_demo/normal/normal.go | 44 - zlib/go.mod | 5 - zlib/go.sum | 2 - zlib/llcppg.cfg | 20 - zlib/llcppg.pub | 26 - zlib/llpkg.cfg | 8 - zlib/zconf.go | 23 - zlib/zlib.go | 1518 -- zlib/zlib_autogen_link.go | 8 - 156 files changed, 3 insertions(+), 49988 deletions(-) delete mode 100644 bzip2/_demo/compress/compress.go delete mode 100644 bzip2/_demo/compress/test.txt delete mode 100644 bzip2/_demo/decompress/decompress.go delete mode 100644 bzip2/bzip2_autogen_link.go delete mode 100644 bzip2/bzlib.go delete mode 100644 bzip2/go.mod delete mode 100644 bzip2/go.sum delete mode 100644 bzip2/llcppg.cfg delete mode 100644 bzip2/llcppg.pub delete mode 100644 bzip2/llpkg.cfg delete mode 100644 bzip3/_demo/test/test.go delete mode 100644 bzip3/bzip3_autogen_link.go delete mode 100644 bzip3/go.mod delete mode 100644 bzip3/go.sum delete mode 100644 bzip3/libbz3.go delete mode 100644 bzip3/llcppg.cfg delete mode 100644 bzip3/llcppg.pub delete mode 100644 bzip3/llpkg.cfg delete mode 100644 cargs/_demo/test/test.go delete mode 100644 cargs/cargs.go delete mode 100644 cargs/cargs_autogen_link.go delete mode 100644 cargs/go.mod delete mode 100644 cargs/go.sum delete mode 100644 cargs/llcppg.cfg delete mode 100644 cargs/llcppg.pub delete mode 100644 cargs/llpkg.cfg delete mode 100644 cjson/_demo/hello/hello.go delete mode 100644 cjson/cJSON.go delete mode 100644 cjson/cJSON_Utils.go delete mode 100644 cjson/cjson_autogen_link.go delete mode 100644 cjson/go.mod delete mode 100644 cjson/go.sum delete mode 100644 cjson/llcppg.cfg delete mode 100644 cjson/llcppg.pub delete mode 100644 cjson/llpkg.cfg delete mode 100644 libtool/_demo/test/test.go delete mode 100644 libtool/go.mod delete mode 100644 libtool/go.sum delete mode 100644 libtool/libtool_autogen_link.go delete mode 100644 libtool/llcppg.cfg delete mode 100644 libtool/llcppg.pub delete mode 100644 libtool/llpkg.cfg delete mode 100644 libtool/lt_dlloader.go delete mode 100644 libtool/lt_error.go delete mode 100644 libtool/lt_system.go delete mode 100644 libtool/ltdl.go delete mode 100644 libxml2/HTMLparser.go delete mode 100644 libxml2/HTMLtree.go delete mode 100644 libxml2/SAX.go delete mode 100644 libxml2/SAX2.go delete mode 100644 libxml2/_demo/hello/hello.go delete mode 100644 libxml2/c14n.go delete mode 100644 libxml2/catalog.go delete mode 100644 libxml2/chvalid.go delete mode 100644 libxml2/debugXML.go delete mode 100644 libxml2/dict.go delete mode 100644 libxml2/encoding.go delete mode 100644 libxml2/entities.go delete mode 100644 libxml2/globals.go delete mode 100644 libxml2/go.mod delete mode 100644 libxml2/go.sum delete mode 100644 libxml2/hash.go delete mode 100644 libxml2/libxml2_autogen_link.go delete mode 100644 libxml2/list.go delete mode 100644 libxml2/llcppg.cfg delete mode 100644 libxml2/llcppg.pub delete mode 100644 libxml2/llpkg.cfg delete mode 100644 libxml2/nanoftp.go delete mode 100644 libxml2/nanohttp.go delete mode 100644 libxml2/parser.go delete mode 100644 libxml2/parserInternals.go delete mode 100644 libxml2/pattern.go delete mode 100644 libxml2/relaxng.go delete mode 100644 libxml2/schemasInternals.go delete mode 100644 libxml2/schematron.go delete mode 100644 libxml2/threads.go delete mode 100644 libxml2/tree.go delete mode 100644 libxml2/uri.go delete mode 100644 libxml2/valid.go delete mode 100644 libxml2/xinclude.go delete mode 100644 libxml2/xlink.go delete mode 100644 libxml2/xmlIO.go delete mode 100644 libxml2/xmlautomata.go delete mode 100644 libxml2/xmlerror.go delete mode 100644 libxml2/xmlexports.go delete mode 100644 libxml2/xmlmemory.go delete mode 100644 libxml2/xmlmodule.go delete mode 100644 libxml2/xmlreader.go delete mode 100644 libxml2/xmlregexp.go delete mode 100644 libxml2/xmlsave.go delete mode 100644 libxml2/xmlschemas.go delete mode 100644 libxml2/xmlschemastypes.go delete mode 100644 libxml2/xmlstring.go delete mode 100644 libxml2/xmlunicode.go delete mode 100644 libxml2/xmlversion.go delete mode 100644 libxml2/xmlwriter.go delete mode 100644 libxml2/xpath.go delete mode 100644 libxml2/xpathInternals.go delete mode 100644 libxml2/xpointer.go delete mode 100644 libxslt/_demo/withdeplibxml/demo.go delete mode 100644 libxslt/attributes.go delete mode 100644 libxslt/documents.go delete mode 100644 libxslt/exslt.go delete mode 100644 libxslt/exsltconfig.go delete mode 100644 libxslt/exsltexports.go delete mode 100644 libxslt/extensions.go delete mode 100644 libxslt/extra.go delete mode 100644 libxslt/functions.go delete mode 100644 libxslt/go.mod delete mode 100644 libxslt/go.sum delete mode 100644 libxslt/imports.go delete mode 100644 libxslt/keys.go delete mode 100644 libxslt/libxslt_autogen_link.go delete mode 100644 libxslt/llcppg.cfg delete mode 100644 libxslt/llcppg.pub delete mode 100644 libxslt/llpkg.cfg delete mode 100644 libxslt/namespaces.go delete mode 100644 libxslt/numbersInternals.go delete mode 100644 libxslt/pattern.go delete mode 100644 libxslt/preproc.go delete mode 100644 libxslt/security.go delete mode 100644 libxslt/templates.go delete mode 100644 libxslt/transform.go delete mode 100644 libxslt/variables.go delete mode 100644 libxslt/xslt.go delete mode 100644 libxslt/xsltInternals.go delete mode 100644 libxslt/xsltconfig.go delete mode 100644 libxslt/xsltexports.go delete mode 100644 libxslt/xsltlocale.go delete mode 100644 libxslt/xsltutils.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go delete mode 100644 sqlite3/_demo/hello/hello.go delete mode 100644 sqlite3/go.mod delete mode 100644 sqlite3/go.sum delete mode 100644 sqlite3/llcppg.cfg delete mode 100644 sqlite3/llcppg.pub delete mode 100644 sqlite3/llpkg.cfg delete mode 100644 sqlite3/sqlite3.go delete mode 100644 sqlite3/sqlite3_autogen_link.go delete mode 100644 sqlite3/sqlite3ext.go delete mode 100644 zlib/_demo/crc32demo/demo.go delete mode 100644 zlib/_demo/efficiency/efficiency.go delete mode 100644 zlib/_demo/normal/normal.go delete mode 100644 zlib/go.mod delete mode 100644 zlib/go.sum delete mode 100644 zlib/llcppg.cfg delete mode 100644 zlib/llcppg.pub delete mode 100644 zlib/llpkg.cfg delete mode 100644 zlib/zconf.go delete mode 100644 zlib/zlib.go delete mode 100644 zlib/zlib_autogen_link.go diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 8b5b7aab..c4021ab1 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -34,13 +34,13 @@ jobs: with: repository: '1351914167/llgo' path: .llgo - ref: go_get_v1 + ref: presentation - name: Check out LLPyg uses: actions/checkout@v4 with: repository: 'toaction/llpyg' path: .llpyg - ref: feat/llpyg_v3 + ref: presentation - name: Set up Go uses: actions/setup-go@v4 with: diff --git a/README.md b/README.md index c9ef7c12..97313bd6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # llpkg -LLGo packages generated by llcppg +LLGo packages generated by llpyg diff --git a/bzip2/_demo/compress/compress.go b/bzip2/_demo/compress/compress.go deleted file mode 100644 index 6c17f3ca..00000000 --- a/bzip2/_demo/compress/compress.go +++ /dev/null @@ -1,60 +0,0 @@ -package main - -import ( - "fmt" - "unsafe" - - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/bzip2" -) - -func CompressFile(inPath, outPath string) error { - inPathC := c.AllocaCStr(inPath) - - inFile := c.Fopen(inPathC, c.Str("rb")) - if inFile == nil { - return fmt.Errorf("failed to open input file: %s", inPath) - } - defer c.Fclose(inFile) - - outPathC := c.AllocaCStr(outPath) - outFile := c.Fopen(outPathC, c.Str("wb")) - if outFile == nil { - return fmt.Errorf("failed to open output file: %s", outPath) - } - defer c.Fclose(outFile) - - var bzerr c.Int - bzfile := bzip2.WriteOpen(&bzerr, outFile, 9, 0, 30) - if bzfile == nil || bzerr != bzip2.OK { - return fmt.Errorf("BzWriteOpen error, code=%d", bzerr) - } - - buf := make([]byte, 4096) - for { - n := c.Fread(unsafe.Pointer(&buf[0]), 1, uintptr(len(buf)), inFile) - if n == 0 { - break - } - - bzip2.Write(&bzerr, bzfile, unsafe.Pointer(&buf[0]), c.Int(n)) - if bzerr != bzip2.OK { - return fmt.Errorf("BzWrite error, code=%d", bzerr) - } - - if n < uintptr(len(buf)) { - break - } - } - - bzip2.WriteClose(&bzerr, bzfile, 0, nil, nil) - if bzerr != bzip2.OK { - return fmt.Errorf("BzWriteClose error, code=%d", bzerr) - } - - return nil -} - -func main() { - CompressFile("test.txt", "../decompress/test.bz2") -} diff --git a/bzip2/_demo/compress/test.txt b/bzip2/_demo/compress/test.txt deleted file mode 100644 index 97b5955f..00000000 --- a/bzip2/_demo/compress/test.txt +++ /dev/null @@ -1 +0,0 @@ -12345678 diff --git a/bzip2/_demo/decompress/decompress.go b/bzip2/_demo/decompress/decompress.go deleted file mode 100644 index 829e9c9c..00000000 --- a/bzip2/_demo/decompress/decompress.go +++ /dev/null @@ -1,76 +0,0 @@ -package main - -import ( - "fmt" - "log" - "os" - "unsafe" - - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/bzip2" -) - -func DecompressFile(inPath, outPath string) error { - inPathC := c.AllocaCStr(inPath) - - inFile := c.Fopen(inPathC, c.Str("rb")) - if inFile == nil { - return fmt.Errorf("failed to open input file: %s", inPath) - } - defer c.Fclose(inFile) - - outPathC := c.AllocaCStr(outPath) - - outFile := c.Fopen(outPathC, c.Str("wb")) - if outFile == nil { - return fmt.Errorf("failed to open output file: %s", outPath) - } - defer c.Fclose(outFile) - - var bzerr c.Int - bzfile := bzip2.ReadOpen(&bzerr, inFile, 0, 0, nil, 0) - if bzfile == nil || bzerr != bzip2.OK { - return fmt.Errorf("BzReadOpen error, code=%d", bzerr) - } - - buf := make([]byte, 4096) - for { - n := bzip2.Read(&bzerr, bzfile, unsafe.Pointer(&buf[0]), c.Int(len(buf))) - if bzerr == bzip2.STREAM_END { - if n > 0 { - c.Fwrite(unsafe.Pointer(&buf[0]), 1, uintptr(n), outFile) - } - break - } - - if bzerr != bzip2.OK && bzerr != bzip2.STREAM_END { - return fmt.Errorf("BzRead error, code=%d", bzerr) - } - if n > 0 { - c.Fwrite(unsafe.Pointer(&buf[0]), 1, uintptr(n), outFile) - } else { - break - } - } - - bzip2.ReadClose(&bzerr, bzfile) - if bzerr != bzip2.OK { - return fmt.Errorf("BzReadClose error, code=%d", bzerr) - } - - return nil -} - -func main() { - err := DecompressFile("test.bz2", "ttt.test") - if err != nil { - panic(err) - } - - b, err := os.ReadFile("ttt.test") - if err != nil { - panic(err) - } - - log.Println(string(b)) -} diff --git a/bzip2/bzip2_autogen_link.go b/bzip2/bzip2_autogen_link.go deleted file mode 100644 index f1d39d69..00000000 --- a/bzip2/bzip2_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package bzip2 - -import _ "github.com/goplus/lib/c" - -const LLGoPackage string = "link: $(pkg-config --libs bzip2);" diff --git a/bzip2/bzlib.go b/bzip2/bzlib.go deleted file mode 100644 index edda4025..00000000 --- a/bzip2/bzlib.go +++ /dev/null @@ -1,136 +0,0 @@ -package bzip2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const RUN = 0 -const FLUSH = 1 -const FINISH = 2 -const OK = 0 -const RUN_OK = 1 -const FLUSH_OK = 2 -const FINISH_OK = 3 -const STREAM_END = 4 -const MAX_UNUSED = 5000 - -type BzStream struct { - NextIn *c.Char - AvailIn c.Uint - TotalInLo32 c.Uint - TotalInHi32 c.Uint - NextOut *c.Char - AvailOut c.Uint - TotalOutLo32 c.Uint - TotalOutHi32 c.Uint - State c.Pointer - Bzalloc c.Pointer - Bzfree c.Pointer - Opaque c.Pointer -} - -/*-- Core (low-level) library functions --*/ -// llgo:link (*BzStream).CompressInit C.BZ2_bzCompressInit -func (recv_ *BzStream) CompressInit(blockSize100k c.Int, verbosity c.Int, workFactor c.Int) c.Int { - return 0 -} - -// llgo:link (*BzStream).Compress C.BZ2_bzCompress -func (recv_ *BzStream) Compress(action c.Int) c.Int { - return 0 -} - -// llgo:link (*BzStream).CompressEnd C.BZ2_bzCompressEnd -func (recv_ *BzStream) CompressEnd() c.Int { - return 0 -} - -// llgo:link (*BzStream).DecompressInit C.BZ2_bzDecompressInit -func (recv_ *BzStream) DecompressInit(verbosity c.Int, small c.Int) c.Int { - return 0 -} - -// llgo:link (*BzStream).Decompress C.BZ2_bzDecompress -func (recv_ *BzStream) Decompress() c.Int { - return 0 -} - -// llgo:link (*BzStream).DecompressEnd C.BZ2_bzDecompressEnd -func (recv_ *BzStream) DecompressEnd() c.Int { - return 0 -} - -type BZFILE c.Void - -//go:linkname ReadOpen C.BZ2_bzReadOpen -func ReadOpen(bzerror *c.Int, f *c.FILE, verbosity c.Int, small c.Int, unused c.Pointer, nUnused c.Int) *BZFILE - -//go:linkname ReadClose C.BZ2_bzReadClose -func ReadClose(bzerror *c.Int, b *BZFILE) - -//go:linkname ReadGetUnused C.BZ2_bzReadGetUnused -func ReadGetUnused(bzerror *c.Int, b *BZFILE, unused *c.Pointer, nUnused *c.Int) - -//go:linkname Read C.BZ2_bzRead -func Read(bzerror *c.Int, b *BZFILE, buf c.Pointer, len c.Int) c.Int - -//go:linkname WriteOpen C.BZ2_bzWriteOpen -func WriteOpen(bzerror *c.Int, f *c.FILE, blockSize100k c.Int, verbosity c.Int, workFactor c.Int) *BZFILE - -//go:linkname Write C.BZ2_bzWrite -func Write(bzerror *c.Int, b *BZFILE, buf c.Pointer, len c.Int) - -//go:linkname WriteClose C.BZ2_bzWriteClose -func WriteClose(bzerror *c.Int, b *BZFILE, abandon c.Int, nbytes_in *c.Uint, nbytes_out *c.Uint) - -//go:linkname WriteClose64 C.BZ2_bzWriteClose64 -func WriteClose64(bzerror *c.Int, b *BZFILE, abandon c.Int, nbytes_in_lo32 *c.Uint, nbytes_in_hi32 *c.Uint, nbytes_out_lo32 *c.Uint, nbytes_out_hi32 *c.Uint) - -/*-- Utility functions --*/ -//go:linkname BuffToBuffCompress C.BZ2_bzBuffToBuffCompress -func BuffToBuffCompress(dest *c.Char, destLen *c.Uint, source *c.Char, sourceLen c.Uint, blockSize100k c.Int, verbosity c.Int, workFactor c.Int) c.Int - -//go:linkname BuffToBuffDecompress C.BZ2_bzBuffToBuffDecompress -func BuffToBuffDecompress(dest *c.Char, destLen *c.Uint, source *c.Char, sourceLen c.Uint, small c.Int, verbosity c.Int) c.Int - -/*-- - Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) - to support better zlib compatibility. - This code is not _officially_ part of libbzip2 (yet); - I haven't tested it, documented it, or considered the - threading-safeness of it. - If this code breaks, please contact both Yoshioka and me. ---*/ -//go:linkname LibVersion C.BZ2_bzlibVersion -func LibVersion() *c.Char - -//go:linkname Open C.BZ2_bzopen -func Open(path *c.Char, mode *c.Char) *BZFILE - -//go:linkname Dopen C.BZ2_bzdopen -func Dopen(fd c.Int, mode *c.Char) *BZFILE - -// llgo:link (*BZFILE).Read C.BZ2_bzread -func (recv_ *BZFILE) Read(buf c.Pointer, len c.Int) c.Int { - return 0 -} - -// llgo:link (*BZFILE).Write C.BZ2_bzwrite -func (recv_ *BZFILE) Write(buf c.Pointer, len c.Int) c.Int { - return 0 -} - -// llgo:link (*BZFILE).Flush C.BZ2_bzflush -func (recv_ *BZFILE) Flush() c.Int { - return 0 -} - -// llgo:link (*BZFILE).Close C.BZ2_bzclose -func (recv_ *BZFILE) Close() { -} - -// llgo:link (*BZFILE).Error C.BZ2_bzerror -func (recv_ *BZFILE) Error(errnum *c.Int) *c.Char { - return nil -} diff --git a/bzip2/go.mod b/bzip2/go.mod deleted file mode 100644 index faff6f92..00000000 --- a/bzip2/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/bzip2 - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/bzip2/go.sum b/bzip2/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/bzip2/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/bzip2/llcppg.cfg b/bzip2/llcppg.cfg deleted file mode 100644 index 69bdae9e..00000000 --- a/bzip2/llcppg.cfg +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "bzip2", - "cflags": "$(pkg-config --cflags bzip2)", - "libs": "$(pkg-config --libs bzip2)", - "include": [ - "bzlib.h" - ], - "trimPrefixes": ["BZ2_bz", "BZ_"], - "cplusplus": false, - "deps": [], - "keepUnderScore": false, - "impl": [ - { - "files": [], - "cond": { - "os": [], - "arch": [] - } - } - ], - "mix": false -} diff --git a/bzip2/llcppg.pub b/bzip2/llcppg.pub deleted file mode 100644 index 7fb1577a..00000000 --- a/bzip2/llcppg.pub +++ /dev/null @@ -1,2 +0,0 @@ -BZFILE -bz_stream BzStream \ No newline at end of file diff --git a/bzip2/llpkg.cfg b/bzip2/llpkg.cfg deleted file mode 100644 index f50083df..00000000 --- a/bzip2/llpkg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "upstream": { - "package": { - "name": "bzip2", - "version": "1.0.8" - } - } -} diff --git a/bzip3/_demo/test/test.go b/bzip3/_demo/test/test.go deleted file mode 100644 index 2068b849..00000000 --- a/bzip3/_demo/test/test.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/goplus/lib/c" - zip "github.com/goplus/llpkg/bzip3" -) - -func main() { - fmt.Println(c.GoString(zip.Version())) - input := []byte("Hello, bzip3 compression!") - output := make([]byte, zip.Bound(uintptr(len(input)))) - outputSize := uintptr(len(output)) - - errCode := zip.Compress(1024*1024, &input[0], &output[0], uintptr(len(input)), &outputSize) - if errCode != zip.OK { - fmt.Println("Compression failed with error code:", errCode) - return - } - fmt.Println("Compression successful. Compressed size:", outputSize) - - decompressed := make([]byte, len(input)) - decompressedSize := uintptr(len(decompressed)) - errCode = zip.Decompress(&output[0], &decompressed[0], outputSize, &decompressedSize) - if errCode != zip.OK { - fmt.Println("Decompression failed with error code:", errCode) - return - } - fmt.Println("Decompression successful. Decompressed data:", string(decompressed)) -} diff --git a/bzip3/bzip3_autogen_link.go b/bzip3/bzip3_autogen_link.go deleted file mode 100644 index 033ac646..00000000 --- a/bzip3/bzip3_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package bzip3 - -import _ "github.com/goplus/lib/c" - -const LLGoPackage string = "link: $(pkg-config --libs bzip3);" diff --git a/bzip3/go.mod b/bzip3/go.mod deleted file mode 100644 index 93fd945d..00000000 --- a/bzip3/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/bzip3 - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/bzip3/go.sum b/bzip3/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/bzip3/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/bzip3/libbz3.go b/bzip3/libbz3.go deleted file mode 100644 index 2c93f6ef..00000000 --- a/bzip3/libbz3.go +++ /dev/null @@ -1,188 +0,0 @@ -package bzip3 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const OK = 0 - -type State struct { - Unused [8]uint8 -} - -/** - * @brief Get bzip3 version. - */ -//go:linkname Version C.bz3_version -func Version() *c.Char - -/** - * @brief Get the last error number associated with a given state. - */ -// llgo:link (*State).LastError C.bz3_last_error -func (recv_ *State) LastError() c.Int8T { - return 0 -} - -/** - * @brief Return a user-readable message explaining the cause of the last error. - */ -// llgo:link (*State).Strerror C.bz3_strerror -func (recv_ *State) Strerror() *c.Char { - return nil -} - -/** - * @brief Construct a new block encoder state, which will encode blocks as big as the given block size. - * The decoder will be able to decode blocks at most as big as the given block size. - * Returns NULL in case allocation fails or the block size is not between 65K and 511M - */ -//go:linkname New C.bz3_new -func New(block_size c.Int32T) *State - -/** - * @brief Free the memory occupied by a block encoder state. - */ -// llgo:link (*State).Free C.bz3_free -func (recv_ *State) Free() { -} - -/** - * @brief Return the recommended size of the output buffer for the compression functions. - */ -//go:linkname Bound C.bz3_bound -func Bound(input_size c.SizeT) c.SizeT - -/** - * @brief Compress a frame. This function does not support parallelism - * by itself, consider using the low level `bz3_encode_blocks()` function instead. - * Using the low level API might provide better performance. - * Returns a bzip3 error code; BZ3_OK when the operation is successful. - * Make sure to set out_size to the size of the output buffer before the operation; - * out_size must be at least equal to `bz3_bound(in_size)'. - */ -//go:linkname Compress C.bz3_compress -func Compress(block_size c.Uint32T, in *c.Uint8T, out *c.Uint8T, in_size c.SizeT, out_size *c.SizeT) c.Int - -/** - * @brief Decompress a frame. This function does not support parallelism - * by itself, consider using the low level `bz3_decode_blocks()` function instead. - * Using the low level API might provide better performance. - * Returns a bzip3 error code; BZ3_OK when the operation is successful. - * Make sure to set out_size to the size of the output buffer before the operation. - */ -//go:linkname Decompress C.bz3_decompress -func Decompress(in *c.Uint8T, out *c.Uint8T, in_size c.SizeT, out_size *c.SizeT) c.Int - -/** - * @brief Calculate the minimal memory required for compression with the given block size. - * This includes all internal buffers and state structures. This calculates the amount of bytes - * that will be allocated by a call to `bz3_new()`. - * - * @details Memory allocation and usage patterns: - * - * bz3_new(): - * - Allocates all memory upfront: - * - Core state structure (sizeof(struct bz3_state)) - * - Swap buffer (bz3_bound(block_size) bytes) - * - SAIS array (BWT_BOUND(block_size) * sizeof(int32_t) bytes) - * - LZP lookup table ((1 << LZP_DICTIONARY) * sizeof(int32_t) bytes) - * - Compression state (sizeof(state)) - * - All memory remains allocated until bz3_free() - * - * Additional memory may be used depending on API used from here. - * - * # Low Level APIs - * - * 1. bz3_encode_block() / bz3_decode_block(): - * - Uses pre-allocated memory from bz3_new() - * - No additional memory allocation except for libsais (usually ~16KiB) - * - Peak memory usage of physical RAM varies with compression stages: - * - LZP: Uses LZP lookup table + swap buffer - * - BWT: Uses SAIS array + swap buffer - * - Entropy coding: Uses compression state (cm_state) + swap buffer - * - * Using the higher level API, `bz3_compress`, expect an additional allocation - * of `bz3_bound(block_size)`. - * - * In the parallel version `bz3_encode_blocks`, each thread gets its own state, - * so memory usage is `n_threads * bz3_compress_memory_needed()`. - * - * # High Level APIs - * - * 1. bz3_compress(): - * - Allocates additional temporary compression buffer (bz3_bound(block_size) bytes) - * in addition to the memory amount returned by this method call and libsais. - * - Everything is freed after compression completes - * - * 2. bz3_decompress(): - * - Allocates additional temporary compression buffer (bz3_bound(block_size) bytes) - * in addition to the memory amount returned by this method call and libsais. - * - Everything is freed after compression completes - * - * Memory remains constant during operation, with except of some small allocations from libsais during - * BWT stage. That is not accounted by this function, though it usually amounts to ~16KiB, negligible. - * The worst case of BWT is 2*block_size technically speaking. - * - * No dynamic (re)allocation occurs outside of that. - * - * @param block_size The block size to be used for compression - * @return The total number of bytes required for compression, or 0 if block_size is invalid - */ -//go:linkname MinMemoryNeeded C.bz3_min_memory_needed -func MinMemoryNeeded(block_size c.Int32T) c.SizeT - -/** - * @brief Encode a single block. Returns the amount of bytes written to `buffer'. - * `buffer' must be able to hold at least `bz3_bound(size)' bytes. The size must not - * exceed the block size associated with the state. - */ -// llgo:link (*State).EncodeBlock C.bz3_encode_block -func (recv_ *State) EncodeBlock(buffer *c.Uint8T, size c.Int32T) c.Int32T { - return 0 -} - -/** - * @brief Decode a single block. - * - * `buffer' must be able to hold at least `bz3_bound(orig_size)' bytes - * in order to ensure decompression will succeed for all possible bzip3 blocks. - * - * In most (but not all) cases, `orig_size` should usually be sufficient. - * If it is not sufficient, you must allocate a buffer of size `bz3_bound(orig_size)` temporarily. - * - * If `buffer_size` is too small, `BZ3_ERR_DATA_SIZE_TOO_SMALL` will be returned. - * The size must not exceed the block size associated with the state. - * - * @param buffer_size The size of the buffer at 'buffer' - * @param compressed_size The size of the compressed data in 'buffer' - * @param orig_size The original size of the data before compression. - */ -// llgo:link (*State).DecodeBlock C.bz3_decode_block -func (recv_ *State) DecodeBlock(buffer *c.Uint8T, buffer_size c.SizeT, compressed_size c.Int32T, orig_size c.Int32T) c.Int32T { - return 0 -} - -/** - * @brief Check if using original file size as buffer size is sufficient for decompressing - * a block at `block` pointer. - * - * @param block Pointer to the compressed block data - * @param block_size Size of the block buffer in bytes (must be at least 13 bytes for header) - * @param orig_size Size of the original uncompressed data - * @return 1 if original size is sufficient, 0 if insufficient, -1 on header error (insufficient buffer size) - * - * @remarks - * - * This function is useful for external APIs using the low level block encoding API, - * `bz3_encode_block`. You would normally call this directly after `bz3_encode_block` - * on the block that has been output. - * - * The purpose of this function is to prevent encoding blocks that would require an additional - * malloc at decompress time. - * The goal is to prevent erroring with `BZ3_ERR_DATA_SIZE_TOO_SMALL`, thus - * in turn - */ -//go:linkname OrigSizeSufficientForDecode C.bz3_orig_size_sufficient_for_decode -func OrigSizeSufficientForDecode(block *c.Uint8T, block_size c.SizeT, orig_size c.Int32T) c.Int diff --git a/bzip3/llcppg.cfg b/bzip3/llcppg.cfg deleted file mode 100644 index 2d1240e0..00000000 --- a/bzip3/llcppg.cfg +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "bzip3", - "cflags": "$(pkg-config --cflags bzip3)", - "libs": "$(pkg-config --libs bzip3)", - "include": [ - "libbz3.h" - ], - "trimPrefixes": ["bz3_","BZ3_"], - "cplusplus": false, - "deps": [], - "keepUnderScore": false, - "impl": [ - { - "files": [], - "cond": { - "os": [], - "arch": [] - } - } - ], - "mix": false -} diff --git a/bzip3/llcppg.pub b/bzip3/llcppg.pub deleted file mode 100644 index 42f9c942..00000000 --- a/bzip3/llcppg.pub +++ /dev/null @@ -1 +0,0 @@ -bz3_state State \ No newline at end of file diff --git a/bzip3/llpkg.cfg b/bzip3/llpkg.cfg deleted file mode 100644 index db765289..00000000 --- a/bzip3/llpkg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "upstream": { - "package": { - "name": "bzip3", - "version": "1.5.1" - } - } -} \ No newline at end of file diff --git a/cargs/_demo/test/test.go b/cargs/_demo/test/test.go deleted file mode 100644 index 138f1a05..00000000 --- a/cargs/_demo/test/test.go +++ /dev/null @@ -1,59 +0,0 @@ -package main - -import ( - "fmt" - "os" - - C "github.com/goplus/lib/c" - "github.com/goplus/llpkg/cargs" -) - -func main() { - // Define command-line options - options := []cargs.Option{ - { - Identifier: 'h', - AccessLetters: C.Str("h"), - AccessName: C.Str("help"), - ValueName: nil, - Description: C.Str("Show help information"), - }, - { - Identifier: 'v', - AccessLetters: C.Str("v"), - AccessName: C.Str("version"), - ValueName: nil, - Description: C.Str("Show version information"), - }, - } - - args := os.Args - - // Convert Go string array to C-style argv - argv := make([]*int8, len(args)) - for i, arg := range args { - argv[i] = C.AllocaCStr(arg) - } - - // Initialize option context - var context cargs.OptionContext - context.OptionInit(&options[0], uintptr(len(options)), C.Int(len(args)), &argv[0]) - - // Process all options - identifierFound := false - for context.OptionFetch() { - identifierFound = true - identifier := context.OptionGetIdentifier() - switch identifier { - case 'h': - fmt.Println("Help: This is a simple command-line parser demo") - case 'v': - fmt.Println("Version: 1.0.0") - } - } - - // Default output if no identifier is found - if !identifierFound { - fmt.Println("Demo Command-line Tool\nIdentifier:\n\t-h: Help\n\t-v: Version") - } -} diff --git a/cargs/cargs.go b/cargs/cargs.go deleted file mode 100644 index 948fd080..00000000 --- a/cargs/cargs.go +++ /dev/null @@ -1,228 +0,0 @@ -package cargs - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -/** - * An option is used to describe a flag/argument option submitted when the - * program is run. - */ - -type Option struct { - Identifier c.Char - AccessLetters *c.Char - AccessName *c.Char - ValueName *c.Char - Description *c.Char -} - -/** - * A context is used to iterate over all options provided. It stores the parsing - * state. - */ - -type OptionContext struct { - Options *Option - OptionCount c.SizeT - Argc c.Int - Argv **c.Char - Index c.Int - InnerIndex c.Int - ErrorIndex c.Int - ErrorLetter c.Char - ForcedEnd bool - Identifier c.Char - Value *c.Char -} - -// llgo:type C -type Printer func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) c.Int - -/** - * @brief Prepare argument options context for parsing. - * - * This function prepares the context for iteration and initializes the context - * with the supplied options and arguments. After the context has been prepared, - * it can be used to fetch arguments from it. - * - * @param context The context which will be initialized. - * @param options The registered options which are available for the program. - * @param option_count The amount of options which are available for the - * program. - * @param argc The amount of arguments the user supplied in the main function. - * @param argv A pointer to the arguments of the main function. - */ -// llgo:link (*OptionContext).OptionInit C.cag_option_init -func (recv_ *OptionContext) OptionInit(options *Option, option_count c.SizeT, argc c.Int, argv **c.Char) { -} - -/** - * @brief Fetches an option from the argument list. - * - * This function fetches a single option from the argument list. The context - * will be moved to that item. Information can be extracted from the context - * after the item has been fetched. - * The arguments will be re-ordered, which means that non-option arguments will - * be moved to the end of the argument list. After all options have been - * fetched, all non-option arguments will be positioned after the index of - * the context. - * - * @param context The context from which we will fetch the option. - * @return Returns true if there was another option or false if the end is - * reached. - */ -// llgo:link (*OptionContext).OptionFetch C.cag_option_fetch -func (recv_ *OptionContext) OptionFetch() bool { - return false -} - -/** - * @brief Gets the identifier of the option. - * - * This function gets the identifier of the option, which should be unique to - * this option and can be used to determine what kind of option this is. - * - * @param context The context from which the option was fetched. - * @return Returns the identifier of the option. - */ -// llgo:link (*OptionContext).OptionGetIdentifier C.cag_option_get_identifier -func (recv_ *OptionContext) OptionGetIdentifier() c.Char { - return 0 -} - -/** - * @brief Gets the value from the option. - * - * This function gets the value from the option, if any. If the option does not - * contain a value, this function will return NULL. - * - * @param context The context from which the option was fetched. - * @return Returns a pointer to the value or NULL if there is no value. - */ -// llgo:link (*OptionContext).OptionGetValue C.cag_option_get_value -func (recv_ *OptionContext) OptionGetValue() *c.Char { - return nil -} - -/** - * @brief Gets the current index of the context. - * - * This function gets the index within the argv arguments of the context. The - * context always points to the next item which it will inspect. This is - * particularly useful to inspect the original argument array, or to get - * non-option arguments after option fetching has finished. - * - * @param context The context from which the option was fetched. - * @return Returns the current index of the context. - */ -// llgo:link (*OptionContext).OptionGetIndex C.cag_option_get_index -func (recv_ *OptionContext) OptionGetIndex() c.Int { - return 0 -} - -/** - * @brief Retrieves the index of an invalid option. - * - * This function retrieves the index of an invalid option if the provided option - * does not match any of the options specified in the `cag_option` list. This is - * particularly useful when detailed information about an invalid option is - * required. - * - * @param context Pointer to the context from which the option was fetched. - * @return Returns the index of the invalid option, or -1 if it is not invalid. - */ -// llgo:link (*OptionContext).OptionGetErrorIndex C.cag_option_get_error_index -func (recv_ *OptionContext) OptionGetErrorIndex() c.Int { - return 0 -} - -/** - * @brief Retrieves the letter character of the invalid option. - * - * This function retrieves the character of the invalid option character - * if the provided option does not match any of the options specified in the - * `cag_option` list. - * - * @param context Pointer to the context from which the option was fetched. - * @return Returns the letter that was unknown, or 0 otherwise. - */ -// llgo:link (*OptionContext).OptionGetErrorLetter C.cag_option_get_error_letter -func (recv_ *OptionContext) OptionGetErrorLetter() c.Char { - return 0 -} - -/** - * @brief Prints the error associated with the invalid option to the specified - * destination. - * - * This function prints information about the error associated with the invalid - * option to the specified destination (such as a file stream). It helps in - * displaying the error of the current context. - * - * @param context Pointer to the context from which the option was fetched. - * @param destination Pointer to the file stream where the error information - * will be printed. - */ -// llgo:link (*OptionContext).OptionPrintError C.cag_option_print_error -func (recv_ *OptionContext) OptionPrintError(destination *c.FILE) { -} - -/** - * @brief Prints the error associated with the invalid option using user - * callback. - * - * This function prints information about the error associated with the invalid - * option using user callback. Callback prototype is same with fprintf. It helps - * in displaying the error of the current context. - * - * @param context Pointer to the context from which the option was fetched. - * @param printer The printer callback function. For example fprintf. - * @param printer_ctx The parameter for printer callback. For example fprintf - * could use parameter stderr. - */ -// llgo:link (*OptionContext).OptionPrinterError C.cag_option_printer_error -func (recv_ *OptionContext) OptionPrinterError(printer Printer, printer_ctx c.Pointer) { -} - -/** - * @brief Prints all options to the terminal. - * - * This function prints all options to the terminal. This can be used to - * generate the output for a "--help" option. - * - * @param options The options which will be printed. - * @param option_count The option count which will be printed. - * @param destination The destination where the output will be printed. - */ -// llgo:link (*Option).OptionPrint C.cag_option_print -func (recv_ *Option) OptionPrint(option_count c.SizeT, destination *c.FILE) { -} - -/** - * @brief Prints all options using user callback. - * - * This function prints all options using user callback. This can be used to - * generate the output for a "--help" option. - * Using user callback is useful in tiny system without FILE support - * - * @param options The options which will be printed. - * @param option_count The option count which will be printed. - * @param destination The destination where the output will be printed. - * @param printer The printer callback function. For example fprintf. - * @param printer_ctx The parameter for printer callback. For example fprintf - * could use parameter stderr. - */ -// llgo:link (*Option).OptionPrinter C.cag_option_printer -func (recv_ *Option) OptionPrinter(option_count c.SizeT, printer Printer, printer_ctx c.Pointer) { -} - -// llgo:link (*OptionContext).OptionPrepare C.cag_option_prepare -func (recv_ *OptionContext) OptionPrepare(options *Option, option_count c.SizeT, argc c.Int, argv **c.Char) { -} - -// llgo:link (*OptionContext).OptionGet C.cag_option_get -func (recv_ *OptionContext) OptionGet() c.Char { - return 0 -} diff --git a/cargs/cargs_autogen_link.go b/cargs/cargs_autogen_link.go deleted file mode 100644 index 405e22a0..00000000 --- a/cargs/cargs_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package cargs - -import _ "github.com/goplus/lib/c" - -const LLGoPackage string = "link: $(pkg-config --libs cargs);" diff --git a/cargs/go.mod b/cargs/go.mod deleted file mode 100644 index 3dcf9421..00000000 --- a/cargs/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/cargs - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/cargs/go.sum b/cargs/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/cargs/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/cargs/llcppg.cfg b/cargs/llcppg.cfg deleted file mode 100644 index 60172b9e..00000000 --- a/cargs/llcppg.cfg +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "cargs", - "cflags": "$(pkg-config --cflags cargs)", - "libs": "$(pkg-config --libs cargs)", - "include": [ - "cargs.h" - ], - "trimPrefixes": ["cag_"], - "cplusplus": false, - "deps": [], - "keepUnderScore": false, - "impl": [ - { - "files": [], - "cond": { - "os": [], - "arch": [] - } - } - ], - "mix": false -} diff --git a/cargs/llcppg.pub b/cargs/llcppg.pub deleted file mode 100644 index d01e605a..00000000 --- a/cargs/llcppg.pub +++ /dev/null @@ -1,3 +0,0 @@ -cag_option Option -cag_option_context OptionContext -cag_printer Printer \ No newline at end of file diff --git a/cargs/llpkg.cfg b/cargs/llpkg.cfg deleted file mode 100644 index 211267f5..00000000 --- a/cargs/llpkg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "upstream": { - "package": { - "name": "cargs", - "version": "1.2.0" - } - } -} \ No newline at end of file diff --git a/cjson/_demo/hello/hello.go b/cjson/_demo/hello/hello.go deleted file mode 100644 index c8bdc11c..00000000 --- a/cjson/_demo/hello/hello.go +++ /dev/null @@ -1,50 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/goplus/llpkg/cjson" - - "github.com/goplus/lib/c" -) - -func main() { - mod := cjson.Object() - mod.SetItem(c.Str("name"), cjson.String(c.Str("math"))) - - syms := cjson.Array() - - fn := cjson.Object() - fn.SetItem(c.Str("name"), cjson.String(c.Str("sqrt"))) - fn.SetItem(c.Str("sig"), cjson.String(c.Str("(x, /)"))) - syms.AddItem(fn) - - v := cjson.Object() - v.SetItem(c.Str("name"), cjson.String(c.Str("pi"))) - syms.AddItem(v) - - mod.SetItem(c.Str("items"), syms) - - cstr := mod.CStr() - str := c.GoString(cstr) - c.Printf(c.Str("%s\n"), cstr) - cjson.FreeCStr(unsafe.Pointer(cstr)) - - mod.Delete() - - cjsonLoad(str) -} - -func cjsonLoad(str string) { - mod := ParseString(str) - - cstr := mod.Print() - c.Printf(c.Str("%s\n"), cstr) - cjson.FreeCStr(unsafe.Pointer(cstr)) - - mod.Delete() -} - -func ParseString(value string) *cjson.JSON { - return cjson.ParseWithLength((*c.Char)(unsafe.Pointer(unsafe.StringData(value))), uintptr(len(value))) -} diff --git a/cjson/cJSON.go b/cjson/cJSON.go deleted file mode 100644 index 5d725b7c..00000000 --- a/cjson/cJSON.go +++ /dev/null @@ -1,416 +0,0 @@ -package cjson - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const VERSION_MAJOR = 1 -const VERSION_MINOR = 7 -const VERSION_PATCH = 18 -const IsReference = 256 -const StringIsConst = 512 -const NESTING_LIMIT = 1000 - -/* The cJSON structure: */ - -type JSON struct { - Next *JSON - Prev *JSON - Child *JSON - Type c.Int - Valuestring *c.Char - Valueint c.Int - Valuedouble c.Double - String *c.Char -} - -type Hooks struct { - MallocFn c.Pointer - FreeFn c.Pointer -} -type Bool c.Int - -/* returns the version of cJSON as a string */ -//go:linkname Version C.cJSON_Version -func Version() *c.Char - -/* Supply malloc, realloc and free functions to cJSON */ -// llgo:link (*Hooks).InitHooks C.cJSON_InitHooks -func (recv_ *Hooks) InitHooks() { -} - -/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ -/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ -//go:linkname Parse C.cJSON_Parse -func Parse(value *c.Char) *JSON - -//go:linkname ParseWithLength C.cJSON_ParseWithLength -func ParseWithLength(value *c.Char, buffer_length c.SizeT) *JSON - -/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ -/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ -//go:linkname ParseWithOpts C.cJSON_ParseWithOpts -func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON - -//go:linkname ParseWithLengthOpts C.cJSON_ParseWithLengthOpts -func ParseWithLengthOpts(value *c.Char, buffer_length c.SizeT, return_parse_end **c.Char, require_null_terminated Bool) *JSON - -/* Render a cJSON entity to text for transfer/storage. */ -// llgo:link (*JSON).Print C.cJSON_Print -func (recv_ *JSON) Print() *c.Char { - return nil -} - -/* Render a cJSON entity to text for transfer/storage without any formatting. */ -// llgo:link (*JSON).CStr C.cJSON_PrintUnformatted -func (recv_ *JSON) CStr() *c.Char { - return nil -} - -/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ -// llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered -func (recv_ *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char { - return nil -} - -/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ -/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ -// llgo:link (*JSON).PrintPreallocated C.cJSON_PrintPreallocated -func (recv_ *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format Bool) Bool { - return 0 -} - -/* Delete a cJSON entity and all subentities. */ -// llgo:link (*JSON).Delete C.cJSON_Delete -func (recv_ *JSON) Delete() { -} - -/* Returns the number of items in an array (or object). */ -// llgo:link (*JSON).GetArraySize C.cJSON_GetArraySize -func (recv_ *JSON) GetArraySize() c.Int { - return 0 -} - -/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ -// llgo:link (*JSON).GetArrayItem C.cJSON_GetArrayItem -func (recv_ *JSON) GetArrayItem(index c.Int) *JSON { - return nil -} - -/* Get item "string" from object. Case insensitive. */ -// llgo:link (*JSON).GetObjectItem C.cJSON_GetObjectItem -func (recv_ *JSON) GetObjectItem(string *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive -func (recv_ *JSON) GetObjectItemCaseSensitive(string *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem -func (recv_ *JSON) HasObjectItem(string *c.Char) Bool { - return 0 -} - -/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ -//go:linkname GetErrorPtr C.cJSON_GetErrorPtr -func GetErrorPtr() *c.Char - -/* Check item type and return its value */ -// llgo:link (*JSON).GetStringValue C.cJSON_GetStringValue -func (recv_ *JSON) GetStringValue() *c.Char { - return nil -} - -// llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue -func (recv_ *JSON) GetNumberValue() c.Double { - return 0 -} - -/* These functions check the type of an item */ -// llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid -func (recv_ *JSON) IsInvalid() Bool { - return 0 -} - -// llgo:link (*JSON).IsFalse C.cJSON_IsFalse -func (recv_ *JSON) IsFalse() Bool { - return 0 -} - -// llgo:link (*JSON).IsTrue C.cJSON_IsTrue -func (recv_ *JSON) IsTrue() Bool { - return 0 -} - -// llgo:link (*JSON).IsBool C.cJSON_IsBool -func (recv_ *JSON) IsBool() Bool { - return 0 -} - -// llgo:link (*JSON).IsNull C.cJSON_IsNull -func (recv_ *JSON) IsNull() Bool { - return 0 -} - -// llgo:link (*JSON).IsNumber C.cJSON_IsNumber -func (recv_ *JSON) IsNumber() Bool { - return 0 -} - -// llgo:link (*JSON).IsString C.cJSON_IsString -func (recv_ *JSON) IsString() Bool { - return 0 -} - -// llgo:link (*JSON).IsArray C.cJSON_IsArray -func (recv_ *JSON) IsArray() Bool { - return 0 -} - -// llgo:link (*JSON).IsObject C.cJSON_IsObject -func (recv_ *JSON) IsObject() Bool { - return 0 -} - -// llgo:link (*JSON).IsRaw C.cJSON_IsRaw -func (recv_ *JSON) IsRaw() Bool { - return 0 -} - -/* These calls create a cJSON item of the appropriate type. */ -//go:linkname Null C.cJSON_CreateNull -func Null() *JSON - -//go:linkname True C.cJSON_CreateTrue -func True() *JSON - -//go:linkname False C.cJSON_CreateFalse -func False() *JSON - -//go:linkname CreateBool C.cJSON_CreateBool -func CreateBool(boolean Bool) *JSON - -//go:linkname Number C.cJSON_CreateNumber -func Number(num c.Double) *JSON - -//go:linkname String C.cJSON_CreateString -func String(string *c.Char) *JSON - -/* raw json */ -//go:linkname Raw C.cJSON_CreateRaw -func Raw(raw *c.Char) *JSON - -//go:linkname Array C.cJSON_CreateArray -func Array() *JSON - -//go:linkname Object C.cJSON_CreateObject -func Object() *JSON - -/* Create a string where valuestring references a string so - * it will not be freed by cJSON_Delete */ -//go:linkname StringRef C.cJSON_CreateStringReference -func StringRef(string *c.Char) *JSON - -/* Create an object/array that only references it's elements so - * they will not be freed by cJSON_Delete */ -//go:linkname ObjectRef C.cJSON_CreateObjectReference -func ObjectRef(child *JSON) *JSON - -// llgo:link (*JSON).CreateArrayRef C.cJSON_CreateArrayReference -func (recv_ *JSON) CreateArrayRef() *JSON { - return nil -} - -/* These utilities create an Array of count items. - * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/ -//go:linkname IntArray C.cJSON_CreateIntArray -func IntArray(numbers *c.Int, count c.Int) *JSON - -//go:linkname FloatArray C.cJSON_CreateFloatArray -func FloatArray(numbers *c.Float, count c.Int) *JSON - -//go:linkname DoubleArray C.cJSON_CreateDoubleArray -func DoubleArray(numbers *c.Double, count c.Int) *JSON - -//go:linkname StringArray C.cJSON_CreateStringArray -func StringArray(strings **c.Char, count c.Int) *JSON - -/* Append item to the specified array/object. */ -// llgo:link (*JSON).AddItem C.cJSON_AddItemToArray -func (recv_ *JSON) AddItem(item *JSON) Bool { - return 0 -} - -// llgo:link (*JSON).SetItem C.cJSON_AddItemToObject -func (recv_ *JSON) SetItem(string *c.Char, item *JSON) Bool { - return 0 -} - -/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. - * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before - * writing to `item->string` */ -// llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS -func (recv_ *JSON) AddItemToObjectCS(string *c.Char, item *JSON) Bool { - return 0 -} - -/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ -// llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray -func (recv_ *JSON) AddItemReferenceToArray(item *JSON) Bool { - return 0 -} - -// llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject -func (recv_ *JSON) AddItemReferenceToObject(string *c.Char, item *JSON) Bool { - return 0 -} - -/* Remove/Detach items from Arrays/Objects. */ -// llgo:link (*JSON).DetachItemViaPointer C.cJSON_DetachItemViaPointer -func (recv_ *JSON) DetachItemViaPointer(item *JSON) *JSON { - return nil -} - -// llgo:link (*JSON).DetachItemFromArray C.cJSON_DetachItemFromArray -func (recv_ *JSON) DetachItemFromArray(which c.Int) *JSON { - return nil -} - -// llgo:link (*JSON).DeleteItemFromArray C.cJSON_DeleteItemFromArray -func (recv_ *JSON) DeleteItemFromArray(which c.Int) { -} - -// llgo:link (*JSON).DetachItemFromObject C.cJSON_DetachItemFromObject -func (recv_ *JSON) DetachItemFromObject(string *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).DetachItemFromObjectCaseSensitive C.cJSON_DetachItemFromObjectCaseSensitive -func (recv_ *JSON) DetachItemFromObjectCaseSensitive(string *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).DeleteItemFromObject C.cJSON_DeleteItemFromObject -func (recv_ *JSON) DeleteItemFromObject(string *c.Char) { -} - -// llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive -func (recv_ *JSON) DeleteItemFromObjectCaseSensitive(string *c.Char) { -} - -/* Update array items. */ -// llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray -func (recv_ *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool { - return 0 -} - -// llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer -func (recv_ *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool { - return 0 -} - -// llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray -func (recv_ *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool { - return 0 -} - -// llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject -func (recv_ *JSON) ReplaceItemInObject(string *c.Char, newitem *JSON) Bool { - return 0 -} - -// llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive -func (recv_ *JSON) ReplaceItemInObjectCaseSensitive(string *c.Char, newitem *JSON) Bool { - return 0 -} - -/* Duplicate a cJSON item */ -// llgo:link (*JSON).Duplicate C.cJSON_Duplicate -func (recv_ *JSON) Duplicate(recurse Bool) *JSON { - return nil -} - -/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will - * need to be released. With recurse!=0, it will duplicate any children connected to the item. - * The item->next and ->prev pointers are always zero on return from Duplicate. */ -/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. - * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ -// llgo:link (*JSON).Compare C.cJSON_Compare -func (recv_ *JSON) Compare(b *JSON, case_sensitive Bool) Bool { - return 0 -} - -/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. - * The input pointer json cannot point to a read-only address area, such as a string constant, - * but should point to a readable and writable address area. */ -//go:linkname Minify C.cJSON_Minify -func Minify(json *c.Char) - -/* Helper functions for creating and adding items to an object at the same time. - * They return the added item or NULL on failure. */ -// llgo:link (*JSON).AddNullToObject C.cJSON_AddNullToObject -func (recv_ *JSON) AddNullToObject(name *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).AddTrueToObject C.cJSON_AddTrueToObject -func (recv_ *JSON) AddTrueToObject(name *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject -func (recv_ *JSON) AddFalseToObject(name *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject -func (recv_ *JSON) AddBoolToObject(name *c.Char, boolean Bool) *JSON { - return nil -} - -// llgo:link (*JSON).AddNumberToObject C.cJSON_AddNumberToObject -func (recv_ *JSON) AddNumberToObject(name *c.Char, number c.Double) *JSON { - return nil -} - -// llgo:link (*JSON).AddStringToObject C.cJSON_AddStringToObject -func (recv_ *JSON) AddStringToObject(name *c.Char, string *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).AddRawToObject C.cJSON_AddRawToObject -func (recv_ *JSON) AddRawToObject(name *c.Char, raw *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).AddObjectToObject C.cJSON_AddObjectToObject -func (recv_ *JSON) AddObjectToObject(name *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).AddArrayToObject C.cJSON_AddArrayToObject -func (recv_ *JSON) AddArrayToObject(name *c.Char) *JSON { - return nil -} - -/* helper for the cJSON_SetNumberValue macro */ -// llgo:link (*JSON).SetNumberHelper C.cJSON_SetNumberHelper -func (recv_ *JSON) SetNumberHelper(number c.Double) c.Double { - return 0 -} - -/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */ -// llgo:link (*JSON).SetValuestring C.cJSON_SetValuestring -func (recv_ *JSON) SetValuestring(valuestring *c.Char) *c.Char { - return nil -} - -/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ -//go:linkname Malloc C.cJSON_malloc -func Malloc(size c.SizeT) c.Pointer - -//go:linkname FreeCStr C.cJSON_free -func FreeCStr(object c.Pointer) diff --git a/cjson/cJSON_Utils.go b/cjson/cJSON_Utils.go deleted file mode 100644 index 9b5f2a13..00000000 --- a/cjson/cJSON_Utils.go +++ /dev/null @@ -1,84 +0,0 @@ -package cjson - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */ -// llgo:link (*JSON).GetPointer C.cJSONUtils_GetPointer -func (recv_ *JSON) GetPointer(pointer *c.Char) *JSON { - return nil -} - -// llgo:link (*JSON).GetPointerCaseSensitive C.cJSONUtils_GetPointerCaseSensitive -func (recv_ *JSON) GetPointerCaseSensitive(pointer *c.Char) *JSON { - return nil -} - -/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */ -/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */ -// llgo:link (*JSON).GeneratePatches C.cJSONUtils_GeneratePatches -func (recv_ *JSON) GeneratePatches(to *JSON) *JSON { - return nil -} - -// llgo:link (*JSON).GeneratePatchesCaseSensitive C.cJSONUtils_GeneratePatchesCaseSensitive -func (recv_ *JSON) GeneratePatchesCaseSensitive(to *JSON) *JSON { - return nil -} - -/* Utility for generating patch array entries. */ -// llgo:link (*JSON).AddPatchToArray C.cJSONUtils_AddPatchToArray -func (recv_ *JSON) AddPatchToArray(operation *c.Char, path *c.Char, value *JSON) { -} - -/* Returns 0 for success. */ -// llgo:link (*JSON).ApplyPatches C.cJSONUtils_ApplyPatches -func (recv_ *JSON) ApplyPatches(patches *JSON) c.Int { - return 0 -} - -// llgo:link (*JSON).ApplyPatchesCaseSensitive C.cJSONUtils_ApplyPatchesCaseSensitive -func (recv_ *JSON) ApplyPatchesCaseSensitive(patches *JSON) c.Int { - return 0 -} - -/* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */ -/* target will be modified by patch. return value is new ptr for target. */ -// llgo:link (*JSON).MergePatch C.cJSONUtils_MergePatch -func (recv_ *JSON) MergePatch(patch *JSON) *JSON { - return nil -} - -// llgo:link (*JSON).MergePatchCaseSensitive C.cJSONUtils_MergePatchCaseSensitive -func (recv_ *JSON) MergePatchCaseSensitive(patch *JSON) *JSON { - return nil -} - -/* generates a patch to move from -> to */ -/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */ -// llgo:link (*JSON).GenerateMergePatch C.cJSONUtils_GenerateMergePatch -func (recv_ *JSON) GenerateMergePatch(to *JSON) *JSON { - return nil -} - -// llgo:link (*JSON).GenerateMergePatchCaseSensitive C.cJSONUtils_GenerateMergePatchCaseSensitive -func (recv_ *JSON) GenerateMergePatchCaseSensitive(to *JSON) *JSON { - return nil -} - -/* Given a root object and a target object, construct a pointer from one to the other. */ -// llgo:link (*JSON).FindPointerFromObjectTo C.cJSONUtils_FindPointerFromObjectTo -func (recv_ *JSON) FindPointerFromObjectTo(target *JSON) *c.Char { - return nil -} - -/* Sorts the members of the object into alphabetical order. */ -// llgo:link (*JSON).SortObject C.cJSONUtils_SortObject -func (recv_ *JSON) SortObject() { -} - -// llgo:link (*JSON).SortObjectCaseSensitive C.cJSONUtils_SortObjectCaseSensitive -func (recv_ *JSON) SortObjectCaseSensitive() { -} diff --git a/cjson/cjson_autogen_link.go b/cjson/cjson_autogen_link.go deleted file mode 100644 index 87375c6b..00000000 --- a/cjson/cjson_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package cjson - -import _ "github.com/goplus/lib/c" - -const LLGoPackage string = "link: $(pkg-config --libs libcjson libcjson_utils);" diff --git a/cjson/go.mod b/cjson/go.mod deleted file mode 100644 index 4cf198a3..00000000 --- a/cjson/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/cjson - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/cjson/go.sum b/cjson/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/cjson/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/cjson/llcppg.cfg b/cjson/llcppg.cfg deleted file mode 100644 index 7f51d636..00000000 --- a/cjson/llcppg.cfg +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "cjson", - "cflags": "$(pkg-config --cflags libcjson)", - "libs": "$(pkg-config --libs libcjson libcjson_utils)", - "include": [ - "cjson/cJSON.h", - "cjson/cJSON_Utils.h" - ], - "trimPrefixes": ["cJSON_", "cJSONUtils_","CJSON_"], - "cplusplus": false, - "symMap": { - "cJSON_PrintUnformatted":".CStr", - "cJSON_CreateObject":"Object", - "cJSON_CreateArray":"Array", - "cJSON_CreateString":"String", - "cJSON_CreateNull":"Null", - "cJSON_CreateTrue":"True", - "cJSON_CreateFalse":"False", - "cJSON_CreateBool":"CreateBool", - "cJSON_CreateNumber":"Number", - "cJSON_CreateRaw":"Raw", - "cJSON_CreateStringReference":"StringRef", - "cJSON_CreateArrayReference":".CreateArrayRef", - "cJSON_CreateObjectReference":"ObjectRef", - "cJSON_CreateIntArray":"IntArray", - "cJSON_CreateFloatArray":"FloatArray", - "cJSON_CreateDoubleArray":"DoubleArray", - "cJSON_CreateStringArray":"StringArray", - "cJSON_free":"FreeCStr", - "cJSON_AddItemToArray":".AddItem", - "cJSON_AddItemToObject":".SetItem" - }, - "typeMap": { - "cJSON": "JSON" - } -} diff --git a/cjson/llcppg.pub b/cjson/llcppg.pub deleted file mode 100644 index 51e9a8ac..00000000 --- a/cjson/llcppg.pub +++ /dev/null @@ -1,3 +0,0 @@ -cJSON JSON -cJSON_Hooks Hooks -cJSON_bool Bool \ No newline at end of file diff --git a/cjson/llpkg.cfg b/cjson/llpkg.cfg deleted file mode 100644 index b7046722..00000000 --- a/cjson/llpkg.cfg +++ /dev/null @@ -1,14 +0,0 @@ -{ - "upstream": { - "package": { - "name": "cjson", - "version": "1.7.18" - }, - "installer":{ - "name": "conan", - "config" : { - "options": "utils=True" - } - } - } -} \ No newline at end of file diff --git a/libtool/_demo/test/test.go b/libtool/_demo/test/test.go deleted file mode 100644 index 40b9f308..00000000 --- a/libtool/_demo/test/test.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libtool" -) - -func main() { - fmt.Println("Simple libtool demonstration") - - // Initialize libtool - ret := libtool.Dlinit() - if ret != 0 { - fmt.Println("Failed to initialize libtool:", c.GoString(libtool.Dlerror())) - return - } - fmt.Println("Successfully initialized libtool") - - // Try to load a common library (libc) - libName := "libc.so.6" // Linux style - handle := libtool.Dlopen(c.Str(libName)) - if handle == nil { - libName = "libc.dylib" // macOS style - handle = libtool.Dlopen(c.Str(libName)) - } - if handle == nil { - libName = "c" // Generic style - handle = libtool.Dlopen(c.Str(libName)) - } - - if handle != nil { - fmt.Printf("Successfully opened %s\n", libName) - - // Try to find a common function (printf) - symPtr := libtool.Dlsym(handle, c.Str("printf")) - if symPtr != nil { - fmt.Println("Found 'printf' function") - } else { - fmt.Println("Symbol 'printf' not found:", c.GoString(libtool.Dlerror())) - } - - // Close the library - libtool.Dlclose(handle) - fmt.Println("Closed library") - } else { - fmt.Println("Could not open any standard library:", c.GoString(libtool.Dlerror())) - } - - // Clean up libtool - libtool.Dlexit() - fmt.Println("Successfully cleaned up libtool") -} diff --git a/libtool/go.mod b/libtool/go.mod deleted file mode 100644 index c8b6d58e..00000000 --- a/libtool/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/libtool - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/libtool/go.sum b/libtool/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/libtool/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/libtool/libtool_autogen_link.go b/libtool/libtool_autogen_link.go deleted file mode 100644 index 60f6280d..00000000 --- a/libtool/libtool_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package libtool - -import _ "github.com/goplus/lib/c" - -const LLGoPackage string = "link: $(pkg-config --libs libtool);" diff --git a/libtool/llcppg.cfg b/libtool/llcppg.cfg deleted file mode 100644 index f99f38b7..00000000 --- a/libtool/llcppg.cfg +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "libtool", - "cflags": "$(pkg-config --cflags libtool)", - "libs": "$(pkg-config --libs libtool)", - "include": [ - "ltdl.h", - "libltdl/lt_dlloader.h", - "libltdl/lt_error.h", - "libltdl/lt_system.h" - ], - "trimPrefixes": ["lt__","lt_", "LT_"], - "cplusplus": false, - "deps": [], - "keepUnderScore": false, - "impl": [ - { - "files": [], - "cond": { - "os": [], - "arch": [] - } - } - ], - "mix": false -} diff --git a/libtool/llcppg.pub b/libtool/llcppg.pub deleted file mode 100644 index 4bd09b5a..00000000 --- a/libtool/llcppg.pub +++ /dev/null @@ -1,20 +0,0 @@ -lt__advise Advise -lt__handle Handle -lt_dladvise Dladvise -lt_dlhandle Dlhandle -lt_dlhandle_interface DlhandleInterface -lt_dlinfo Dlinfo -lt_dlinterface_id DlinterfaceId -lt_dlloader Dlloader -lt_dlloader_exit DlloaderExit -lt_dlloader_init DlloaderInit -lt_dlloader_priority DlloaderPriority -lt_dlpreload_callback_func DlpreloadCallbackFunc -lt_dlsymlist Dlsymlist -lt_dlvtable Dlvtable -lt_find_sym FindSym -lt_get_vtable GetVtable -lt_module Module -lt_module_close ModuleClose -lt_module_open ModuleOpen -lt_user_data UserData \ No newline at end of file diff --git a/libtool/llpkg.cfg b/libtool/llpkg.cfg deleted file mode 100644 index 0dd40066..00000000 --- a/libtool/llpkg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "upstream": { - "package": { - "name": "libtool", - "version": "2.4.7" - } - } -} \ No newline at end of file diff --git a/libtool/lt_dlloader.go b/libtool/lt_dlloader.go deleted file mode 100644 index c0a6aaef..00000000 --- a/libtool/lt_dlloader.go +++ /dev/null @@ -1,75 +0,0 @@ -package libtool - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const DLLOADER_H = 1 - -type Dlloader c.Pointer -type Module c.Pointer -type UserData c.Pointer - -type Advise struct { - Unused [8]uint8 -} -type Dladvise *Advise - -// llgo:type C -type ModuleOpen func(UserData, *c.Char, Dladvise) Module - -// llgo:type C -type ModuleClose func(UserData, Module) c.Int - -// llgo:type C -type FindSym func(UserData, Module, *c.Char) c.Pointer - -// llgo:type C -type DlloaderInit func(UserData) c.Int - -// llgo:type C -type DlloaderExit func(UserData) c.Int -type DlloaderPriority c.Int - -const ( - DLLOADER_PREPEND DlloaderPriority = 0 - DLLOADER_APPEND DlloaderPriority = 1 -) - -/* -This structure defines a module loader, as populated by the get_vtable - - entry point of each loader. -*/ -type Dlvtable struct { - Name *c.Char - SymPrefix *c.Char - ModuleOpen *ModuleOpen - ModuleClose *ModuleClose - FindSym *FindSym - DlloaderInit *DlloaderInit - DlloaderExit *DlloaderExit - DlloaderData UserData - Priority DlloaderPriority -} - -// llgo:link (*Dlvtable).DlloaderAdd C.lt_dlloader_add -func (recv_ *Dlvtable) DlloaderAdd() c.Int { - return 0 -} - -//go:linkname DlloaderNext C.lt_dlloader_next -func DlloaderNext(loader Dlloader) Dlloader - -//go:linkname DlloaderRemove C.lt_dlloader_remove -func DlloaderRemove(name *c.Char) *Dlvtable - -//go:linkname DlloaderFind C.lt_dlloader_find -func DlloaderFind(name *c.Char) *Dlvtable - -//go:linkname DlloaderGet C.lt_dlloader_get -func DlloaderGet(loader Dlloader) *Dlvtable - -// llgo:type C -type GetVtable func(UserData) *Dlvtable diff --git a/libtool/lt_error.go b/libtool/lt_error.go deleted file mode 100644 index 4e4bc685..00000000 --- a/libtool/lt_error.go +++ /dev/null @@ -1,38 +0,0 @@ -package libtool - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const ERROR_H = 1 -const ( - ERROR_UNKNOWN c.Int = 0 - ERROR_DLOPEN_NOT_SUPPORTED c.Int = 1 - ERROR_INVALID_LOADER c.Int = 2 - ERROR_INIT_LOADER c.Int = 3 - ERROR_REMOVE_LOADER c.Int = 4 - ERROR_FILE_NOT_FOUND c.Int = 5 - ERROR_DEPLIB_NOT_FOUND c.Int = 6 - ERROR_NO_SYMBOLS c.Int = 7 - ERROR_CANNOT_OPEN c.Int = 8 - ERROR_CANNOT_CLOSE c.Int = 9 - ERROR_SYMBOL_NOT_FOUND c.Int = 10 - ERROR_NO_MEMORY c.Int = 11 - ERROR_INVALID_HANDLE c.Int = 12 - ERROR_BUFFER_OVERFLOW c.Int = 13 - ERROR_INVALID_ERRORCODE c.Int = 14 - ERROR_SHUTDOWN c.Int = 15 - ERROR_CLOSE_RESIDENT_MODULE c.Int = 16 - ERROR_INVALID_MUTEX_ARGS c.Int = 17 - ERROR_INVALID_POSITION c.Int = 18 - ERROR_CONFLICTING_FLAGS c.Int = 19 - ERROR_MAX c.Int = 20 -) - -/* These functions are only useful from inside custom module loaders. */ -//go:linkname Dladderror C.lt_dladderror -func Dladderror(diagnostic *c.Char) c.Int - -//go:linkname Dlseterror C.lt_dlseterror -func Dlseterror(errorcode c.Int) c.Int diff --git a/libtool/lt_system.go b/libtool/lt_system.go deleted file mode 100644 index 88694fdc..00000000 --- a/libtool/lt_system.go +++ /dev/null @@ -1,8 +0,0 @@ -package libtool - -import _ "unsafe" - -const SYSTEM_H = 1 -const FILENAME_MAX = 2048 -const PATHSEP_CHAR = ":" -const READTEXT_MODE = "r" diff --git a/libtool/ltdl.go b/libtool/ltdl.go deleted file mode 100644 index 55ddea2f..00000000 --- a/libtool/ltdl.go +++ /dev/null @@ -1,150 +0,0 @@ -package libtool - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const LTDL_H = 1 - -type Handle struct { - Unused [8]uint8 -} -type Dlhandle *Handle - -/* Initialisation and finalisation functions for libltdl. */ -//go:linkname Dlinit C.lt_dlinit -func Dlinit() c.Int - -//go:linkname Dlexit C.lt_dlexit -func Dlexit() c.Int - -/* Module search path manipulation. */ -//go:linkname Dladdsearchdir C.lt_dladdsearchdir -func Dladdsearchdir(search_dir *c.Char) c.Int - -//go:linkname Dlinsertsearchdir C.lt_dlinsertsearchdir -func Dlinsertsearchdir(before *c.Char, search_dir *c.Char) c.Int - -//go:linkname Dlsetsearchpath C.lt_dlsetsearchpath -func Dlsetsearchpath(search_path *c.Char) c.Int - -//go:linkname Dlgetsearchpath C.lt_dlgetsearchpath -func Dlgetsearchpath() *c.Char - -//go:linkname Dlforeachfile C.lt_dlforeachfile -func Dlforeachfile(search_path *c.Char, func_ func(*c.Char, c.Pointer) c.Int, data c.Pointer) c.Int - -/* User module loading advisors. */ -//go:linkname DladviseInit C.lt_dladvise_init -func DladviseInit(advise *Dladvise) c.Int - -//go:linkname DladviseDestroy C.lt_dladvise_destroy -func DladviseDestroy(advise *Dladvise) c.Int - -//go:linkname DladviseExt C.lt_dladvise_ext -func DladviseExt(advise *Dladvise) c.Int - -//go:linkname DladviseResident C.lt_dladvise_resident -func DladviseResident(advise *Dladvise) c.Int - -//go:linkname DladviseLocal C.lt_dladvise_local -func DladviseLocal(advise *Dladvise) c.Int - -//go:linkname DladviseGlobal C.lt_dladvise_global -func DladviseGlobal(advise *Dladvise) c.Int - -//go:linkname DladvisePreload C.lt_dladvise_preload -func DladvisePreload(advise *Dladvise) c.Int - -/* Portable libltdl versions of the system dlopen() API. */ -//go:linkname Dlopen C.lt_dlopen -func Dlopen(filename *c.Char) Dlhandle - -//go:linkname Dlopenext C.lt_dlopenext -func Dlopenext(filename *c.Char) Dlhandle - -//go:linkname Dlopenadvise C.lt_dlopenadvise -func Dlopenadvise(filename *c.Char, advise Dladvise) Dlhandle - -//go:linkname Dlsym C.lt_dlsym -func Dlsym(handle Dlhandle, name *c.Char) c.Pointer - -//go:linkname Dlerror C.lt_dlerror -func Dlerror() *c.Char - -//go:linkname Dlclose C.lt_dlclose -func Dlclose(handle Dlhandle) c.Int - -/* -A preopened symbol. Arrays of this type comprise the exported - - symbols for a dlpreopened module. -*/ -type Dlsymlist struct { - Name *c.Char - Address c.Pointer -} - -// llgo:type C -type DlpreloadCallbackFunc func(Dlhandle) c.Int - -// llgo:link (*Dlsymlist).Dlpreload C.lt_dlpreload -func (recv_ *Dlsymlist) Dlpreload() c.Int { - return 0 -} - -// llgo:link (*Dlsymlist).DlpreloadDefault C.lt_dlpreload_default -func (recv_ *Dlsymlist) DlpreloadDefault() c.Int { - return 0 -} - -//go:linkname DlpreloadOpen C.lt_dlpreload_open -func DlpreloadOpen(originator *c.Char, func_ DlpreloadCallbackFunc) c.Int - -type DlinterfaceId c.Pointer - -// llgo:type C -type DlhandleInterface func(Dlhandle, *c.Char) c.Int - -//go:linkname DlinterfaceRegister C.lt_dlinterface_register -func DlinterfaceRegister(id_string *c.Char, iface DlhandleInterface) DlinterfaceId - -//go:linkname DlinterfaceFree C.lt_dlinterface_free -func DlinterfaceFree(key DlinterfaceId) - -//go:linkname DlcallerSetData C.lt_dlcaller_set_data -func DlcallerSetData(key DlinterfaceId, handle Dlhandle, data c.Pointer) c.Pointer - -//go:linkname DlcallerGetData C.lt_dlcaller_get_data -func DlcallerGetData(key DlinterfaceId, handle Dlhandle) c.Pointer - -/* Read only information pertaining to a loaded module. */ - -type Dlinfo struct { - Filename *c.Char - Name *c.Char - RefCount c.Int - IsResident c.Uint - IsSymglobal c.Uint - IsSymlocal c.Uint -} - -//go:linkname Dlgetinfo C.lt_dlgetinfo -func Dlgetinfo(handle Dlhandle) *Dlinfo - -//go:linkname DlhandleIterate C.lt_dlhandle_iterate -func DlhandleIterate(iface DlinterfaceId, place Dlhandle) Dlhandle - -//go:linkname DlhandleFetch C.lt_dlhandle_fetch -func DlhandleFetch(iface DlinterfaceId, module_name *c.Char) Dlhandle - -//go:linkname DlhandleMap C.lt_dlhandle_map -func DlhandleMap(iface DlinterfaceId, func_ func(Dlhandle, c.Pointer) c.Int, data c.Pointer) c.Int - -/* Deprecated module residency management API. */ -//go:linkname Dlmakeresident C.lt_dlmakeresident -func Dlmakeresident(handle Dlhandle) c.Int - -//go:linkname Dlisresident C.lt_dlisresident -func Dlisresident(handle Dlhandle) c.Int diff --git a/libxml2/HTMLparser.go b/libxml2/HTMLparser.go deleted file mode 100644 index 3f27ce49..00000000 --- a/libxml2/HTMLparser.go +++ /dev/null @@ -1,226 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type HtmlParserCtxt ParserCtxt -type HtmlParserCtxtPtr ParserCtxtPtr -type HtmlParserNodeInfo ParserNodeInfo -type HtmlSAXHandler SAXHandler -type HtmlSAXHandlerPtr SAXHandlerPtr -type HtmlParserInput ParserInput -type HtmlParserInputPtr ParserInputPtr -type HtmlDocPtr DocPtr -type HtmlNodePtr NodePtr - -type X_htmlElemDesc struct { - Name *c.Char - StartTag c.Char - EndTag c.Char - SaveEndTag c.Char - Empty c.Char - Depr c.Char - Dtd c.Char - Isinline c.Char - Desc *c.Char - Subelts **c.Char - Defaultsubelt *c.Char - AttrsOpt **c.Char - AttrsDepr **c.Char - AttrsReq **c.Char -} -type HtmlElemDesc X_htmlElemDesc -type HtmlElemDescPtr *HtmlElemDesc - -type X_htmlEntityDesc struct { - Value c.Uint - Name *c.Char - Desc *c.Char -} -type HtmlEntityDesc X_htmlEntityDesc -type HtmlEntityDescPtr *HtmlEntityDesc - -//go:linkname X__htmlDefaultSAXHandler C.__htmlDefaultSAXHandler -func X__htmlDefaultSAXHandler() *SAXHandlerV1 - -/* - * There is only few public functions. - */ -//go:linkname HtmlInitAutoClose C.htmlInitAutoClose -func HtmlInitAutoClose() - -// llgo:link (*Char).HtmlTagLookup C.htmlTagLookup -func (recv_ *Char) HtmlTagLookup() *HtmlElemDesc { - return nil -} - -// llgo:link (*Char).HtmlEntityLookup C.htmlEntityLookup -func (recv_ *Char) HtmlEntityLookup() *HtmlEntityDesc { - return nil -} - -//go:linkname HtmlEntityValueLookup C.htmlEntityValueLookup -func HtmlEntityValueLookup(value c.Uint) *HtmlEntityDesc - -//go:linkname HtmlIsAutoClosed C.htmlIsAutoClosed -func HtmlIsAutoClosed(doc HtmlDocPtr, elem HtmlNodePtr) c.Int - -//go:linkname HtmlAutoCloseTag C.htmlAutoCloseTag -func HtmlAutoCloseTag(doc HtmlDocPtr, name *Char, elem HtmlNodePtr) c.Int - -//go:linkname HtmlParseEntityRef C.htmlParseEntityRef -func HtmlParseEntityRef(ctxt HtmlParserCtxtPtr, str **Char) *HtmlEntityDesc - -//go:linkname HtmlParseCharRef C.htmlParseCharRef -func HtmlParseCharRef(ctxt HtmlParserCtxtPtr) c.Int - -//go:linkname HtmlParseElement C.htmlParseElement -func HtmlParseElement(ctxt HtmlParserCtxtPtr) - -//go:linkname HtmlNewParserCtxt C.htmlNewParserCtxt -func HtmlNewParserCtxt() HtmlParserCtxtPtr - -// llgo:link (*HtmlSAXHandler).HtmlNewSAXParserCtxt C.htmlNewSAXParserCtxt -func (recv_ *HtmlSAXHandler) HtmlNewSAXParserCtxt(userData c.Pointer) HtmlParserCtxtPtr { - return nil -} - -//go:linkname HtmlCreateMemoryParserCtxt C.htmlCreateMemoryParserCtxt -func HtmlCreateMemoryParserCtxt(buffer *c.Char, size c.Int) HtmlParserCtxtPtr - -//go:linkname HtmlParseDocument C.htmlParseDocument -func HtmlParseDocument(ctxt HtmlParserCtxtPtr) c.Int - -// llgo:link (*Char).HtmlSAXParseDoc C.htmlSAXParseDoc -func (recv_ *Char) HtmlSAXParseDoc(encoding *c.Char, sax HtmlSAXHandlerPtr, userData c.Pointer) HtmlDocPtr { - return nil -} - -// llgo:link (*Char).HtmlParseDoc C.htmlParseDoc -func (recv_ *Char) HtmlParseDoc(encoding *c.Char) HtmlDocPtr { - return nil -} - -//go:linkname HtmlCreateFileParserCtxt C.htmlCreateFileParserCtxt -func HtmlCreateFileParserCtxt(filename *c.Char, encoding *c.Char) HtmlParserCtxtPtr - -//go:linkname HtmlSAXParseFile C.htmlSAXParseFile -func HtmlSAXParseFile(filename *c.Char, encoding *c.Char, sax HtmlSAXHandlerPtr, userData c.Pointer) HtmlDocPtr - -//go:linkname HtmlParseFile C.htmlParseFile -func HtmlParseFile(filename *c.Char, encoding *c.Char) HtmlDocPtr - -//go:linkname UTF8ToHtml C.UTF8ToHtml -func UTF8ToHtml(out *c.Char, outlen *c.Int, in *c.Char, inlen *c.Int) c.Int - -//go:linkname HtmlEncodeEntities C.htmlEncodeEntities -func HtmlEncodeEntities(out *c.Char, outlen *c.Int, in *c.Char, inlen *c.Int, quoteChar c.Int) c.Int - -// llgo:link (*Char).HtmlIsScriptAttribute C.htmlIsScriptAttribute -func (recv_ *Char) HtmlIsScriptAttribute() c.Int { - return 0 -} - -//go:linkname HtmlHandleOmittedElem C.htmlHandleOmittedElem -func HtmlHandleOmittedElem(val c.Int) c.Int - -/** - * Interfaces for the Push mode. - */ -//go:linkname HtmlCreatePushParserCtxt C.htmlCreatePushParserCtxt -func HtmlCreatePushParserCtxt(sax HtmlSAXHandlerPtr, user_data c.Pointer, chunk *c.Char, size c.Int, filename *c.Char, enc CharEncoding) HtmlParserCtxtPtr - -//go:linkname HtmlParseChunk C.htmlParseChunk -func HtmlParseChunk(ctxt HtmlParserCtxtPtr, chunk *c.Char, size c.Int, terminate c.Int) c.Int - -//go:linkname HtmlFreeParserCtxt C.htmlFreeParserCtxt -func HtmlFreeParserCtxt(ctxt HtmlParserCtxtPtr) - -type HtmlParserOption c.Int - -const ( - HTML_PARSE_RECOVER HtmlParserOption = 1 - HTML_PARSE_NODEFDTD HtmlParserOption = 4 - HTML_PARSE_NOERROR HtmlParserOption = 32 - HTML_PARSE_NOWARNING HtmlParserOption = 64 - HTML_PARSE_PEDANTIC HtmlParserOption = 128 - HTML_PARSE_NOBLANKS HtmlParserOption = 256 - HTML_PARSE_NONET HtmlParserOption = 2048 - HTML_PARSE_NOIMPLIED HtmlParserOption = 8192 - HTML_PARSE_COMPACT HtmlParserOption = 65536 - HTML_PARSE_IGNORE_ENC HtmlParserOption = 2097152 -) - -//go:linkname HtmlCtxtReset C.htmlCtxtReset -func HtmlCtxtReset(ctxt HtmlParserCtxtPtr) - -//go:linkname HtmlCtxtUseOptions C.htmlCtxtUseOptions -func HtmlCtxtUseOptions(ctxt HtmlParserCtxtPtr, options c.Int) c.Int - -// llgo:link (*Char).HtmlReadDoc C.htmlReadDoc -func (recv_ *Char) HtmlReadDoc(URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr { - return nil -} - -//go:linkname HtmlReadFile C.htmlReadFile -func HtmlReadFile(URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlReadMemory C.htmlReadMemory -func HtmlReadMemory(buffer *c.Char, size c.Int, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlReadFd C.htmlReadFd -func HtmlReadFd(fd c.Int, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlReadIO C.htmlReadIO -func HtmlReadIO(ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlCtxtParseDocument C.htmlCtxtParseDocument -func HtmlCtxtParseDocument(ctxt HtmlParserCtxtPtr, input ParserInputPtr) HtmlDocPtr - -//go:linkname HtmlCtxtReadDoc C.htmlCtxtReadDoc -func HtmlCtxtReadDoc(ctxt ParserCtxtPtr, cur *Char, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlCtxtReadFile C.htmlCtxtReadFile -func HtmlCtxtReadFile(ctxt ParserCtxtPtr, filename *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlCtxtReadMemory C.htmlCtxtReadMemory -func HtmlCtxtReadMemory(ctxt ParserCtxtPtr, buffer *c.Char, size c.Int, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlCtxtReadFd C.htmlCtxtReadFd -func HtmlCtxtReadFd(ctxt ParserCtxtPtr, fd c.Int, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -//go:linkname HtmlCtxtReadIO C.htmlCtxtReadIO -func HtmlCtxtReadIO(ctxt ParserCtxtPtr, ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, URL *c.Char, encoding *c.Char, options c.Int) HtmlDocPtr - -type HtmlStatus c.Int - -const ( - HTML_NA HtmlStatus = 0 - HTML_INVALID HtmlStatus = 1 - HTML_DEPRECATED HtmlStatus = 2 - HTML_VALID HtmlStatus = 4 - HTML_REQUIRED HtmlStatus = 12 -) - -/* Using htmlElemDesc rather than name here, to emphasise the fact - that otherwise there's a lookup overhead -*/ -// llgo:link (*HtmlElemDesc).HtmlAttrAllowed C.htmlAttrAllowed -func (recv_ *HtmlElemDesc) HtmlAttrAllowed(*Char, c.Int) HtmlStatus { - return 0 -} - -// llgo:link (*HtmlElemDesc).HtmlElementAllowedHere C.htmlElementAllowedHere -func (recv_ *HtmlElemDesc) HtmlElementAllowedHere(*Char) c.Int { - return 0 -} - -// llgo:link (*HtmlElemDesc).HtmlElementStatusHere C.htmlElementStatusHere -func (recv_ *HtmlElemDesc) HtmlElementStatusHere(*HtmlElemDesc) HtmlStatus { - return 0 -} - -//go:linkname HtmlNodeStatus C.htmlNodeStatus -func HtmlNodeStatus(HtmlNodePtr, c.Int) HtmlStatus diff --git a/libxml2/HTMLtree.go b/libxml2/HTMLtree.go deleted file mode 100644 index 0e032cec..00000000 --- a/libxml2/HTMLtree.go +++ /dev/null @@ -1,66 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// llgo:link (*Char).HtmlNewDoc C.htmlNewDoc -func (recv_ *Char) HtmlNewDoc(ExternalID *Char) HtmlDocPtr { - return nil -} - -// llgo:link (*Char).HtmlNewDocNoDtD C.htmlNewDocNoDtD -func (recv_ *Char) HtmlNewDocNoDtD(ExternalID *Char) HtmlDocPtr { - return nil -} - -//go:linkname HtmlGetMetaEncoding C.htmlGetMetaEncoding -func HtmlGetMetaEncoding(doc HtmlDocPtr) *Char - -//go:linkname HtmlSetMetaEncoding C.htmlSetMetaEncoding -func HtmlSetMetaEncoding(doc HtmlDocPtr, encoding *Char) c.Int - -//go:linkname HtmlDocDumpMemory C.htmlDocDumpMemory -func HtmlDocDumpMemory(cur DocPtr, mem **Char, size *c.Int) - -//go:linkname HtmlDocDumpMemoryFormat C.htmlDocDumpMemoryFormat -func HtmlDocDumpMemoryFormat(cur DocPtr, mem **Char, size *c.Int, format c.Int) - -//go:linkname HtmlDocDump C.htmlDocDump -func HtmlDocDump(f *c.FILE, cur DocPtr) c.Int - -//go:linkname HtmlSaveFile C.htmlSaveFile -func HtmlSaveFile(filename *c.Char, cur DocPtr) c.Int - -//go:linkname HtmlNodeDump C.htmlNodeDump -func HtmlNodeDump(buf BufferPtr, doc DocPtr, cur NodePtr) c.Int - -//go:linkname HtmlNodeDumpFile C.htmlNodeDumpFile -func HtmlNodeDumpFile(out *c.FILE, doc DocPtr, cur NodePtr) - -//go:linkname HtmlNodeDumpFileFormat C.htmlNodeDumpFileFormat -func HtmlNodeDumpFileFormat(out *c.FILE, doc DocPtr, cur NodePtr, encoding *c.Char, format c.Int) c.Int - -//go:linkname HtmlSaveFileEnc C.htmlSaveFileEnc -func HtmlSaveFileEnc(filename *c.Char, cur DocPtr, encoding *c.Char) c.Int - -//go:linkname HtmlSaveFileFormat C.htmlSaveFileFormat -func HtmlSaveFileFormat(filename *c.Char, cur DocPtr, encoding *c.Char, format c.Int) c.Int - -//go:linkname HtmlNodeDumpFormatOutput C.htmlNodeDumpFormatOutput -func HtmlNodeDumpFormatOutput(buf OutputBufferPtr, doc DocPtr, cur NodePtr, encoding *c.Char, format c.Int) - -//go:linkname HtmlDocContentDumpOutput C.htmlDocContentDumpOutput -func HtmlDocContentDumpOutput(buf OutputBufferPtr, cur DocPtr, encoding *c.Char) - -//go:linkname HtmlDocContentDumpFormatOutput C.htmlDocContentDumpFormatOutput -func HtmlDocContentDumpFormatOutput(buf OutputBufferPtr, cur DocPtr, encoding *c.Char, format c.Int) - -//go:linkname HtmlNodeDumpOutput C.htmlNodeDumpOutput -func HtmlNodeDumpOutput(buf OutputBufferPtr, doc DocPtr, cur NodePtr, encoding *c.Char) - -// llgo:link (*Char).HtmlIsBooleanAttr C.htmlIsBooleanAttr -func (recv_ *Char) HtmlIsBooleanAttr() c.Int { - return 0 -} diff --git a/libxml2/SAX.go b/libxml2/SAX.go deleted file mode 100644 index d61a63c4..00000000 --- a/libxml2/SAX.go +++ /dev/null @@ -1,116 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname GetPublicId C.getPublicId -func GetPublicId(ctx c.Pointer) *Char - -//go:linkname GetSystemId C.getSystemId -func GetSystemId(ctx c.Pointer) *Char - -//go:linkname SetDocumentLocator C.setDocumentLocator -func SetDocumentLocator(ctx c.Pointer, loc SAXLocatorPtr) - -//go:linkname GetLineNumber C.getLineNumber -func GetLineNumber(ctx c.Pointer) c.Int - -//go:linkname GetColumnNumber C.getColumnNumber -func GetColumnNumber(ctx c.Pointer) c.Int - -//go:linkname IsStandalone C.isStandalone -func IsStandalone(ctx c.Pointer) c.Int - -//go:linkname HasInternalSubset C.hasInternalSubset -func HasInternalSubset(ctx c.Pointer) c.Int - -//go:linkname HasExternalSubset C.hasExternalSubset -func HasExternalSubset(ctx c.Pointer) c.Int - -//go:linkname InternalSubset C.internalSubset -func InternalSubset(ctx c.Pointer, name *Char, ExternalID *Char, SystemID *Char) - -//go:linkname ExternalSubset C.externalSubset -func ExternalSubset(ctx c.Pointer, name *Char, ExternalID *Char, SystemID *Char) - -//go:linkname GetEntity C.getEntity -func GetEntity(ctx c.Pointer, name *Char) EntityPtr - -//go:linkname GetParameterEntity__1 C.getParameterEntity -func GetParameterEntity__1(ctx c.Pointer, name *Char) EntityPtr - -//go:linkname ResolveEntity C.resolveEntity -func ResolveEntity(ctx c.Pointer, publicId *Char, systemId *Char) ParserInputPtr - -//go:linkname EntityDecl C.entityDecl -func EntityDecl(ctx c.Pointer, name *Char, type_ c.Int, publicId *Char, systemId *Char, content *Char) - -//go:linkname AttributeDecl C.attributeDecl -func AttributeDecl(ctx c.Pointer, elem *Char, fullname *Char, type_ c.Int, def c.Int, defaultValue *Char, tree EnumerationPtr) - -//go:linkname ElementDecl C.elementDecl -func ElementDecl(ctx c.Pointer, name *Char, type_ c.Int, content ElementContentPtr) - -//go:linkname NotationDecl C.notationDecl -func NotationDecl(ctx c.Pointer, name *Char, publicId *Char, systemId *Char) - -//go:linkname UnparsedEntityDecl C.unparsedEntityDecl -func UnparsedEntityDecl(ctx c.Pointer, name *Char, publicId *Char, systemId *Char, notationName *Char) - -//go:linkname StartDocument C.startDocument -func StartDocument(ctx c.Pointer) - -//go:linkname EndDocument C.endDocument -func EndDocument(ctx c.Pointer) - -//go:linkname GetAttribute C.attribute -func GetAttribute(ctx c.Pointer, fullname *Char, value *Char) - -//go:linkname StartElement C.startElement -func StartElement(ctx c.Pointer, fullname *Char, atts **Char) - -//go:linkname EndElement C.endElement -func EndElement(ctx c.Pointer, name *Char) - -//go:linkname Reference C.reference -func Reference(ctx c.Pointer, name *Char) - -//go:linkname Characters C.characters -func Characters(ctx c.Pointer, ch *Char, len c.Int) - -//go:linkname IgnorableWhitespace C.ignorableWhitespace -func IgnorableWhitespace(ctx c.Pointer, ch *Char, len c.Int) - -//go:linkname ProcessingInstruction C.processingInstruction -func ProcessingInstruction(ctx c.Pointer, target *Char, data *Char) - -//go:linkname GlobalNamespace C.globalNamespace -func GlobalNamespace(ctx c.Pointer, href *Char, prefix *Char) - -//go:linkname SetNamespace C.setNamespace -func SetNamespace(ctx c.Pointer, name *Char) - -//go:linkname GetNamespace C.getNamespace -func GetNamespace(ctx c.Pointer) NsPtr - -//go:linkname CheckNamespace C.checkNamespace -func CheckNamespace(ctx c.Pointer, nameSpace *Char) c.Int - -//go:linkname NamespaceDecl C.namespaceDecl -func NamespaceDecl(ctx c.Pointer, href *Char, prefix *Char) - -//go:linkname Comment C.comment -func Comment(ctx c.Pointer, value *Char) - -//go:linkname CdataBlock C.cdataBlock -func CdataBlock(ctx c.Pointer, value *Char, len c.Int) - -// llgo:link (*SAXHandlerV1).InitxmlDefaultSAXHandler C.initxmlDefaultSAXHandler -func (recv_ *SAXHandlerV1) InitxmlDefaultSAXHandler(warning c.Int) { -} - -// llgo:link (*SAXHandlerV1).InithtmlDefaultSAXHandler C.inithtmlDefaultSAXHandler -func (recv_ *SAXHandlerV1) InithtmlDefaultSAXHandler() { -} diff --git a/libxml2/SAX2.go b/libxml2/SAX2.go deleted file mode 100644 index 471cf2b0..00000000 --- a/libxml2/SAX2.go +++ /dev/null @@ -1,118 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname SAX2GetPublicId C.xmlSAX2GetPublicId -func SAX2GetPublicId(ctx c.Pointer) *Char - -//go:linkname SAX2GetSystemId C.xmlSAX2GetSystemId -func SAX2GetSystemId(ctx c.Pointer) *Char - -//go:linkname SAX2SetDocumentLocator C.xmlSAX2SetDocumentLocator -func SAX2SetDocumentLocator(ctx c.Pointer, loc SAXLocatorPtr) - -//go:linkname SAX2GetLineNumber C.xmlSAX2GetLineNumber -func SAX2GetLineNumber(ctx c.Pointer) c.Int - -//go:linkname SAX2GetColumnNumber C.xmlSAX2GetColumnNumber -func SAX2GetColumnNumber(ctx c.Pointer) c.Int - -//go:linkname SAX2IsStandalone C.xmlSAX2IsStandalone -func SAX2IsStandalone(ctx c.Pointer) c.Int - -//go:linkname SAX2HasInternalSubset C.xmlSAX2HasInternalSubset -func SAX2HasInternalSubset(ctx c.Pointer) c.Int - -//go:linkname SAX2HasExternalSubset C.xmlSAX2HasExternalSubset -func SAX2HasExternalSubset(ctx c.Pointer) c.Int - -//go:linkname SAX2InternalSubset C.xmlSAX2InternalSubset -func SAX2InternalSubset(ctx c.Pointer, name *Char, ExternalID *Char, SystemID *Char) - -//go:linkname SAX2ExternalSubset C.xmlSAX2ExternalSubset -func SAX2ExternalSubset(ctx c.Pointer, name *Char, ExternalID *Char, SystemID *Char) - -//go:linkname SAX2GetEntity C.xmlSAX2GetEntity -func SAX2GetEntity(ctx c.Pointer, name *Char) EntityPtr - -//go:linkname SAX2GetParameterEntity C.xmlSAX2GetParameterEntity -func SAX2GetParameterEntity(ctx c.Pointer, name *Char) EntityPtr - -//go:linkname SAX2ResolveEntity C.xmlSAX2ResolveEntity -func SAX2ResolveEntity(ctx c.Pointer, publicId *Char, systemId *Char) ParserInputPtr - -//go:linkname SAX2EntityDecl C.xmlSAX2EntityDecl -func SAX2EntityDecl(ctx c.Pointer, name *Char, type_ c.Int, publicId *Char, systemId *Char, content *Char) - -//go:linkname SAX2AttributeDecl C.xmlSAX2AttributeDecl -func SAX2AttributeDecl(ctx c.Pointer, elem *Char, fullname *Char, type_ c.Int, def c.Int, defaultValue *Char, tree EnumerationPtr) - -//go:linkname SAX2ElementDecl C.xmlSAX2ElementDecl -func SAX2ElementDecl(ctx c.Pointer, name *Char, type_ c.Int, content ElementContentPtr) - -//go:linkname SAX2NotationDecl C.xmlSAX2NotationDecl -func SAX2NotationDecl(ctx c.Pointer, name *Char, publicId *Char, systemId *Char) - -//go:linkname SAX2UnparsedEntityDecl C.xmlSAX2UnparsedEntityDecl -func SAX2UnparsedEntityDecl(ctx c.Pointer, name *Char, publicId *Char, systemId *Char, notationName *Char) - -//go:linkname SAX2StartDocument C.xmlSAX2StartDocument -func SAX2StartDocument(ctx c.Pointer) - -//go:linkname SAX2EndDocument C.xmlSAX2EndDocument -func SAX2EndDocument(ctx c.Pointer) - -//go:linkname SAX2StartElement C.xmlSAX2StartElement -func SAX2StartElement(ctx c.Pointer, fullname *Char, atts **Char) - -//go:linkname SAX2EndElement C.xmlSAX2EndElement -func SAX2EndElement(ctx c.Pointer, name *Char) - -//go:linkname SAX2StartElementNs C.xmlSAX2StartElementNs -func SAX2StartElementNs(ctx c.Pointer, localname *Char, prefix *Char, URI *Char, nb_namespaces c.Int, namespaces **Char, nb_attributes c.Int, nb_defaulted c.Int, attributes **Char) - -//go:linkname SAX2EndElementNs C.xmlSAX2EndElementNs -func SAX2EndElementNs(ctx c.Pointer, localname *Char, prefix *Char, URI *Char) - -//go:linkname SAX2Reference C.xmlSAX2Reference -func SAX2Reference(ctx c.Pointer, name *Char) - -//go:linkname SAX2Characters C.xmlSAX2Characters -func SAX2Characters(ctx c.Pointer, ch *Char, len c.Int) - -//go:linkname SAX2IgnorableWhitespace C.xmlSAX2IgnorableWhitespace -func SAX2IgnorableWhitespace(ctx c.Pointer, ch *Char, len c.Int) - -//go:linkname SAX2ProcessingInstruction C.xmlSAX2ProcessingInstruction -func SAX2ProcessingInstruction(ctx c.Pointer, target *Char, data *Char) - -//go:linkname SAX2Comment C.xmlSAX2Comment -func SAX2Comment(ctx c.Pointer, value *Char) - -//go:linkname SAX2CDataBlock C.xmlSAX2CDataBlock -func SAX2CDataBlock(ctx c.Pointer, value *Char, len c.Int) - -//go:linkname SAXDefaultVersion C.xmlSAXDefaultVersion -func SAXDefaultVersion(version c.Int) c.Int - -// llgo:link (*SAXHandler).SAXVersion C.xmlSAXVersion -func (recv_ *SAXHandler) SAXVersion(version c.Int) c.Int { - return 0 -} - -// llgo:link (*SAXHandler).SAX2InitDefaultSAXHandler C.xmlSAX2InitDefaultSAXHandler -func (recv_ *SAXHandler) SAX2InitDefaultSAXHandler(warning c.Int) { -} - -// llgo:link (*SAXHandler).SAX2InitHtmlDefaultSAXHandler C.xmlSAX2InitHtmlDefaultSAXHandler -func (recv_ *SAXHandler) SAX2InitHtmlDefaultSAXHandler() { -} - -//go:linkname HtmlDefaultSAXHandlerInit C.htmlDefaultSAXHandlerInit -func HtmlDefaultSAXHandlerInit() - -//go:linkname DefaultSAXHandlerInit C.xmlDefaultSAXHandlerInit -func DefaultSAXHandlerInit() diff --git a/libxml2/_demo/hello/hello.go b/libxml2/_demo/hello/hello.go deleted file mode 100644 index 0737bb3b..00000000 --- a/libxml2/_demo/hello/hello.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/goplus/llpkg/libxml2" - - "github.com/goplus/lib/c" -) - -func main() { - libxml2.InitParser() - xml := "Alice25" - doc := libxml2.ReadMemory((*int8)(unsafe.Pointer(unsafe.StringData(xml))), c.Int(len(xml)), nil, nil, 0) - if doc == nil { - panic("Failed to parse XML") - } - docPtr := (*libxml2.Doc)(unsafe.Pointer(doc)) - root := docPtr.DocGetRootElement() - c.Printf(c.Str("Root element: %s\n"), root.Name) - libxml2.FreeDoc(doc) - libxml2.CleanupParser() -} diff --git a/libxml2/c14n.go b/libxml2/c14n.go deleted file mode 100644 index 37da7f36..00000000 --- a/libxml2/c14n.go +++ /dev/null @@ -1,29 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type C14NMode c.Int - -const ( - C14N_1_0 C14NMode = 0 - C14N_EXCLUSIVE_1_0 C14NMode = 1 - C14N_1_1 C14NMode = 2 -) - -//go:linkname C14NDocSaveTo C.xmlC14NDocSaveTo -func C14NDocSaveTo(doc DocPtr, nodes NodeSetPtr, mode c.Int, inclusive_ns_prefixes **Char, with_comments c.Int, buf OutputBufferPtr) c.Int - -//go:linkname C14NDocDumpMemory C.xmlC14NDocDumpMemory -func C14NDocDumpMemory(doc DocPtr, nodes NodeSetPtr, mode c.Int, inclusive_ns_prefixes **Char, with_comments c.Int, doc_txt_ptr **Char) c.Int - -//go:linkname C14NDocSave C.xmlC14NDocSave -func C14NDocSave(doc DocPtr, nodes NodeSetPtr, mode c.Int, inclusive_ns_prefixes **Char, with_comments c.Int, filename *c.Char, compression c.Int) c.Int - -// llgo:type C -type C14NIsVisibleCallback func(c.Pointer, NodePtr, NodePtr) c.Int - -//go:linkname C14NExecute C.xmlC14NExecute -func C14NExecute(doc DocPtr, is_visible_callback C14NIsVisibleCallback, user_data c.Pointer, mode c.Int, inclusive_ns_prefixes **Char, with_comments c.Int, buf OutputBufferPtr) c.Int diff --git a/libxml2/catalog.go b/libxml2/catalog.go deleted file mode 100644 index 36d1c017..00000000 --- a/libxml2/catalog.go +++ /dev/null @@ -1,170 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type CatalogPrefer c.Int - -const ( - CATA_PREFER_NONE CatalogPrefer = 0 - CATA_PREFER_PUBLIC CatalogPrefer = 1 - CATA_PREFER_SYSTEM CatalogPrefer = 2 -) - -type CatalogAllow c.Int - -const ( - CATA_ALLOW_NONE CatalogAllow = 0 - CATA_ALLOW_GLOBAL CatalogAllow = 1 - CATA_ALLOW_DOCUMENT CatalogAllow = 2 - CATA_ALLOW_ALL CatalogAllow = 3 -) - -type X_xmlCatalog struct { - Unused [8]uint8 -} -type Catalog X_xmlCatalog -type CatalogPtr *Catalog - -/* - * Operations on a given catalog. - */ -//go:linkname NewCatalog C.xmlNewCatalog -func NewCatalog(sgml c.Int) CatalogPtr - -//go:linkname LoadACatalog C.xmlLoadACatalog -func LoadACatalog(filename *c.Char) CatalogPtr - -//go:linkname LoadSGMLSuperCatalog C.xmlLoadSGMLSuperCatalog -func LoadSGMLSuperCatalog(filename *c.Char) CatalogPtr - -//go:linkname ConvertSGMLCatalog C.xmlConvertSGMLCatalog -func ConvertSGMLCatalog(catal CatalogPtr) c.Int - -//go:linkname ACatalogAdd C.xmlACatalogAdd -func ACatalogAdd(catal CatalogPtr, type_ *Char, orig *Char, replace *Char) c.Int - -//go:linkname ACatalogRemove C.xmlACatalogRemove -func ACatalogRemove(catal CatalogPtr, value *Char) c.Int - -//go:linkname ACatalogResolve C.xmlACatalogResolve -func ACatalogResolve(catal CatalogPtr, pubID *Char, sysID *Char) *Char - -//go:linkname ACatalogResolveSystem C.xmlACatalogResolveSystem -func ACatalogResolveSystem(catal CatalogPtr, sysID *Char) *Char - -//go:linkname ACatalogResolvePublic C.xmlACatalogResolvePublic -func ACatalogResolvePublic(catal CatalogPtr, pubID *Char) *Char - -//go:linkname ACatalogResolveURI C.xmlACatalogResolveURI -func ACatalogResolveURI(catal CatalogPtr, URI *Char) *Char - -//go:linkname ACatalogDump C.xmlACatalogDump -func ACatalogDump(catal CatalogPtr, out *c.FILE) - -//go:linkname FreeCatalog C.xmlFreeCatalog -func FreeCatalog(catal CatalogPtr) - -//go:linkname CatalogIsEmpty C.xmlCatalogIsEmpty -func CatalogIsEmpty(catal CatalogPtr) c.Int - -/* - * Global operations. - */ -//go:linkname InitializeCatalog C.xmlInitializeCatalog -func InitializeCatalog() - -//go:linkname LoadCatalog C.xmlLoadCatalog -func LoadCatalog(filename *c.Char) c.Int - -//go:linkname LoadCatalogs C.xmlLoadCatalogs -func LoadCatalogs(paths *c.Char) - -//go:linkname CatalogCleanup C.xmlCatalogCleanup -func CatalogCleanup() - -//go:linkname CatalogDump C.xmlCatalogDump -func CatalogDump(out *c.FILE) - -// llgo:link (*Char).CatalogResolve C.xmlCatalogResolve -func (recv_ *Char) CatalogResolve(sysID *Char) *Char { - return nil -} - -// llgo:link (*Char).CatalogResolveSystem C.xmlCatalogResolveSystem -func (recv_ *Char) CatalogResolveSystem() *Char { - return nil -} - -// llgo:link (*Char).CatalogResolvePublic C.xmlCatalogResolvePublic -func (recv_ *Char) CatalogResolvePublic() *Char { - return nil -} - -// llgo:link (*Char).CatalogResolveURI C.xmlCatalogResolveURI -func (recv_ *Char) CatalogResolveURI() *Char { - return nil -} - -// llgo:link (*Char).CatalogAdd C.xmlCatalogAdd -func (recv_ *Char) CatalogAdd(orig *Char, replace *Char) c.Int { - return 0 -} - -// llgo:link (*Char).CatalogRemove C.xmlCatalogRemove -func (recv_ *Char) CatalogRemove() c.Int { - return 0 -} - -//go:linkname ParseCatalogFile C.xmlParseCatalogFile -func ParseCatalogFile(filename *c.Char) DocPtr - -//go:linkname CatalogConvert C.xmlCatalogConvert -func CatalogConvert() c.Int - -/* - * Strictly minimal interfaces for per-document catalogs used - * by the parser. - */ -//go:linkname CatalogFreeLocal C.xmlCatalogFreeLocal -func CatalogFreeLocal(catalogs c.Pointer) - -//go:linkname CatalogAddLocal C.xmlCatalogAddLocal -func CatalogAddLocal(catalogs c.Pointer, URL *Char) c.Pointer - -//go:linkname CatalogLocalResolve C.xmlCatalogLocalResolve -func CatalogLocalResolve(catalogs c.Pointer, pubID *Char, sysID *Char) *Char - -//go:linkname CatalogLocalResolveURI C.xmlCatalogLocalResolveURI -func CatalogLocalResolveURI(catalogs c.Pointer, URI *Char) *Char - -/* - * Preference settings. - */ -//go:linkname CatalogSetDebug C.xmlCatalogSetDebug -func CatalogSetDebug(level c.Int) c.Int - -// llgo:link CatalogPrefer.CatalogSetDefaultPrefer C.xmlCatalogSetDefaultPrefer -func (recv_ CatalogPrefer) CatalogSetDefaultPrefer() CatalogPrefer { - return 0 -} - -// llgo:link CatalogAllow.CatalogSetDefaults C.xmlCatalogSetDefaults -func (recv_ CatalogAllow) CatalogSetDefaults() { -} - -//go:linkname CatalogGetDefaults C.xmlCatalogGetDefaults -func CatalogGetDefaults() CatalogAllow - -/* DEPRECATED interfaces */ -// llgo:link (*Char).CatalogGetSystem C.xmlCatalogGetSystem -func (recv_ *Char) CatalogGetSystem() *Char { - return nil -} - -// llgo:link (*Char).CatalogGetPublic C.xmlCatalogGetPublic -func (recv_ *Char) CatalogGetPublic() *Char { - return nil -} diff --git a/libxml2/chvalid.go b/libxml2/chvalid.go deleted file mode 100644 index 5c2024c3..00000000 --- a/libxml2/chvalid.go +++ /dev/null @@ -1,59 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlChSRange struct { - Low uint16 - High uint16 -} -type ChSRange X_xmlChSRange -type ChSRangePtr *ChSRange - -type X_xmlChLRange struct { - Low c.Uint - High c.Uint -} -type ChLRange X_xmlChLRange -type ChLRangePtr *ChLRange - -type X_xmlChRangeGroup struct { - NbShortRange c.Int - NbLongRange c.Int - ShortRange *ChSRange - LongRange *ChLRange -} -type ChRangeGroup X_xmlChRangeGroup -type ChRangeGroupPtr *ChRangeGroup - -/** - * Range checking routine - */ -//go:linkname CharInRange C.xmlCharInRange -func CharInRange(val c.Uint, group *ChRangeGroup) c.Int - -//go:linkname IsBaseChar C.xmlIsBaseChar -func IsBaseChar(ch c.Uint) c.Int - -//go:linkname IsBlank C.xmlIsBlank -func IsBlank(ch c.Uint) c.Int - -//go:linkname IsChar C.xmlIsChar -func IsChar(ch c.Uint) c.Int - -//go:linkname IsCombining C.xmlIsCombining -func IsCombining(ch c.Uint) c.Int - -//go:linkname IsDigit C.xmlIsDigit -func IsDigit(ch c.Uint) c.Int - -//go:linkname IsExtender C.xmlIsExtender -func IsExtender(ch c.Uint) c.Int - -//go:linkname IsIdeographic C.xmlIsIdeographic -func IsIdeographic(ch c.Uint) c.Int - -//go:linkname IsPubidChar C.xmlIsPubidChar -func IsPubidChar(ch c.Uint) c.Int diff --git a/libxml2/debugXML.go b/libxml2/debugXML.go deleted file mode 100644 index 332c6cad..00000000 --- a/libxml2/debugXML.go +++ /dev/null @@ -1,124 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -/* - * The standard Dump routines. - */ -//go:linkname DebugDumpString C.xmlDebugDumpString -func DebugDumpString(output *c.FILE, str *Char) - -//go:linkname DebugDumpAttr C.xmlDebugDumpAttr -func DebugDumpAttr(output *c.FILE, attr AttrPtr, depth c.Int) - -//go:linkname DebugDumpAttrList C.xmlDebugDumpAttrList -func DebugDumpAttrList(output *c.FILE, attr AttrPtr, depth c.Int) - -//go:linkname DebugDumpOneNode C.xmlDebugDumpOneNode -func DebugDumpOneNode(output *c.FILE, node NodePtr, depth c.Int) - -//go:linkname DebugDumpNode C.xmlDebugDumpNode -func DebugDumpNode(output *c.FILE, node NodePtr, depth c.Int) - -//go:linkname DebugDumpNodeList C.xmlDebugDumpNodeList -func DebugDumpNodeList(output *c.FILE, node NodePtr, depth c.Int) - -//go:linkname DebugDumpDocumentHead C.xmlDebugDumpDocumentHead -func DebugDumpDocumentHead(output *c.FILE, doc DocPtr) - -//go:linkname DebugDumpDocument C.xmlDebugDumpDocument -func DebugDumpDocument(output *c.FILE, doc DocPtr) - -//go:linkname DebugDumpDTD C.xmlDebugDumpDTD -func DebugDumpDTD(output *c.FILE, dtd DtdPtr) - -//go:linkname DebugDumpEntities C.xmlDebugDumpEntities -func DebugDumpEntities(output *c.FILE, doc DocPtr) - -/**************************************************************** - * * - * Checking routines * - * * - ****************************************************************/ -//go:linkname DebugCheckDocument C.xmlDebugCheckDocument -func DebugCheckDocument(output *c.FILE, doc DocPtr) c.Int - -/**************************************************************** - * * - * XML shell helpers * - * * - ****************************************************************/ -//go:linkname LsOneNode C.xmlLsOneNode -func LsOneNode(output *c.FILE, node NodePtr) - -//go:linkname LsCountNode C.xmlLsCountNode -func LsCountNode(node NodePtr) c.Int - -//go:linkname BoolToText C.xmlBoolToText -func BoolToText(boolval c.Int) *c.Char - -// llgo:type C -type ShellReadlineFunc func(*c.Char) *c.Char - -type X_xmlShellCtxt struct { - Filename *c.Char - Doc DocPtr - Node NodePtr - Pctxt XPathContextPtr - Loaded c.Int - Output *c.FILE - Input ShellReadlineFunc -} -type ShellCtxt X_xmlShellCtxt -type ShellCtxtPtr *ShellCtxt - -// llgo:type C -type ShellCmd func(ShellCtxtPtr, *c.Char, NodePtr, NodePtr) c.Int - -//go:linkname ShellPrintXPathError C.xmlShellPrintXPathError -func ShellPrintXPathError(errorType c.Int, arg *c.Char) - -//go:linkname ShellPrintXPathResult C.xmlShellPrintXPathResult -func ShellPrintXPathResult(list XPathObjectPtr) - -//go:linkname ShellList C.xmlShellList -func ShellList(ctxt ShellCtxtPtr, arg *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellBase C.xmlShellBase -func ShellBase(ctxt ShellCtxtPtr, arg *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellDir C.xmlShellDir -func ShellDir(ctxt ShellCtxtPtr, arg *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellLoad C.xmlShellLoad -func ShellLoad(ctxt ShellCtxtPtr, filename *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellPrintNode C.xmlShellPrintNode -func ShellPrintNode(node NodePtr) - -//go:linkname ShellCat C.xmlShellCat -func ShellCat(ctxt ShellCtxtPtr, arg *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellWrite C.xmlShellWrite -func ShellWrite(ctxt ShellCtxtPtr, filename *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellSave C.xmlShellSave -func ShellSave(ctxt ShellCtxtPtr, filename *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellValidate C.xmlShellValidate -func ShellValidate(ctxt ShellCtxtPtr, dtd *c.Char, node NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellDu C.xmlShellDu -func ShellDu(ctxt ShellCtxtPtr, arg *c.Char, tree NodePtr, node2 NodePtr) c.Int - -//go:linkname ShellPwd C.xmlShellPwd -func ShellPwd(ctxt ShellCtxtPtr, buffer *c.Char, node NodePtr, node2 NodePtr) c.Int - -/* - * The Shell interface. - */ -//go:linkname Shell C.xmlShell -func Shell(doc DocPtr, filename *c.Char, input ShellReadlineFunc, output *c.FILE) diff --git a/libxml2/dict.go b/libxml2/dict.go deleted file mode 100644 index 0c232bad..00000000 --- a/libxml2/dict.go +++ /dev/null @@ -1,60 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type Dict X_xmlDict -type DictPtr *Dict - -/* - * Initializer - */ -//go:linkname InitializeDict C.xmlInitializeDict -func InitializeDict() c.Int - -/* - * Constructor and destructor. - */ -//go:linkname DictCreate C.xmlDictCreate -func DictCreate() DictPtr - -//go:linkname DictSetLimit C.xmlDictSetLimit -func DictSetLimit(dict DictPtr, limit c.SizeT) c.SizeT - -//go:linkname DictGetUsage C.xmlDictGetUsage -func DictGetUsage(dict DictPtr) c.SizeT - -//go:linkname DictCreateSub C.xmlDictCreateSub -func DictCreateSub(sub DictPtr) DictPtr - -//go:linkname DictReference C.xmlDictReference -func DictReference(dict DictPtr) c.Int - -//go:linkname DictFree C.xmlDictFree -func DictFree(dict DictPtr) - -/* - * Lookup of entry in the dictionary. - */ -//go:linkname DictLookup C.xmlDictLookup -func DictLookup(dict DictPtr, name *Char, len c.Int) *Char - -//go:linkname DictExists C.xmlDictExists -func DictExists(dict DictPtr, name *Char, len c.Int) *Char - -//go:linkname DictQLookup C.xmlDictQLookup -func DictQLookup(dict DictPtr, prefix *Char, name *Char) *Char - -//go:linkname DictOwns C.xmlDictOwns -func DictOwns(dict DictPtr, str *Char) c.Int - -//go:linkname DictSize C.xmlDictSize -func DictSize(dict DictPtr) c.Int - -/* - * Cleanup function - */ -//go:linkname DictCleanup C.xmlDictCleanup -func DictCleanup() diff --git a/libxml2/encoding.go b/libxml2/encoding.go deleted file mode 100644 index d80cb379..00000000 --- a/libxml2/encoding.go +++ /dev/null @@ -1,150 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type CharEncError c.Int - -const ( - ENC_ERR_SUCCESS CharEncError = 0 - ENC_ERR_SPACE CharEncError = -1 - ENC_ERR_INPUT CharEncError = -2 - ENC_ERR_PARTIAL CharEncError = -3 - ENC_ERR_INTERNAL CharEncError = -4 - ENC_ERR_MEMORY CharEncError = -5 -) - -type CharEncoding c.Int - -const ( - CHAR_ENCODING_ERROR CharEncoding = -1 - CHAR_ENCODING_NONE CharEncoding = 0 - CHAR_ENCODING_UTF8 CharEncoding = 1 - CHAR_ENCODING_UTF16LE CharEncoding = 2 - CHAR_ENCODING_UTF16BE CharEncoding = 3 - CHAR_ENCODING_UCS4LE CharEncoding = 4 - CHAR_ENCODING_UCS4BE CharEncoding = 5 - CHAR_ENCODING_EBCDIC CharEncoding = 6 - CHAR_ENCODING_UCS4_2143 CharEncoding = 7 - CHAR_ENCODING_UCS4_3412 CharEncoding = 8 - CHAR_ENCODING_UCS2 CharEncoding = 9 - CHAR_ENCODING_8859_1 CharEncoding = 10 - CHAR_ENCODING_8859_2 CharEncoding = 11 - CHAR_ENCODING_8859_3 CharEncoding = 12 - CHAR_ENCODING_8859_4 CharEncoding = 13 - CHAR_ENCODING_8859_5 CharEncoding = 14 - CHAR_ENCODING_8859_6 CharEncoding = 15 - CHAR_ENCODING_8859_7 CharEncoding = 16 - CHAR_ENCODING_8859_8 CharEncoding = 17 - CHAR_ENCODING_8859_9 CharEncoding = 18 - CHAR_ENCODING_2022_JP CharEncoding = 19 - CHAR_ENCODING_SHIFT_JIS CharEncoding = 20 - CHAR_ENCODING_EUC_JP CharEncoding = 21 - CHAR_ENCODING_ASCII CharEncoding = 22 -) - -// llgo:type C -type CharEncodingInputFunc func(*c.Char, *c.Int, *c.Char, *c.Int) c.Int - -// llgo:type C -type CharEncodingOutputFunc func(*c.Char, *c.Int, *c.Char, *c.Int) c.Int - -type X_xmlCharEncodingHandler struct { - Name *c.Char - Input CharEncodingInputFunc - Output CharEncodingOutputFunc -} -type CharEncodingHandler X_xmlCharEncodingHandler -type CharEncodingHandlerPtr *CharEncodingHandler - -/* - * Interfaces for encoding handlers. - */ -//go:linkname InitCharEncodingHandlers C.xmlInitCharEncodingHandlers -func InitCharEncodingHandlers() - -//go:linkname CleanupCharEncodingHandlers C.xmlCleanupCharEncodingHandlers -func CleanupCharEncodingHandlers() - -//go:linkname RegisterCharEncodingHandler C.xmlRegisterCharEncodingHandler -func RegisterCharEncodingHandler(handler CharEncodingHandlerPtr) - -// llgo:link CharEncoding.LookupCharEncodingHandler C.xmlLookupCharEncodingHandler -func (recv_ CharEncoding) LookupCharEncodingHandler(out *CharEncodingHandlerPtr) c.Int { - return 0 -} - -//go:linkname OpenCharEncodingHandler C.xmlOpenCharEncodingHandler -func OpenCharEncodingHandler(name *c.Char, output c.Int, out *CharEncodingHandlerPtr) c.Int - -// llgo:link CharEncoding.GetCharEncodingHandler C.xmlGetCharEncodingHandler -func (recv_ CharEncoding) GetCharEncodingHandler() CharEncodingHandlerPtr { - return nil -} - -//go:linkname FindCharEncodingHandler C.xmlFindCharEncodingHandler -func FindCharEncodingHandler(name *c.Char) CharEncodingHandlerPtr - -//go:linkname NewCharEncodingHandler C.xmlNewCharEncodingHandler -func NewCharEncodingHandler(name *c.Char, input CharEncodingInputFunc, output CharEncodingOutputFunc) CharEncodingHandlerPtr - -/* - * Interfaces for encoding names and aliases. - */ -//go:linkname AddEncodingAlias C.xmlAddEncodingAlias -func AddEncodingAlias(name *c.Char, alias *c.Char) c.Int - -//go:linkname DelEncodingAlias C.xmlDelEncodingAlias -func DelEncodingAlias(alias *c.Char) c.Int - -//go:linkname GetEncodingAlias C.xmlGetEncodingAlias -func GetEncodingAlias(alias *c.Char) *c.Char - -//go:linkname CleanupEncodingAliases C.xmlCleanupEncodingAliases -func CleanupEncodingAliases() - -//go:linkname ParseCharEncoding C.xmlParseCharEncoding -func ParseCharEncoding(name *c.Char) CharEncoding - -// llgo:link CharEncoding.GetCharEncodingName C.xmlGetCharEncodingName -func (recv_ CharEncoding) GetCharEncodingName() *c.Char { - return nil -} - -/* - * Interfaces directly used by the parsers. - */ -//go:linkname DetectCharEncoding C.xmlDetectCharEncoding -func DetectCharEncoding(in *c.Char, len c.Int) CharEncoding - -/** DOC_ENABLE */ -// llgo:link (*CharEncodingHandler).CharEncOutFunc C.xmlCharEncOutFunc -func (recv_ *CharEncodingHandler) CharEncOutFunc(out *X_xmlBuffer, in *X_xmlBuffer) c.Int { - return 0 -} - -// llgo:link (*CharEncodingHandler).CharEncInFunc C.xmlCharEncInFunc -func (recv_ *CharEncodingHandler) CharEncInFunc(out *X_xmlBuffer, in *X_xmlBuffer) c.Int { - return 0 -} - -// llgo:link (*CharEncodingHandler).CharEncFirstLine C.xmlCharEncFirstLine -func (recv_ *CharEncodingHandler) CharEncFirstLine(out *X_xmlBuffer, in *X_xmlBuffer) c.Int { - return 0 -} - -// llgo:link (*CharEncodingHandler).CharEncCloseFunc C.xmlCharEncCloseFunc -func (recv_ *CharEncodingHandler) CharEncCloseFunc() c.Int { - return 0 -} - -/* - * Export a few useful functions - */ -//go:linkname UTF8Toisolat1 C.UTF8Toisolat1 -func UTF8Toisolat1(out *c.Char, outlen *c.Int, in *c.Char, inlen *c.Int) c.Int - -//go:linkname Isolat1ToUTF8 C.isolat1ToUTF8 -func Isolat1ToUTF8(out *c.Char, outlen *c.Int, in *c.Char, inlen *c.Int) c.Int diff --git a/libxml2/entities.go b/libxml2/entities.go deleted file mode 100644 index bd28cb59..00000000 --- a/libxml2/entities.go +++ /dev/null @@ -1,86 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type EntityType c.Int - -const ( - INTERNAL_GENERAL_ENTITY EntityType = 1 - EXTERNAL_GENERAL_PARSED_ENTITY EntityType = 2 - EXTERNAL_GENERAL_UNPARSED_ENTITY EntityType = 3 - INTERNAL_PARAMETER_ENTITY EntityType = 4 - EXTERNAL_PARAMETER_ENTITY EntityType = 5 - INTERNAL_PREDEFINED_ENTITY EntityType = 6 -) - -type EntitiesTable X_xmlHashTable -type EntitiesTablePtr *EntitiesTable - -/* - * External functions: - */ -//go:linkname InitializePredefinedEntities C.xmlInitializePredefinedEntities -func InitializePredefinedEntities() - -//go:linkname NewEntity C.xmlNewEntity -func NewEntity(doc DocPtr, name *Char, type_ c.Int, ExternalID *Char, SystemID *Char, content *Char) EntityPtr - -//go:linkname FreeEntity C.xmlFreeEntity -func FreeEntity(entity EntityPtr) - -//go:linkname AddEntity C.xmlAddEntity -func AddEntity(doc DocPtr, extSubset c.Int, name *Char, type_ c.Int, ExternalID *Char, SystemID *Char, content *Char, out *EntityPtr) c.Int - -//go:linkname AddDocEntity C.xmlAddDocEntity -func AddDocEntity(doc DocPtr, name *Char, type_ c.Int, ExternalID *Char, SystemID *Char, content *Char) EntityPtr - -//go:linkname AddDtdEntity C.xmlAddDtdEntity -func AddDtdEntity(doc DocPtr, name *Char, type_ c.Int, ExternalID *Char, SystemID *Char, content *Char) EntityPtr - -// llgo:link (*Char).GetPredefinedEntity C.xmlGetPredefinedEntity -func (recv_ *Char) GetPredefinedEntity() EntityPtr { - return nil -} - -// llgo:link (*Doc).GetDocEntity C.xmlGetDocEntity -func (recv_ *Doc) GetDocEntity(name *Char) EntityPtr { - return nil -} - -//go:linkname GetDtdEntity C.xmlGetDtdEntity -func GetDtdEntity(doc DocPtr, name *Char) EntityPtr - -//go:linkname GetParameterEntity C.xmlGetParameterEntity -func GetParameterEntity(doc DocPtr, name *Char) EntityPtr - -//go:linkname EncodeEntities C.xmlEncodeEntities -func EncodeEntities(doc DocPtr, input *Char) *Char - -//go:linkname EncodeEntitiesReentrant C.xmlEncodeEntitiesReentrant -func EncodeEntitiesReentrant(doc DocPtr, input *Char) *Char - -// llgo:link (*Doc).EncodeSpecialChars C.xmlEncodeSpecialChars -func (recv_ *Doc) EncodeSpecialChars(input *Char) *Char { - return nil -} - -//go:linkname CreateEntitiesTable C.xmlCreateEntitiesTable -func CreateEntitiesTable() EntitiesTablePtr - -//go:linkname CopyEntitiesTable C.xmlCopyEntitiesTable -func CopyEntitiesTable(table EntitiesTablePtr) EntitiesTablePtr - -//go:linkname FreeEntitiesTable C.xmlFreeEntitiesTable -func FreeEntitiesTable(table EntitiesTablePtr) - -//go:linkname DumpEntitiesTable C.xmlDumpEntitiesTable -func DumpEntitiesTable(buf BufferPtr, table EntitiesTablePtr) - -//go:linkname DumpEntityDecl C.xmlDumpEntityDecl -func DumpEntityDecl(buf BufferPtr, ent EntityPtr) - -//go:linkname CleanupPredefinedEntities C.xmlCleanupPredefinedEntities -func CleanupPredefinedEntities() diff --git a/libxml2/globals.go b/libxml2/globals.go deleted file mode 100644 index d0f6b23f..00000000 --- a/libxml2/globals.go +++ /dev/null @@ -1,15 +0,0 @@ -package libxml2 - -import _ "unsafe" - -type X_xmlGlobalState struct { - Unused [8]uint8 -} -type GlobalState X_xmlGlobalState -type GlobalStatePtr *GlobalState - -//go:linkname InitializeGlobalState C.xmlInitializeGlobalState -func InitializeGlobalState(gs GlobalStatePtr) - -//go:linkname GetGlobalState C.xmlGetGlobalState -func GetGlobalState() GlobalStatePtr diff --git a/libxml2/go.mod b/libxml2/go.mod deleted file mode 100644 index 7227c4f4..00000000 --- a/libxml2/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/libxml2 - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/libxml2/go.sum b/libxml2/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/libxml2/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/libxml2/hash.go b/libxml2/hash.go deleted file mode 100644 index a7045f16..00000000 --- a/libxml2/hash.go +++ /dev/null @@ -1,126 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlHashTable struct { - Unused [8]uint8 -} -type HashTable X_xmlHashTable -type HashTablePtr *HashTable - -// llgo:type C -type HashDeallocator func(c.Pointer, *Char) - -// llgo:type C -type HashCopier func(c.Pointer, *Char) c.Pointer - -// llgo:type C -type HashScanner func(c.Pointer, c.Pointer, *Char) - -// llgo:type C -type HashScannerFull func(c.Pointer, c.Pointer, *Char, *Char, *Char) - -/* - * Constructor and destructor. - */ -//go:linkname HashCreate C.xmlHashCreate -func HashCreate(size c.Int) HashTablePtr - -//go:linkname HashCreateDict C.xmlHashCreateDict -func HashCreateDict(size c.Int, dict DictPtr) HashTablePtr - -//go:linkname HashFree C.xmlHashFree -func HashFree(hash HashTablePtr, dealloc HashDeallocator) - -//go:linkname HashDefaultDeallocator C.xmlHashDefaultDeallocator -func HashDefaultDeallocator(entry c.Pointer, name *Char) - -/* - * Add a new entry to the hash table. - */ -//go:linkname HashAdd C.xmlHashAdd -func HashAdd(hash HashTablePtr, name *Char, userdata c.Pointer) c.Int - -//go:linkname HashAddEntry C.xmlHashAddEntry -func HashAddEntry(hash HashTablePtr, name *Char, userdata c.Pointer) c.Int - -//go:linkname HashUpdateEntry C.xmlHashUpdateEntry -func HashUpdateEntry(hash HashTablePtr, name *Char, userdata c.Pointer, dealloc HashDeallocator) c.Int - -//go:linkname HashAdd2 C.xmlHashAdd2 -func HashAdd2(hash HashTablePtr, name *Char, name2 *Char, userdata c.Pointer) c.Int - -//go:linkname HashAddEntry2 C.xmlHashAddEntry2 -func HashAddEntry2(hash HashTablePtr, name *Char, name2 *Char, userdata c.Pointer) c.Int - -//go:linkname HashUpdateEntry2 C.xmlHashUpdateEntry2 -func HashUpdateEntry2(hash HashTablePtr, name *Char, name2 *Char, userdata c.Pointer, dealloc HashDeallocator) c.Int - -//go:linkname HashAdd3 C.xmlHashAdd3 -func HashAdd3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char, userdata c.Pointer) c.Int - -//go:linkname HashAddEntry3 C.xmlHashAddEntry3 -func HashAddEntry3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char, userdata c.Pointer) c.Int - -//go:linkname HashUpdateEntry3 C.xmlHashUpdateEntry3 -func HashUpdateEntry3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char, userdata c.Pointer, dealloc HashDeallocator) c.Int - -/* - * Remove an entry from the hash table. - */ -//go:linkname HashRemoveEntry C.xmlHashRemoveEntry -func HashRemoveEntry(hash HashTablePtr, name *Char, dealloc HashDeallocator) c.Int - -//go:linkname HashRemoveEntry2 C.xmlHashRemoveEntry2 -func HashRemoveEntry2(hash HashTablePtr, name *Char, name2 *Char, dealloc HashDeallocator) c.Int - -//go:linkname HashRemoveEntry3 C.xmlHashRemoveEntry3 -func HashRemoveEntry3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char, dealloc HashDeallocator) c.Int - -/* - * Retrieve the payload. - */ -//go:linkname HashLookup C.xmlHashLookup -func HashLookup(hash HashTablePtr, name *Char) c.Pointer - -//go:linkname HashLookup2 C.xmlHashLookup2 -func HashLookup2(hash HashTablePtr, name *Char, name2 *Char) c.Pointer - -//go:linkname HashLookup3 C.xmlHashLookup3 -func HashLookup3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char) c.Pointer - -//go:linkname HashQLookup C.xmlHashQLookup -func HashQLookup(hash HashTablePtr, prefix *Char, name *Char) c.Pointer - -//go:linkname HashQLookup2 C.xmlHashQLookup2 -func HashQLookup2(hash HashTablePtr, prefix *Char, name *Char, prefix2 *Char, name2 *Char) c.Pointer - -//go:linkname HashQLookup3 C.xmlHashQLookup3 -func HashQLookup3(hash HashTablePtr, prefix *Char, name *Char, prefix2 *Char, name2 *Char, prefix3 *Char, name3 *Char) c.Pointer - -/* - * Helpers. - */ -//go:linkname HashCopySafe C.xmlHashCopySafe -func HashCopySafe(hash HashTablePtr, copy HashCopier, dealloc HashDeallocator) HashTablePtr - -//go:linkname HashCopy C.xmlHashCopy -func HashCopy(hash HashTablePtr, copy HashCopier) HashTablePtr - -//go:linkname HashSize C.xmlHashSize -func HashSize(hash HashTablePtr) c.Int - -//go:linkname HashScan C.xmlHashScan -func HashScan(hash HashTablePtr, scan HashScanner, data c.Pointer) - -//go:linkname HashScan3 C.xmlHashScan3 -func HashScan3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char, scan HashScanner, data c.Pointer) - -//go:linkname HashScanFull C.xmlHashScanFull -func HashScanFull(hash HashTablePtr, scan HashScannerFull, data c.Pointer) - -//go:linkname HashScanFull3 C.xmlHashScanFull3 -func HashScanFull3(hash HashTablePtr, name *Char, name2 *Char, name3 *Char, scan HashScannerFull, data c.Pointer) diff --git a/libxml2/libxml2_autogen_link.go b/libxml2/libxml2_autogen_link.go deleted file mode 100644 index 873db775..00000000 --- a/libxml2/libxml2_autogen_link.go +++ /dev/null @@ -1,8 +0,0 @@ -package libxml2 - -import ( - _ "github.com/goplus/lib/c" - _ "github.com/goplus/lib/c/os" -) - -const LLGoPackage string = "link: $(pkg-config --libs libxml-2.0);" diff --git a/libxml2/list.go b/libxml2/list.go deleted file mode 100644 index 90d21f11..00000000 --- a/libxml2/list.go +++ /dev/null @@ -1,109 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlLink struct { - Unused [8]uint8 -} -type Link X_xmlLink -type LinkPtr *Link - -type X_xmlList struct { - Unused [8]uint8 -} -type List X_xmlList -type ListPtr *List - -// llgo:type C -type ListDeallocator func(LinkPtr) - -// llgo:type C -type ListDataCompare func(c.Pointer, c.Pointer) c.Int - -// llgo:type C -type ListWalker func(c.Pointer, c.Pointer) c.Int - -/* Creation/Deletion */ -//go:linkname ListCreate C.xmlListCreate -func ListCreate(deallocator ListDeallocator, compare ListDataCompare) ListPtr - -//go:linkname ListDelete C.xmlListDelete -func ListDelete(l ListPtr) - -/* Basic Operators */ -//go:linkname ListSearch C.xmlListSearch -func ListSearch(l ListPtr, data c.Pointer) c.Pointer - -//go:linkname ListReverseSearch C.xmlListReverseSearch -func ListReverseSearch(l ListPtr, data c.Pointer) c.Pointer - -//go:linkname ListInsert C.xmlListInsert -func ListInsert(l ListPtr, data c.Pointer) c.Int - -//go:linkname ListAppend C.xmlListAppend -func ListAppend(l ListPtr, data c.Pointer) c.Int - -//go:linkname ListRemoveFirst C.xmlListRemoveFirst -func ListRemoveFirst(l ListPtr, data c.Pointer) c.Int - -//go:linkname ListRemoveLast C.xmlListRemoveLast -func ListRemoveLast(l ListPtr, data c.Pointer) c.Int - -//go:linkname ListRemoveAll C.xmlListRemoveAll -func ListRemoveAll(l ListPtr, data c.Pointer) c.Int - -//go:linkname ListClear C.xmlListClear -func ListClear(l ListPtr) - -//go:linkname ListEmpty C.xmlListEmpty -func ListEmpty(l ListPtr) c.Int - -//go:linkname ListFront C.xmlListFront -func ListFront(l ListPtr) LinkPtr - -//go:linkname ListEnd C.xmlListEnd -func ListEnd(l ListPtr) LinkPtr - -//go:linkname ListSize C.xmlListSize -func ListSize(l ListPtr) c.Int - -//go:linkname ListPopFront C.xmlListPopFront -func ListPopFront(l ListPtr) - -//go:linkname ListPopBack C.xmlListPopBack -func ListPopBack(l ListPtr) - -//go:linkname ListPushFront C.xmlListPushFront -func ListPushFront(l ListPtr, data c.Pointer) c.Int - -//go:linkname ListPushBack C.xmlListPushBack -func ListPushBack(l ListPtr, data c.Pointer) c.Int - -/* Advanced Operators */ -//go:linkname ListReverse C.xmlListReverse -func ListReverse(l ListPtr) - -//go:linkname ListSort C.xmlListSort -func ListSort(l ListPtr) - -//go:linkname ListWalk C.xmlListWalk -func ListWalk(l ListPtr, walker ListWalker, user c.Pointer) - -//go:linkname ListReverseWalk C.xmlListReverseWalk -func ListReverseWalk(l ListPtr, walker ListWalker, user c.Pointer) - -//go:linkname ListMerge C.xmlListMerge -func ListMerge(l1 ListPtr, l2 ListPtr) - -//go:linkname ListDup C.xmlListDup -func ListDup(old ListPtr) ListPtr - -//go:linkname ListCopy C.xmlListCopy -func ListCopy(cur ListPtr, old ListPtr) c.Int - -/* Link operators */ -//go:linkname LinkGetData C.xmlLinkGetData -func LinkGetData(lk LinkPtr) c.Pointer diff --git a/libxml2/llcppg.cfg b/libxml2/llcppg.cfg deleted file mode 100644 index fd7811db..00000000 --- a/libxml2/llcppg.cfg +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "libxml2", - "cflags": "$(pkg-config --cflags libxml-2.0)", - "libs": "$(pkg-config --libs libxml-2.0)", - "include": [ - "libxml/parserInternals.h", - "libxml/xmlschemastypes.h", - "libxml/globals.h", - "libxml/xmlreader.h", - "libxml/xpointer.h", - "libxml/HTMLtree.h", - "libxml/c14n.h", - "libxml/xpathInternals.h", - "libxml/debugXML.h", - "libxml/xpath.h", - "libxml/pattern.h", - "libxml/xmlsave.h", - "libxml/xlink.h", - "libxml/catalog.h", - "libxml/SAX2.h", - "libxml/xinclude.h", - "libxml/parser.h", - "libxml/SAX.h", - "libxml/xmlschemas.h", - "libxml/relaxng.h", - "libxml/schemasInternals.h", - "libxml/schematron.h", - "libxml/HTMLparser.h", - "libxml/tree.h", - "libxml/valid.h", - "libxml/xmlwriter.h", - "libxml/xmlIO.h", - "libxml/entities.h", - "libxml/hash.h", - "libxml/dict.h", - "libxml/xmlautomata.h", - "libxml/uri.h", - "libxml/chvalid.h", - "libxml/xmlregexp.h", - "libxml/threads.h", - "libxml/xmlmodule.h", - "libxml/xmlmemory.h", - "libxml/xmlerror.h", - "libxml/xmlstring.h", - "libxml/xmlunicode.h", - "libxml/nanohttp.h", - "libxml/nanoftp.h", - "libxml/list.h", - "libxml/encoding.h", - "libxml/xmlversion.h", - "libxml/xmlexports.h" - ], - "deps":["c","c/os"], - "trimPrefixes": ["xml","XML_","XML","LIBXML_"], - "cplusplus": false, - "symMap" :{ - "attribute": "GetAttribute" - } -} diff --git a/libxml2/llcppg.pub b/libxml2/llcppg.pub deleted file mode 100644 index 10830fc3..00000000 --- a/libxml2/llcppg.pub +++ /dev/null @@ -1,337 +0,0 @@ -attributeDeclSAXFunc AttributeDeclSAXFunc -attributeSAXFunc AttributeSAXFunc -cdataBlockSAXFunc CdataBlockSAXFunc -charactersSAXFunc CharactersSAXFunc -commentSAXFunc CommentSAXFunc -elementDeclSAXFunc ElementDeclSAXFunc -endDocumentSAXFunc EndDocumentSAXFunc -endElementNsSAX2Func EndElementNsSAX2Func -endElementSAXFunc EndElementSAXFunc -entityDeclSAXFunc EntityDeclSAXFunc -errorSAXFunc ErrorSAXFunc -externalSubsetSAXFunc ExternalSubsetSAXFunc -fatalErrorSAXFunc FatalErrorSAXFunc -ftpDataCallback FtpDataCallback -ftpListCallback FtpListCallback -getEntitySAXFunc GetEntitySAXFunc -getParameterEntitySAXFunc GetParameterEntitySAXFunc -hasExternalSubsetSAXFunc HasExternalSubsetSAXFunc -hasInternalSubsetSAXFunc HasInternalSubsetSAXFunc -htmlDocPtr HtmlDocPtr -htmlElemDesc HtmlElemDesc -htmlElemDescPtr HtmlElemDescPtr -htmlEntityDesc HtmlEntityDesc -htmlEntityDescPtr HtmlEntityDescPtr -htmlNodePtr HtmlNodePtr -htmlParserCtxt HtmlParserCtxt -htmlParserCtxtPtr HtmlParserCtxtPtr -htmlParserInput HtmlParserInput -htmlParserInputPtr HtmlParserInputPtr -htmlParserNodeInfo HtmlParserNodeInfo -htmlParserOption HtmlParserOption -htmlSAXHandler HtmlSAXHandler -htmlSAXHandlerPtr HtmlSAXHandlerPtr -htmlStatus HtmlStatus -ignorableWhitespaceSAXFunc IgnorableWhitespaceSAXFunc -internalSubsetSAXFunc InternalSubsetSAXFunc -isStandaloneSAXFunc IsStandaloneSAXFunc -notationDeclSAXFunc NotationDeclSAXFunc -processingInstructionSAXFunc ProcessingInstructionSAXFunc -referenceSAXFunc ReferenceSAXFunc -resolveEntitySAXFunc ResolveEntitySAXFunc -setDocumentLocatorSAXFunc SetDocumentLocatorSAXFunc -startDocumentSAXFunc StartDocumentSAXFunc -startElementNsSAX2Func StartElementNsSAX2Func -startElementSAXFunc StartElementSAXFunc -unparsedEntityDeclSAXFunc UnparsedEntityDeclSAXFunc -warningSAXFunc WarningSAXFunc -xlinkActuate XlinkActuate -xlinkExtendedLinkFunk XlinkExtendedLinkFunk -xlinkExtendedLinkSetFunk XlinkExtendedLinkSetFunk -xlinkHRef XlinkHRef -xlinkHandler XlinkHandler -xlinkHandlerPtr XlinkHandlerPtr -xlinkNodeDetectFunc XlinkNodeDetectFunc -xlinkRole XlinkRole -xlinkShow XlinkShow -xlinkSimpleLinkFunk XlinkSimpleLinkFunk -xlinkTitle XlinkTitle -xlinkType XlinkType -xmlAttr Attr -xmlAttrHashBucket AttrHashBucket -xmlAttrPtr AttrPtr -xmlAttribute Attribute -xmlAttributeDefault AttributeDefault -xmlAttributePtr AttributePtr -xmlAttributeTable AttributeTable -xmlAttributeTablePtr AttributeTablePtr -xmlAttributeType AttributeType -xmlAutomata Automata -xmlAutomataPtr AutomataPtr -xmlAutomataState AutomataState -xmlAutomataStatePtr AutomataStatePtr -xmlBuf Buf -xmlBufPtr BufPtr -xmlBuffer Buffer -xmlBufferAllocationScheme BufferAllocationScheme -xmlBufferPtr BufferPtr -xmlC14NIsVisibleCallback C14NIsVisibleCallback -xmlC14NMode C14NMode -xmlCatalog Catalog -xmlCatalogAllow CatalogAllow -xmlCatalogPrefer CatalogPrefer -xmlCatalogPtr CatalogPtr -xmlChLRange ChLRange -xmlChLRangePtr ChLRangePtr -xmlChRangeGroup ChRangeGroup -xmlChRangeGroupPtr ChRangeGroupPtr -xmlChSRange ChSRange -xmlChSRangePtr ChSRangePtr -xmlChar Char -xmlCharEncError CharEncError -xmlCharEncoding CharEncoding -xmlCharEncodingHandler CharEncodingHandler -xmlCharEncodingHandlerPtr CharEncodingHandlerPtr -xmlCharEncodingInputFunc CharEncodingInputFunc -xmlCharEncodingOutputFunc CharEncodingOutputFunc -xmlDOMWrapAcquireNsFunction DOMWrapAcquireNsFunction -xmlDOMWrapCtxt DOMWrapCtxt -xmlDOMWrapCtxtPtr DOMWrapCtxtPtr -xmlDeregisterNodeFunc DeregisterNodeFunc -xmlDict Dict -xmlDictPtr DictPtr -xmlDoc Doc -xmlDocProperties DocProperties -xmlDocPtr DocPtr -xmlDtd Dtd -xmlDtdPtr DtdPtr -xmlElement Element -xmlElementContent ElementContent -xmlElementContentOccur ElementContentOccur -xmlElementContentPtr ElementContentPtr -xmlElementContentType ElementContentType -xmlElementPtr ElementPtr -xmlElementTable ElementTable -xmlElementTablePtr ElementTablePtr -xmlElementType ElementType -xmlElementTypeVal ElementTypeVal -xmlEntitiesTable EntitiesTable -xmlEntitiesTablePtr EntitiesTablePtr -xmlEntity Entity -xmlEntityPtr EntityPtr -xmlEntityReferenceFunc EntityReferenceFunc -xmlEntityType EntityType -xmlEnumeration Enumeration -xmlEnumerationPtr EnumerationPtr -xmlError Error -xmlErrorDomain ErrorDomain -xmlErrorLevel ErrorLevel -xmlErrorPtr ErrorPtr -xmlExternalEntityLoader ExternalEntityLoader -xmlFeature Feature -xmlFreeFunc FreeFunc -xmlGenericErrorFunc GenericErrorFunc -xmlGlobalState GlobalState -xmlGlobalStatePtr GlobalStatePtr -xmlHashCopier HashCopier -xmlHashDeallocator HashDeallocator -xmlHashScanner HashScanner -xmlHashScannerFull HashScannerFull -xmlHashTable HashTable -xmlHashTablePtr HashTablePtr -xmlID ID -xmlIDPtr IDPtr -xmlIDTable IDTable -xmlIDTablePtr IDTablePtr -xmlInputCloseCallback InputCloseCallback -xmlInputMatchCallback InputMatchCallback -xmlInputOpenCallback InputOpenCallback -xmlInputReadCallback InputReadCallback -xmlLink Link -xmlLinkPtr LinkPtr -xmlList List -xmlListDataCompare ListDataCompare -xmlListDeallocator ListDeallocator -xmlListPtr ListPtr -xmlListWalker ListWalker -xmlMallocFunc MallocFunc -xmlModule Module -xmlModuleOption ModuleOption -xmlModulePtr ModulePtr -xmlMutex Mutex -xmlMutexPtr MutexPtr -xmlNode Node -xmlNodePtr NodePtr -xmlNodeSet NodeSet -xmlNodeSetPtr NodeSetPtr -xmlNotation Notation -xmlNotationPtr NotationPtr -xmlNotationTable NotationTable -xmlNotationTablePtr NotationTablePtr -xmlNs Ns -xmlNsPtr NsPtr -xmlNsType NsType -xmlOutputBuffer OutputBuffer -xmlOutputBufferCreateFilenameFunc OutputBufferCreateFilenameFunc -xmlOutputBufferPtr OutputBufferPtr -xmlOutputCloseCallback OutputCloseCallback -xmlOutputMatchCallback OutputMatchCallback -xmlOutputOpenCallback OutputOpenCallback -xmlOutputWriteCallback OutputWriteCallback -xmlParserCtxt ParserCtxt -xmlParserCtxtPtr ParserCtxtPtr -xmlParserErrors ParserErrors -xmlParserInput ParserInput -xmlParserInputBuffer ParserInputBuffer -xmlParserInputBufferCreateFilenameFunc ParserInputBufferCreateFilenameFunc -xmlParserInputBufferPtr ParserInputBufferPtr -xmlParserInputDeallocate ParserInputDeallocate -xmlParserInputPtr ParserInputPtr -xmlParserInputState ParserInputState -xmlParserMode ParserMode -xmlParserNodeInfo ParserNodeInfo -xmlParserNodeInfoPtr ParserNodeInfoPtr -xmlParserNodeInfoSeq ParserNodeInfoSeq -xmlParserNodeInfoSeqPtr ParserNodeInfoSeqPtr -xmlParserNsData ParserNsData -xmlParserOption ParserOption -xmlParserProperties ParserProperties -xmlParserSeverities ParserSeverities -xmlPattern Pattern -xmlPatternFlags PatternFlags -xmlPatternPtr PatternPtr -xmlRMutex RMutex -xmlRMutexPtr RMutexPtr -xmlReaderTypes ReaderTypes -xmlReallocFunc ReallocFunc -xmlRef Ref -xmlRefPtr RefPtr -xmlRefTable RefTable -xmlRefTablePtr RefTablePtr -xmlRegExecCallbacks RegExecCallbacks -xmlRegExecCtxt RegExecCtxt -xmlRegExecCtxtPtr RegExecCtxtPtr -xmlRegexp Regexp -xmlRegexpPtr RegexpPtr -xmlRegisterNodeFunc RegisterNodeFunc -xmlRelaxNG RelaxNG -xmlRelaxNGParserCtxt RelaxNGParserCtxt -xmlRelaxNGParserCtxtPtr RelaxNGParserCtxtPtr -xmlRelaxNGParserFlag RelaxNGParserFlag -xmlRelaxNGPtr RelaxNGPtr -xmlRelaxNGValidCtxt RelaxNGValidCtxt -xmlRelaxNGValidCtxtPtr RelaxNGValidCtxtPtr -xmlRelaxNGValidErr RelaxNGValidErr -xmlRelaxNGValidityErrorFunc RelaxNGValidityErrorFunc -xmlRelaxNGValidityWarningFunc RelaxNGValidityWarningFunc -xmlSAXHandler SAXHandler -xmlSAXHandlerPtr SAXHandlerPtr -xmlSAXHandlerV1 SAXHandlerV1 -xmlSAXHandlerV1Ptr SAXHandlerV1Ptr -xmlSAXLocator SAXLocator -xmlSAXLocatorPtr SAXLocatorPtr -xmlSaveCtxt SaveCtxt -xmlSaveCtxtPtr SaveCtxtPtr -xmlSaveOption SaveOption -xmlSchema Schema -xmlSchemaAnnot SchemaAnnot -xmlSchemaAnnotPtr SchemaAnnotPtr -xmlSchemaAttribute SchemaAttribute -xmlSchemaAttributeGroup SchemaAttributeGroup -xmlSchemaAttributeGroupPtr SchemaAttributeGroupPtr -xmlSchemaAttributeLink SchemaAttributeLink -xmlSchemaAttributeLinkPtr SchemaAttributeLinkPtr -xmlSchemaAttributePtr SchemaAttributePtr -xmlSchemaContentType SchemaContentType -xmlSchemaElement SchemaElement -xmlSchemaElementPtr SchemaElementPtr -xmlSchemaFacet SchemaFacet -xmlSchemaFacetLink SchemaFacetLink -xmlSchemaFacetLinkPtr SchemaFacetLinkPtr -xmlSchemaFacetPtr SchemaFacetPtr -xmlSchemaNotation SchemaNotation -xmlSchemaNotationPtr SchemaNotationPtr -xmlSchemaParserCtxt SchemaParserCtxt -xmlSchemaParserCtxtPtr SchemaParserCtxtPtr -xmlSchemaPtr SchemaPtr -xmlSchemaSAXPlugPtr SchemaSAXPlugPtr -xmlSchemaSAXPlugStruct SchemaSAXPlugStruct -xmlSchemaType SchemaType -xmlSchemaTypeLink SchemaTypeLink -xmlSchemaTypeLinkPtr SchemaTypeLinkPtr -xmlSchemaTypePtr SchemaTypePtr -xmlSchemaTypeType SchemaTypeType -xmlSchemaVal SchemaVal -xmlSchemaValPtr SchemaValPtr -xmlSchemaValType SchemaValType -xmlSchemaValidCtxt SchemaValidCtxt -xmlSchemaValidCtxtPtr SchemaValidCtxtPtr -xmlSchemaValidError SchemaValidError -xmlSchemaValidOption SchemaValidOption -xmlSchemaValidityErrorFunc SchemaValidityErrorFunc -xmlSchemaValidityLocatorFunc SchemaValidityLocatorFunc -xmlSchemaValidityWarningFunc SchemaValidityWarningFunc -xmlSchemaWhitespaceValueType SchemaWhitespaceValueType -xmlSchemaWildcard SchemaWildcard -xmlSchemaWildcardNs SchemaWildcardNs -xmlSchemaWildcardNsPtr SchemaWildcardNsPtr -xmlSchemaWildcardPtr SchemaWildcardPtr -xmlSchematron Schematron -xmlSchematronParserCtxt SchematronParserCtxt -xmlSchematronParserCtxtPtr SchematronParserCtxtPtr -xmlSchematronPtr SchematronPtr -xmlSchematronValidCtxt SchematronValidCtxt -xmlSchematronValidCtxtPtr SchematronValidCtxtPtr -xmlSchematronValidOptions SchematronValidOptions -xmlSchematronValidityErrorFunc SchematronValidityErrorFunc -xmlSchematronValidityWarningFunc SchematronValidityWarningFunc -xmlShellCmd ShellCmd -xmlShellCtxt ShellCtxt -xmlShellCtxtPtr ShellCtxtPtr -xmlShellReadlineFunc ShellReadlineFunc -xmlStartTag StartTag -xmlStrdupFunc StrdupFunc -xmlStreamCtxt StreamCtxt -xmlStreamCtxtPtr StreamCtxtPtr -xmlStructuredErrorFunc StructuredErrorFunc -xmlTextReader TextReader -xmlTextReaderErrorFunc TextReaderErrorFunc -xmlTextReaderLocatorPtr TextReaderLocatorPtr -xmlTextReaderMode TextReaderMode -xmlTextReaderPtr TextReaderPtr -xmlTextWriter TextWriter -xmlTextWriterPtr TextWriterPtr -xmlURI URI -xmlURIPtr URIPtr -xmlValidCtxt ValidCtxt -xmlValidCtxtPtr ValidCtxtPtr -xmlValidState ValidState -xmlValidStatePtr ValidStatePtr -xmlValidityErrorFunc ValidityErrorFunc -xmlValidityWarningFunc ValidityWarningFunc -xmlXIncludeCtxt XIncludeCtxt -xmlXIncludeCtxtPtr XIncludeCtxtPtr -xmlXPathAxis XPathAxis -xmlXPathAxisFunc XPathAxisFunc -xmlXPathAxisPtr XPathAxisPtr -xmlXPathCompExpr XPathCompExpr -xmlXPathCompExprPtr XPathCompExprPtr -xmlXPathContext XPathContext -xmlXPathContextPtr XPathContextPtr -xmlXPathConvertFunc XPathConvertFunc -xmlXPathError XPathError -xmlXPathEvalFunc XPathEvalFunc -xmlXPathFuncLookupFunc XPathFuncLookupFunc -xmlXPathFuncPtr XPathFuncPtr -xmlXPathFunct XPathFunct -xmlXPathFunction XPathFunction -xmlXPathObject XPathObject -xmlXPathObjectPtr XPathObjectPtr -xmlXPathObjectType XPathObjectType -xmlXPathParserContext XPathParserContext -xmlXPathParserContextPtr XPathParserContextPtr -xmlXPathType XPathType -xmlXPathTypePtr XPathTypePtr -xmlXPathVariable XPathVariable -xmlXPathVariableLookupFunc XPathVariableLookupFunc -xmlXPathVariablePtr XPathVariablePtr \ No newline at end of file diff --git a/libxml2/llpkg.cfg b/libxml2/llpkg.cfg deleted file mode 100644 index fdcf05ec..00000000 --- a/libxml2/llpkg.cfg +++ /dev/null @@ -1,14 +0,0 @@ -{ - "upstream": { - "package": { - "name": "libxml2", - "version": "2.13.6" - }, - "installer":{ - "name": "conan", - "config" : { - "options": "iconv=False" - } - } - } -} \ No newline at end of file diff --git a/libxml2/nanoftp.go b/libxml2/nanoftp.go deleted file mode 100644 index d2c96b67..00000000 --- a/libxml2/nanoftp.go +++ /dev/null @@ -1,93 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// llgo:type C -type FtpListCallback func(c.Pointer, *c.Char, *c.Char, *c.Char, *c.Char, c.Ulong, c.Int, c.Int, *c.Char, c.Int, c.Int, c.Int) - -// llgo:type C -type FtpDataCallback func(c.Pointer, *c.Char, c.Int) - -/* - * Init - */ -//go:linkname NanoFTPInit C.xmlNanoFTPInit -func NanoFTPInit() - -//go:linkname NanoFTPCleanup C.xmlNanoFTPCleanup -func NanoFTPCleanup() - -/* - * Creating/freeing contexts. - */ -//go:linkname NanoFTPNewCtxt C.xmlNanoFTPNewCtxt -func NanoFTPNewCtxt(URL *c.Char) c.Pointer - -//go:linkname NanoFTPFreeCtxt C.xmlNanoFTPFreeCtxt -func NanoFTPFreeCtxt(ctx c.Pointer) - -//go:linkname NanoFTPConnectTo C.xmlNanoFTPConnectTo -func NanoFTPConnectTo(server *c.Char, port c.Int) c.Pointer - -/* - * Opening/closing session connections. - */ -//go:linkname NanoFTPOpen C.xmlNanoFTPOpen -func NanoFTPOpen(URL *c.Char) c.Pointer - -//go:linkname NanoFTPConnect C.xmlNanoFTPConnect -func NanoFTPConnect(ctx c.Pointer) c.Int - -//go:linkname NanoFTPClose C.xmlNanoFTPClose -func NanoFTPClose(ctx c.Pointer) c.Int - -//go:linkname NanoFTPQuit C.xmlNanoFTPQuit -func NanoFTPQuit(ctx c.Pointer) c.Int - -//go:linkname NanoFTPScanProxy C.xmlNanoFTPScanProxy -func NanoFTPScanProxy(URL *c.Char) - -//go:linkname NanoFTPProxy C.xmlNanoFTPProxy -func NanoFTPProxy(host *c.Char, port c.Int, user *c.Char, passwd *c.Char, type_ c.Int) - -//go:linkname NanoFTPUpdateURL C.xmlNanoFTPUpdateURL -func NanoFTPUpdateURL(ctx c.Pointer, URL *c.Char) c.Int - -/* - * Rather internal commands. - */ -//go:linkname NanoFTPGetResponse C.xmlNanoFTPGetResponse -func NanoFTPGetResponse(ctx c.Pointer) c.Int - -//go:linkname NanoFTPCheckResponse C.xmlNanoFTPCheckResponse -func NanoFTPCheckResponse(ctx c.Pointer) c.Int - -/* - * CD/DIR/GET handlers. - */ -//go:linkname NanoFTPCwd C.xmlNanoFTPCwd -func NanoFTPCwd(ctx c.Pointer, directory *c.Char) c.Int - -//go:linkname NanoFTPDele C.xmlNanoFTPDele -func NanoFTPDele(ctx c.Pointer, file *c.Char) c.Int - -//go:linkname NanoFTPGetConnection C.xmlNanoFTPGetConnection -func NanoFTPGetConnection(ctx c.Pointer) c.Int - -//go:linkname NanoFTPCloseConnection C.xmlNanoFTPCloseConnection -func NanoFTPCloseConnection(ctx c.Pointer) c.Int - -//go:linkname NanoFTPList C.xmlNanoFTPList -func NanoFTPList(ctx c.Pointer, callback FtpListCallback, userData c.Pointer, filename *c.Char) c.Int - -//go:linkname NanoFTPGetSocket C.xmlNanoFTPGetSocket -func NanoFTPGetSocket(ctx c.Pointer, filename *c.Char) c.Int - -//go:linkname NanoFTPGet C.xmlNanoFTPGet -func NanoFTPGet(ctx c.Pointer, callback FtpDataCallback, userData c.Pointer, filename *c.Char) c.Int - -//go:linkname NanoFTPRead C.xmlNanoFTPRead -func NanoFTPRead(ctx c.Pointer, dest c.Pointer, len c.Int) c.Int diff --git a/libxml2/nanohttp.go b/libxml2/nanohttp.go deleted file mode 100644 index c59570c1..00000000 --- a/libxml2/nanohttp.go +++ /dev/null @@ -1,57 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname NanoHTTPInit C.xmlNanoHTTPInit -func NanoHTTPInit() - -//go:linkname NanoHTTPCleanup C.xmlNanoHTTPCleanup -func NanoHTTPCleanup() - -//go:linkname NanoHTTPScanProxy C.xmlNanoHTTPScanProxy -func NanoHTTPScanProxy(URL *c.Char) - -//go:linkname NanoHTTPFetch C.xmlNanoHTTPFetch -func NanoHTTPFetch(URL *c.Char, filename *c.Char, contentType **c.Char) c.Int - -//go:linkname NanoHTTPMethod C.xmlNanoHTTPMethod -func NanoHTTPMethod(URL *c.Char, method *c.Char, input *c.Char, contentType **c.Char, headers *c.Char, ilen c.Int) c.Pointer - -//go:linkname NanoHTTPMethodRedir C.xmlNanoHTTPMethodRedir -func NanoHTTPMethodRedir(URL *c.Char, method *c.Char, input *c.Char, contentType **c.Char, redir **c.Char, headers *c.Char, ilen c.Int) c.Pointer - -//go:linkname NanoHTTPOpen C.xmlNanoHTTPOpen -func NanoHTTPOpen(URL *c.Char, contentType **c.Char) c.Pointer - -//go:linkname NanoHTTPOpenRedir C.xmlNanoHTTPOpenRedir -func NanoHTTPOpenRedir(URL *c.Char, contentType **c.Char, redir **c.Char) c.Pointer - -//go:linkname NanoHTTPReturnCode C.xmlNanoHTTPReturnCode -func NanoHTTPReturnCode(ctx c.Pointer) c.Int - -//go:linkname NanoHTTPAuthHeader C.xmlNanoHTTPAuthHeader -func NanoHTTPAuthHeader(ctx c.Pointer) *c.Char - -//go:linkname NanoHTTPRedir C.xmlNanoHTTPRedir -func NanoHTTPRedir(ctx c.Pointer) *c.Char - -//go:linkname NanoHTTPContentLength C.xmlNanoHTTPContentLength -func NanoHTTPContentLength(ctx c.Pointer) c.Int - -//go:linkname NanoHTTPEncoding C.xmlNanoHTTPEncoding -func NanoHTTPEncoding(ctx c.Pointer) *c.Char - -//go:linkname NanoHTTPMimeType C.xmlNanoHTTPMimeType -func NanoHTTPMimeType(ctx c.Pointer) *c.Char - -//go:linkname NanoHTTPRead C.xmlNanoHTTPRead -func NanoHTTPRead(ctx c.Pointer, dest c.Pointer, len c.Int) c.Int - -//go:linkname NanoHTTPSave C.xmlNanoHTTPSave -func NanoHTTPSave(ctxt c.Pointer, filename *c.Char) c.Int - -//go:linkname NanoHTTPClose C.xmlNanoHTTPClose -func NanoHTTPClose(ctx c.Pointer) diff --git a/libxml2/parser.go b/libxml2/parser.go deleted file mode 100644 index 91cb9e98..00000000 --- a/libxml2/parser.go +++ /dev/null @@ -1,627 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const DEFAULT_VERSION = "1.0" -const DETECT_IDS = 2 -const COMPLETE_ATTRS = 4 -const SKIP_IDS = 8 -const SAX2_MAGIC = 0xDEEDBEAF - -// llgo:type C -type ParserInputDeallocate func(*Char) - -type X_xmlParserNodeInfo struct { - Node *X_xmlNode - BeginPos c.Ulong - BeginLine c.Ulong - EndPos c.Ulong - EndLine c.Ulong -} -type ParserNodeInfo X_xmlParserNodeInfo -type ParserNodeInfoPtr *ParserNodeInfo - -type X_xmlParserNodeInfoSeq struct { - Maximum c.Ulong - Length c.Ulong - Buffer *ParserNodeInfo -} -type ParserNodeInfoSeq X_xmlParserNodeInfoSeq -type ParserNodeInfoSeqPtr *ParserNodeInfoSeq -type ParserInputState c.Int - -const ( - PARSER_EOF ParserInputState = -1 - PARSER_START ParserInputState = 0 - PARSER_MISC ParserInputState = 1 - PARSER_PI ParserInputState = 2 - PARSER_DTD ParserInputState = 3 - PARSER_PROLOG ParserInputState = 4 - PARSER_COMMENT ParserInputState = 5 - PARSER_START_TAG ParserInputState = 6 - PARSER_CONTENT ParserInputState = 7 - PARSER_CDATA_SECTION ParserInputState = 8 - PARSER_END_TAG ParserInputState = 9 - PARSER_ENTITY_DECL ParserInputState = 10 - PARSER_ENTITY_VALUE ParserInputState = 11 - PARSER_ATTRIBUTE_VALUE ParserInputState = 12 - PARSER_SYSTEM_LITERAL ParserInputState = 13 - PARSER_EPILOG ParserInputState = 14 - PARSER_IGNORE ParserInputState = 15 - PARSER_PUBLIC_LITERAL ParserInputState = 16 - PARSER_XML_DECL ParserInputState = 17 -) - -type ParserMode c.Int - -const ( - PARSE_UNKNOWN ParserMode = 0 - PARSE_DOM ParserMode = 1 - PARSE_SAX ParserMode = 2 - PARSE_PUSH_DOM ParserMode = 3 - PARSE_PUSH_SAX ParserMode = 4 - PARSE_READER ParserMode = 5 -) - -type X_xmlStartTag struct { - Unused [8]uint8 -} -type StartTag X_xmlStartTag - -type X_xmlParserNsData struct { - Unused [8]uint8 -} -type ParserNsData X_xmlParserNsData - -type X_xmlAttrHashBucket struct { - Unused [8]uint8 -} -type AttrHashBucket X_xmlAttrHashBucket - -// llgo:type C -type ResolveEntitySAXFunc func(c.Pointer, *Char, *Char) ParserInputPtr - -// llgo:type C -type InternalSubsetSAXFunc func(c.Pointer, *Char, *Char, *Char) - -// llgo:type C -type ExternalSubsetSAXFunc func(c.Pointer, *Char, *Char, *Char) - -// llgo:type C -type GetEntitySAXFunc func(c.Pointer, *Char) EntityPtr - -// llgo:type C -type GetParameterEntitySAXFunc func(c.Pointer, *Char) EntityPtr - -// llgo:type C -type EntityDeclSAXFunc func(c.Pointer, *Char, c.Int, *Char, *Char, *Char) - -// llgo:type C -type NotationDeclSAXFunc func(c.Pointer, *Char, *Char, *Char) - -// llgo:type C -type AttributeDeclSAXFunc func(c.Pointer, *Char, *Char, c.Int, c.Int, *Char, EnumerationPtr) - -// llgo:type C -type ElementDeclSAXFunc func(c.Pointer, *Char, c.Int, ElementContentPtr) - -// llgo:type C -type UnparsedEntityDeclSAXFunc func(c.Pointer, *Char, *Char, *Char, *Char) - -// llgo:type C -type SetDocumentLocatorSAXFunc func(c.Pointer, SAXLocatorPtr) - -// llgo:type C -type StartDocumentSAXFunc func(c.Pointer) - -// llgo:type C -type EndDocumentSAXFunc func(c.Pointer) - -// llgo:type C -type StartElementSAXFunc func(c.Pointer, *Char, **Char) - -// llgo:type C -type EndElementSAXFunc func(c.Pointer, *Char) - -// llgo:type C -type AttributeSAXFunc func(c.Pointer, *Char, *Char) - -// llgo:type C -type ReferenceSAXFunc func(c.Pointer, *Char) - -// llgo:type C -type CharactersSAXFunc func(c.Pointer, *Char, c.Int) - -// llgo:type C -type IgnorableWhitespaceSAXFunc func(c.Pointer, *Char, c.Int) - -// llgo:type C -type ProcessingInstructionSAXFunc func(c.Pointer, *Char, *Char) - -// llgo:type C -type CommentSAXFunc func(c.Pointer, *Char) - -// llgo:type C -type CdataBlockSAXFunc func(c.Pointer, *Char, c.Int) - -// llgo:type C -type WarningSAXFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type ErrorSAXFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type FatalErrorSAXFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type IsStandaloneSAXFunc func(c.Pointer) c.Int - -// llgo:type C -type HasInternalSubsetSAXFunc func(c.Pointer) c.Int - -// llgo:type C -type HasExternalSubsetSAXFunc func(c.Pointer) c.Int - -// llgo:type C -type StartElementNsSAX2Func func(c.Pointer, *Char, *Char, *Char, c.Int, **Char, c.Int, c.Int, **Char) - -// llgo:type C -type EndElementNsSAX2Func func(c.Pointer, *Char, *Char, *Char) - -type X_xmlSAXHandlerV1 struct { - InternalSubset InternalSubsetSAXFunc - IsStandalone IsStandaloneSAXFunc - HasInternalSubset HasInternalSubsetSAXFunc - HasExternalSubset HasExternalSubsetSAXFunc - ResolveEntity ResolveEntitySAXFunc - GetEntity GetEntitySAXFunc - EntityDecl EntityDeclSAXFunc - NotationDecl NotationDeclSAXFunc - AttributeDecl AttributeDeclSAXFunc - ElementDecl ElementDeclSAXFunc - UnparsedEntityDecl UnparsedEntityDeclSAXFunc - SetDocumentLocator SetDocumentLocatorSAXFunc - StartDocument StartDocumentSAXFunc - EndDocument EndDocumentSAXFunc - StartElement StartElementSAXFunc - EndElement EndElementSAXFunc - Reference ReferenceSAXFunc - Characters CharactersSAXFunc - IgnorableWhitespace IgnorableWhitespaceSAXFunc - ProcessingInstruction ProcessingInstructionSAXFunc - Comment CommentSAXFunc - Warning WarningSAXFunc - Error ErrorSAXFunc - FatalError FatalErrorSAXFunc - GetParameterEntity GetParameterEntitySAXFunc - CdataBlock CdataBlockSAXFunc - ExternalSubset ExternalSubsetSAXFunc - Initialized c.Uint -} -type SAXHandlerV1 X_xmlSAXHandlerV1 -type SAXHandlerV1Ptr *SAXHandlerV1 - -// llgo:type C -type ExternalEntityLoader func(*c.Char, *c.Char, ParserCtxtPtr) ParserInputPtr - -/* backward compatibility */ -//go:linkname X__xmlParserVersion C.__xmlParserVersion -func X__xmlParserVersion() **c.Char - -//go:linkname X__oldXMLWDcompatibility C.__oldXMLWDcompatibility -func X__oldXMLWDcompatibility() *c.Int - -//go:linkname X__xmlParserDebugEntities C.__xmlParserDebugEntities -func X__xmlParserDebugEntities() *c.Int - -//go:linkname X__xmlDefaultSAXLocator C.__xmlDefaultSAXLocator -func X__xmlDefaultSAXLocator() *SAXLocator - -//go:linkname X__xmlDefaultSAXHandler C.__xmlDefaultSAXHandler -func X__xmlDefaultSAXHandler() *SAXHandlerV1 - -//go:linkname X__xmlDoValidityCheckingDefaultValue C.__xmlDoValidityCheckingDefaultValue -func X__xmlDoValidityCheckingDefaultValue() *c.Int - -//go:linkname X__xmlGetWarningsDefaultValue C.__xmlGetWarningsDefaultValue -func X__xmlGetWarningsDefaultValue() *c.Int - -//go:linkname X__xmlKeepBlanksDefaultValue C.__xmlKeepBlanksDefaultValue -func X__xmlKeepBlanksDefaultValue() *c.Int - -//go:linkname X__xmlLineNumbersDefaultValue C.__xmlLineNumbersDefaultValue -func X__xmlLineNumbersDefaultValue() *c.Int - -//go:linkname X__xmlLoadExtDtdDefaultValue C.__xmlLoadExtDtdDefaultValue -func X__xmlLoadExtDtdDefaultValue() *c.Int - -//go:linkname X__xmlPedanticParserDefaultValue C.__xmlPedanticParserDefaultValue -func X__xmlPedanticParserDefaultValue() *c.Int - -//go:linkname X__xmlSubstituteEntitiesDefaultValue C.__xmlSubstituteEntitiesDefaultValue -func X__xmlSubstituteEntitiesDefaultValue() *c.Int - -//go:linkname X__xmlIndentTreeOutput C.__xmlIndentTreeOutput -func X__xmlIndentTreeOutput() *c.Int - -//go:linkname X__xmlTreeIndentString C.__xmlTreeIndentString -func X__xmlTreeIndentString() **c.Char - -//go:linkname X__xmlSaveNoEmptyTags C.__xmlSaveNoEmptyTags -func X__xmlSaveNoEmptyTags() *c.Int - -/* - * Init/Cleanup - */ -//go:linkname InitParser C.xmlInitParser -func InitParser() - -//go:linkname CleanupParser C.xmlCleanupParser -func CleanupParser() - -//go:linkname InitGlobals C.xmlInitGlobals -func InitGlobals() - -//go:linkname CleanupGlobals C.xmlCleanupGlobals -func CleanupGlobals() - -/* - * Input functions - */ -//go:linkname ParserInputRead C.xmlParserInputRead -func ParserInputRead(in ParserInputPtr, len c.Int) c.Int - -//go:linkname ParserInputGrow C.xmlParserInputGrow -func ParserInputGrow(in ParserInputPtr, len c.Int) c.Int - -/* - * Basic parsing Interfaces - */ -// llgo:link (*Char).ParseDoc C.xmlParseDoc -func (recv_ *Char) ParseDoc() DocPtr { - return nil -} - -//go:linkname ParseFile C.xmlParseFile -func ParseFile(filename *c.Char) DocPtr - -//go:linkname ParseMemory C.xmlParseMemory -func ParseMemory(buffer *c.Char, size c.Int) DocPtr - -//go:linkname SubstituteEntitiesDefault C.xmlSubstituteEntitiesDefault -func SubstituteEntitiesDefault(val c.Int) c.Int - -//go:linkname ThrDefSubstituteEntitiesDefaultValue C.xmlThrDefSubstituteEntitiesDefaultValue -func ThrDefSubstituteEntitiesDefaultValue(v c.Int) c.Int - -//go:linkname KeepBlanksDefault C.xmlKeepBlanksDefault -func KeepBlanksDefault(val c.Int) c.Int - -//go:linkname ThrDefKeepBlanksDefaultValue C.xmlThrDefKeepBlanksDefaultValue -func ThrDefKeepBlanksDefaultValue(v c.Int) c.Int - -//go:linkname StopParser C.xmlStopParser -func StopParser(ctxt ParserCtxtPtr) - -//go:linkname PedanticParserDefault C.xmlPedanticParserDefault -func PedanticParserDefault(val c.Int) c.Int - -//go:linkname ThrDefPedanticParserDefaultValue C.xmlThrDefPedanticParserDefaultValue -func ThrDefPedanticParserDefaultValue(v c.Int) c.Int - -//go:linkname LineNumbersDefault C.xmlLineNumbersDefault -func LineNumbersDefault(val c.Int) c.Int - -//go:linkname ThrDefLineNumbersDefaultValue C.xmlThrDefLineNumbersDefaultValue -func ThrDefLineNumbersDefaultValue(v c.Int) c.Int - -//go:linkname ThrDefDoValidityCheckingDefaultValue C.xmlThrDefDoValidityCheckingDefaultValue -func ThrDefDoValidityCheckingDefaultValue(v c.Int) c.Int - -//go:linkname ThrDefGetWarningsDefaultValue C.xmlThrDefGetWarningsDefaultValue -func ThrDefGetWarningsDefaultValue(v c.Int) c.Int - -//go:linkname ThrDefLoadExtDtdDefaultValue C.xmlThrDefLoadExtDtdDefaultValue -func ThrDefLoadExtDtdDefaultValue(v c.Int) c.Int - -//go:linkname ThrDefParserDebugEntities C.xmlThrDefParserDebugEntities -func ThrDefParserDebugEntities(v c.Int) c.Int - -/* - * Recovery mode - */ -// llgo:link (*Char).RecoverDoc C.xmlRecoverDoc -func (recv_ *Char) RecoverDoc() DocPtr { - return nil -} - -//go:linkname RecoverMemory C.xmlRecoverMemory -func RecoverMemory(buffer *c.Char, size c.Int) DocPtr - -//go:linkname RecoverFile C.xmlRecoverFile -func RecoverFile(filename *c.Char) DocPtr - -/* - * Less common routines and SAX interfaces - */ -//go:linkname ParseDocument C.xmlParseDocument -func ParseDocument(ctxt ParserCtxtPtr) c.Int - -//go:linkname ParseExtParsedEnt C.xmlParseExtParsedEnt -func ParseExtParsedEnt(ctxt ParserCtxtPtr) c.Int - -//go:linkname SAXUserParseFile C.xmlSAXUserParseFile -func SAXUserParseFile(sax SAXHandlerPtr, user_data c.Pointer, filename *c.Char) c.Int - -//go:linkname SAXUserParseMemory C.xmlSAXUserParseMemory -func SAXUserParseMemory(sax SAXHandlerPtr, user_data c.Pointer, buffer *c.Char, size c.Int) c.Int - -//go:linkname SAXParseDoc C.xmlSAXParseDoc -func SAXParseDoc(sax SAXHandlerPtr, cur *Char, recovery c.Int) DocPtr - -//go:linkname SAXParseMemory C.xmlSAXParseMemory -func SAXParseMemory(sax SAXHandlerPtr, buffer *c.Char, size c.Int, recovery c.Int) DocPtr - -//go:linkname SAXParseMemoryWithData C.xmlSAXParseMemoryWithData -func SAXParseMemoryWithData(sax SAXHandlerPtr, buffer *c.Char, size c.Int, recovery c.Int, data c.Pointer) DocPtr - -//go:linkname SAXParseFile C.xmlSAXParseFile -func SAXParseFile(sax SAXHandlerPtr, filename *c.Char, recovery c.Int) DocPtr - -//go:linkname SAXParseFileWithData C.xmlSAXParseFileWithData -func SAXParseFileWithData(sax SAXHandlerPtr, filename *c.Char, recovery c.Int, data c.Pointer) DocPtr - -//go:linkname SAXParseEntity C.xmlSAXParseEntity -func SAXParseEntity(sax SAXHandlerPtr, filename *c.Char) DocPtr - -//go:linkname ParseEntity C.xmlParseEntity -func ParseEntity(filename *c.Char) DocPtr - -//go:linkname SAXParseDTD C.xmlSAXParseDTD -func SAXParseDTD(sax SAXHandlerPtr, ExternalID *Char, SystemID *Char) DtdPtr - -// llgo:link (*Char).ParseDTD C.xmlParseDTD -func (recv_ *Char) ParseDTD(SystemID *Char) DtdPtr { - return nil -} - -//go:linkname IOParseDTD C.xmlIOParseDTD -func IOParseDTD(sax SAXHandlerPtr, input ParserInputBufferPtr, enc CharEncoding) DtdPtr - -//go:linkname ParseBalancedChunkMemory C.xmlParseBalancedChunkMemory -func ParseBalancedChunkMemory(doc DocPtr, sax SAXHandlerPtr, user_data c.Pointer, depth c.Int, string *Char, lst *NodePtr) c.Int - -//go:linkname ParseInNodeContext C.xmlParseInNodeContext -func ParseInNodeContext(node NodePtr, data *c.Char, datalen c.Int, options c.Int, lst *NodePtr) ParserErrors - -//go:linkname ParseBalancedChunkMemoryRecover C.xmlParseBalancedChunkMemoryRecover -func ParseBalancedChunkMemoryRecover(doc DocPtr, sax SAXHandlerPtr, user_data c.Pointer, depth c.Int, string *Char, lst *NodePtr, recover c.Int) c.Int - -//go:linkname ParseExternalEntity C.xmlParseExternalEntity -func ParseExternalEntity(doc DocPtr, sax SAXHandlerPtr, user_data c.Pointer, depth c.Int, URL *Char, ID *Char, lst *NodePtr) c.Int - -//go:linkname ParseCtxtExternalEntity C.xmlParseCtxtExternalEntity -func ParseCtxtExternalEntity(ctx ParserCtxtPtr, URL *Char, ID *Char, lst *NodePtr) c.Int - -/* - * Parser contexts handling. - */ -//go:linkname NewParserCtxt C.xmlNewParserCtxt -func NewParserCtxt() ParserCtxtPtr - -// llgo:link (*SAXHandler).NewSAXParserCtxt C.xmlNewSAXParserCtxt -func (recv_ *SAXHandler) NewSAXParserCtxt(userData c.Pointer) ParserCtxtPtr { - return nil -} - -//go:linkname InitParserCtxt C.xmlInitParserCtxt -func InitParserCtxt(ctxt ParserCtxtPtr) c.Int - -//go:linkname ClearParserCtxt C.xmlClearParserCtxt -func ClearParserCtxt(ctxt ParserCtxtPtr) - -//go:linkname FreeParserCtxt C.xmlFreeParserCtxt -func FreeParserCtxt(ctxt ParserCtxtPtr) - -//go:linkname SetupParserForBuffer C.xmlSetupParserForBuffer -func SetupParserForBuffer(ctxt ParserCtxtPtr, buffer *Char, filename *c.Char) - -// llgo:link (*Char).CreateDocParserCtxt C.xmlCreateDocParserCtxt -func (recv_ *Char) CreateDocParserCtxt() ParserCtxtPtr { - return nil -} - -/* - * Reading/setting optional parsing features. - */ -//go:linkname GetFeaturesList C.xmlGetFeaturesList -func GetFeaturesList(len *c.Int, result **c.Char) c.Int - -//go:linkname GetFeature C.xmlGetFeature -func GetFeature(ctxt ParserCtxtPtr, name *c.Char, result c.Pointer) c.Int - -//go:linkname SetFeature C.xmlSetFeature -func SetFeature(ctxt ParserCtxtPtr, name *c.Char, value c.Pointer) c.Int - -/* - * Interfaces for the Push mode. - */ -//go:linkname CreatePushParserCtxt C.xmlCreatePushParserCtxt -func CreatePushParserCtxt(sax SAXHandlerPtr, user_data c.Pointer, chunk *c.Char, size c.Int, filename *c.Char) ParserCtxtPtr - -//go:linkname ParseChunk C.xmlParseChunk -func ParseChunk(ctxt ParserCtxtPtr, chunk *c.Char, size c.Int, terminate c.Int) c.Int - -/* - * Special I/O mode. - */ -//go:linkname CreateIOParserCtxt C.xmlCreateIOParserCtxt -func CreateIOParserCtxt(sax SAXHandlerPtr, user_data c.Pointer, ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, enc CharEncoding) ParserCtxtPtr - -//go:linkname NewIOInputStream C.xmlNewIOInputStream -func NewIOInputStream(ctxt ParserCtxtPtr, input ParserInputBufferPtr, enc CharEncoding) ParserInputPtr - -/* - * Node infos. - */ -//go:linkname ParserFindNodeInfo C.xmlParserFindNodeInfo -func ParserFindNodeInfo(ctxt ParserCtxtPtr, node NodePtr) *ParserNodeInfo - -//go:linkname InitNodeInfoSeq C.xmlInitNodeInfoSeq -func InitNodeInfoSeq(seq ParserNodeInfoSeqPtr) - -//go:linkname ClearNodeInfoSeq C.xmlClearNodeInfoSeq -func ClearNodeInfoSeq(seq ParserNodeInfoSeqPtr) - -//go:linkname ParserFindNodeInfoIndex C.xmlParserFindNodeInfoIndex -func ParserFindNodeInfoIndex(seq ParserNodeInfoSeqPtr, node NodePtr) c.Ulong - -//go:linkname ParserAddNodeInfo C.xmlParserAddNodeInfo -func ParserAddNodeInfo(ctxt ParserCtxtPtr, info ParserNodeInfoPtr) - -/* - * External entities handling actually implemented in xmlIO. - */ -//go:linkname SetExternalEntityLoader C.xmlSetExternalEntityLoader -func SetExternalEntityLoader(f ExternalEntityLoader) - -//go:linkname GetExternalEntityLoader C.xmlGetExternalEntityLoader -func GetExternalEntityLoader() ExternalEntityLoader - -//go:linkname LoadExternalEntity C.xmlLoadExternalEntity -func LoadExternalEntity(URL *c.Char, ID *c.Char, ctxt ParserCtxtPtr) ParserInputPtr - -/* - * Index lookup, actually implemented in the encoding module - */ -//go:linkname ByteConsumed C.xmlByteConsumed -func ByteConsumed(ctxt ParserCtxtPtr) c.Long - -type ParserOption c.Int - -const ( - PARSE_RECOVER ParserOption = 1 - PARSE_NOENT ParserOption = 2 - PARSE_DTDLOAD ParserOption = 4 - PARSE_DTDATTR ParserOption = 8 - PARSE_DTDVALID ParserOption = 16 - PARSE_NOERROR ParserOption = 32 - PARSE_NOWARNING ParserOption = 64 - PARSE_PEDANTIC ParserOption = 128 - PARSE_NOBLANKS ParserOption = 256 - PARSE_SAX1 ParserOption = 512 - PARSE_XINCLUDE ParserOption = 1024 - PARSE_NONET ParserOption = 2048 - PARSE_NODICT ParserOption = 4096 - PARSE_NSCLEAN ParserOption = 8192 - PARSE_NOCDATA ParserOption = 16384 - PARSE_NOXINCNODE ParserOption = 32768 - PARSE_COMPACT ParserOption = 65536 - PARSE_OLD10 ParserOption = 131072 - PARSE_NOBASEFIX ParserOption = 262144 - PARSE_HUGE ParserOption = 524288 - PARSE_OLDSAX ParserOption = 1048576 - PARSE_IGNORE_ENC ParserOption = 2097152 - PARSE_BIG_LINES ParserOption = 4194304 - PARSE_NO_XXE ParserOption = 8388608 -) - -//go:linkname CtxtReset C.xmlCtxtReset -func CtxtReset(ctxt ParserCtxtPtr) - -//go:linkname CtxtResetPush C.xmlCtxtResetPush -func CtxtResetPush(ctxt ParserCtxtPtr, chunk *c.Char, size c.Int, filename *c.Char, encoding *c.Char) c.Int - -//go:linkname CtxtSetOptions C.xmlCtxtSetOptions -func CtxtSetOptions(ctxt ParserCtxtPtr, options c.Int) c.Int - -//go:linkname CtxtUseOptions C.xmlCtxtUseOptions -func CtxtUseOptions(ctxt ParserCtxtPtr, options c.Int) c.Int - -//go:linkname CtxtSetErrorHandler C.xmlCtxtSetErrorHandler -func CtxtSetErrorHandler(ctxt ParserCtxtPtr, handler StructuredErrorFunc, data c.Pointer) - -//go:linkname CtxtSetMaxAmplification C.xmlCtxtSetMaxAmplification -func CtxtSetMaxAmplification(ctxt ParserCtxtPtr, maxAmpl c.Uint) - -// llgo:link (*Char).ReadDoc C.xmlReadDoc -func (recv_ *Char) ReadDoc(URL *c.Char, encoding *c.Char, options c.Int) DocPtr { - return nil -} - -//go:linkname ReadFile C.xmlReadFile -func ReadFile(URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname ReadMemory C.xmlReadMemory -func ReadMemory(buffer *c.Char, size c.Int, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname ReadFd C.xmlReadFd -func ReadFd(fd c.Int, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname ReadIO C.xmlReadIO -func ReadIO(ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname CtxtParseDocument C.xmlCtxtParseDocument -func CtxtParseDocument(ctxt ParserCtxtPtr, input ParserInputPtr) DocPtr - -//go:linkname CtxtReadDoc C.xmlCtxtReadDoc -func CtxtReadDoc(ctxt ParserCtxtPtr, cur *Char, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname CtxtReadFile C.xmlCtxtReadFile -func CtxtReadFile(ctxt ParserCtxtPtr, filename *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname CtxtReadMemory C.xmlCtxtReadMemory -func CtxtReadMemory(ctxt ParserCtxtPtr, buffer *c.Char, size c.Int, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname CtxtReadFd C.xmlCtxtReadFd -func CtxtReadFd(ctxt ParserCtxtPtr, fd c.Int, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -//go:linkname CtxtReadIO C.xmlCtxtReadIO -func CtxtReadIO(ctxt ParserCtxtPtr, ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, URL *c.Char, encoding *c.Char, options c.Int) DocPtr - -type Feature c.Int - -const ( - WITH_THREAD Feature = 1 - WITH_TREE Feature = 2 - WITH_OUTPUT Feature = 3 - WITH_PUSH Feature = 4 - WITH_READER Feature = 5 - WITH_PATTERN Feature = 6 - WITH_WRITER Feature = 7 - WITH_SAX1 Feature = 8 - WITH_FTP Feature = 9 - WITH_HTTP Feature = 10 - WITH_VALID Feature = 11 - WITH_HTML Feature = 12 - WITH_LEGACY Feature = 13 - WITH_C14N Feature = 14 - WITH_CATALOG Feature = 15 - WITH_XPATH Feature = 16 - WITH_XPTR Feature = 17 - WITH_XINCLUDE Feature = 18 - WITH_ICONV Feature = 19 - WITH_ISO8859X Feature = 20 - WITH_UNICODE Feature = 21 - WITH_REGEXP Feature = 22 - WITH_AUTOMATA Feature = 23 - WITH_EXPR Feature = 24 - WITH_SCHEMAS Feature = 25 - WITH_SCHEMATRON Feature = 26 - WITH_MODULES Feature = 27 - WITH_DEBUG Feature = 28 - WITH_DEBUG_MEM Feature = 29 - WITH_DEBUG_RUN Feature = 30 - WITH_ZLIB Feature = 31 - WITH_ICU Feature = 32 - WITH_LZMA Feature = 33 - WITH_NONE Feature = 99999 -) - -// llgo:link Feature.HasFeature C.xmlHasFeature -func (recv_ Feature) HasFeature() c.Int { - return 0 -} diff --git a/libxml2/parserInternals.go b/libxml2/parserInternals.go deleted file mode 100644 index fa0d184b..00000000 --- a/libxml2/parserInternals.go +++ /dev/null @@ -1,321 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const MAX_TEXT_LENGTH = 10000000 -const MAX_HUGE_LENGTH = 1000000000 -const MAX_NAME_LENGTH = 50000 -const MAX_DICTIONARY_LIMIT = 10000000 -const MAX_LOOKUP_LIMIT = 10000000 -const MAX_NAMELEN = 100 -const INPUT_CHUNK = 250 -const SUBSTITUTE_NONE = 0 -const SUBSTITUTE_REF = 1 -const SUBSTITUTE_PEREF = 2 -const SUBSTITUTE_BOTH = 3 - -/* - * Function to finish the work of the macros where needed. - */ -//go:linkname IsLetter C.xmlIsLetter -func IsLetter(c c.Int) c.Int - -/** - * Parser context. - */ -//go:linkname CreateFileParserCtxt C.xmlCreateFileParserCtxt -func CreateFileParserCtxt(filename *c.Char) ParserCtxtPtr - -//go:linkname CreateURLParserCtxt C.xmlCreateURLParserCtxt -func CreateURLParserCtxt(filename *c.Char, options c.Int) ParserCtxtPtr - -//go:linkname CreateMemoryParserCtxt C.xmlCreateMemoryParserCtxt -func CreateMemoryParserCtxt(buffer *c.Char, size c.Int) ParserCtxtPtr - -// llgo:link (*Char).CreateEntityParserCtxt C.xmlCreateEntityParserCtxt -func (recv_ *Char) CreateEntityParserCtxt(ID *Char, base *Char) ParserCtxtPtr { - return nil -} - -//go:linkname CtxtErrMemory C.xmlCtxtErrMemory -func CtxtErrMemory(ctxt ParserCtxtPtr) - -//go:linkname SwitchEncoding C.xmlSwitchEncoding -func SwitchEncoding(ctxt ParserCtxtPtr, enc CharEncoding) c.Int - -//go:linkname SwitchEncodingName C.xmlSwitchEncodingName -func SwitchEncodingName(ctxt ParserCtxtPtr, encoding *c.Char) c.Int - -//go:linkname SwitchToEncoding C.xmlSwitchToEncoding -func SwitchToEncoding(ctxt ParserCtxtPtr, handler CharEncodingHandlerPtr) c.Int - -//go:linkname SwitchInputEncoding C.xmlSwitchInputEncoding -func SwitchInputEncoding(ctxt ParserCtxtPtr, input ParserInputPtr, handler CharEncodingHandlerPtr) c.Int - -/** - * Input Streams. - */ -//go:linkname NewStringInputStream C.xmlNewStringInputStream -func NewStringInputStream(ctxt ParserCtxtPtr, buffer *Char) ParserInputPtr - -//go:linkname NewEntityInputStream C.xmlNewEntityInputStream -func NewEntityInputStream(ctxt ParserCtxtPtr, entity EntityPtr) ParserInputPtr - -//go:linkname PushInput C.xmlPushInput -func PushInput(ctxt ParserCtxtPtr, input ParserInputPtr) c.Int - -//go:linkname PopInput C.xmlPopInput -func PopInput(ctxt ParserCtxtPtr) Char - -//go:linkname FreeInputStream C.xmlFreeInputStream -func FreeInputStream(input ParserInputPtr) - -//go:linkname NewInputFromFile C.xmlNewInputFromFile -func NewInputFromFile(ctxt ParserCtxtPtr, filename *c.Char) ParserInputPtr - -//go:linkname NewInputStream C.xmlNewInputStream -func NewInputStream(ctxt ParserCtxtPtr) ParserInputPtr - -/** - * Namespaces. - */ -//go:linkname SplitQName C.xmlSplitQName -func SplitQName(ctxt ParserCtxtPtr, name *Char, prefix **Char) *Char - -/** - * Generic production rules. - */ -//go:linkname ParseName C.xmlParseName -func ParseName(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseNmtoken C.xmlParseNmtoken -func ParseNmtoken(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseEntityValue C.xmlParseEntityValue -func ParseEntityValue(ctxt ParserCtxtPtr, orig **Char) *Char - -//go:linkname ParseAttValue C.xmlParseAttValue -func ParseAttValue(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseSystemLiteral C.xmlParseSystemLiteral -func ParseSystemLiteral(ctxt ParserCtxtPtr) *Char - -//go:linkname ParsePubidLiteral C.xmlParsePubidLiteral -func ParsePubidLiteral(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseCharData C.xmlParseCharData -func ParseCharData(ctxt ParserCtxtPtr, cdata c.Int) - -//go:linkname ParseExternalID C.xmlParseExternalID -func ParseExternalID(ctxt ParserCtxtPtr, publicID **Char, strict c.Int) *Char - -//go:linkname ParseComment C.xmlParseComment -func ParseComment(ctxt ParserCtxtPtr) - -//go:linkname ParsePITarget C.xmlParsePITarget -func ParsePITarget(ctxt ParserCtxtPtr) *Char - -//go:linkname ParsePI C.xmlParsePI -func ParsePI(ctxt ParserCtxtPtr) - -//go:linkname ParseNotationDecl C.xmlParseNotationDecl -func ParseNotationDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseEntityDecl C.xmlParseEntityDecl -func ParseEntityDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseDefaultDecl C.xmlParseDefaultDecl -func ParseDefaultDecl(ctxt ParserCtxtPtr, value **Char) c.Int - -//go:linkname ParseNotationType C.xmlParseNotationType -func ParseNotationType(ctxt ParserCtxtPtr) EnumerationPtr - -//go:linkname ParseEnumerationType C.xmlParseEnumerationType -func ParseEnumerationType(ctxt ParserCtxtPtr) EnumerationPtr - -//go:linkname ParseEnumeratedType C.xmlParseEnumeratedType -func ParseEnumeratedType(ctxt ParserCtxtPtr, tree *EnumerationPtr) c.Int - -//go:linkname ParseAttributeType C.xmlParseAttributeType -func ParseAttributeType(ctxt ParserCtxtPtr, tree *EnumerationPtr) c.Int - -//go:linkname ParseAttributeListDecl C.xmlParseAttributeListDecl -func ParseAttributeListDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseElementMixedContentDecl C.xmlParseElementMixedContentDecl -func ParseElementMixedContentDecl(ctxt ParserCtxtPtr, inputchk c.Int) ElementContentPtr - -//go:linkname ParseElementChildrenContentDecl C.xmlParseElementChildrenContentDecl -func ParseElementChildrenContentDecl(ctxt ParserCtxtPtr, inputchk c.Int) ElementContentPtr - -//go:linkname ParseElementContentDecl C.xmlParseElementContentDecl -func ParseElementContentDecl(ctxt ParserCtxtPtr, name *Char, result *ElementContentPtr) c.Int - -//go:linkname ParseElementDecl C.xmlParseElementDecl -func ParseElementDecl(ctxt ParserCtxtPtr) c.Int - -//go:linkname ParseMarkupDecl C.xmlParseMarkupDecl -func ParseMarkupDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseCharRef C.xmlParseCharRef -func ParseCharRef(ctxt ParserCtxtPtr) c.Int - -//go:linkname ParseEntityRef C.xmlParseEntityRef -func ParseEntityRef(ctxt ParserCtxtPtr) EntityPtr - -//go:linkname ParseReference C.xmlParseReference -func ParseReference(ctxt ParserCtxtPtr) - -//go:linkname ParsePEReference C.xmlParsePEReference -func ParsePEReference(ctxt ParserCtxtPtr) - -//go:linkname ParseDocTypeDecl C.xmlParseDocTypeDecl -func ParseDocTypeDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseAttribute C.xmlParseAttribute -func ParseAttribute(ctxt ParserCtxtPtr, value **Char) *Char - -//go:linkname ParseStartTag C.xmlParseStartTag -func ParseStartTag(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseEndTag C.xmlParseEndTag -func ParseEndTag(ctxt ParserCtxtPtr) - -//go:linkname ParseCDSect C.xmlParseCDSect -func ParseCDSect(ctxt ParserCtxtPtr) - -//go:linkname ParseContent C.xmlParseContent -func ParseContent(ctxt ParserCtxtPtr) - -//go:linkname ParseElement C.xmlParseElement -func ParseElement(ctxt ParserCtxtPtr) - -//go:linkname ParseVersionNum C.xmlParseVersionNum -func ParseVersionNum(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseVersionInfo C.xmlParseVersionInfo -func ParseVersionInfo(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseEncName C.xmlParseEncName -func ParseEncName(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseEncodingDecl C.xmlParseEncodingDecl -func ParseEncodingDecl(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseSDDecl C.xmlParseSDDecl -func ParseSDDecl(ctxt ParserCtxtPtr) c.Int - -//go:linkname ParseXMLDecl C.xmlParseXMLDecl -func ParseXMLDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseTextDecl C.xmlParseTextDecl -func ParseTextDecl(ctxt ParserCtxtPtr) - -//go:linkname ParseMisc C.xmlParseMisc -func ParseMisc(ctxt ParserCtxtPtr) - -//go:linkname ParseExternalSubset C.xmlParseExternalSubset -func ParseExternalSubset(ctxt ParserCtxtPtr, ExternalID *Char, SystemID *Char) - -//go:linkname StringDecodeEntities C.xmlStringDecodeEntities -func StringDecodeEntities(ctxt ParserCtxtPtr, str *Char, what c.Int, end Char, end2 Char, end3 Char) *Char - -//go:linkname StringLenDecodeEntities C.xmlStringLenDecodeEntities -func StringLenDecodeEntities(ctxt ParserCtxtPtr, str *Char, len c.Int, what c.Int, end Char, end2 Char, end3 Char) *Char - -/* - * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. - */ -//go:linkname NodePush C.nodePush -func NodePush(ctxt ParserCtxtPtr, value NodePtr) c.Int - -//go:linkname NodePop C.nodePop -func NodePop(ctxt ParserCtxtPtr) NodePtr - -//go:linkname InputPush C.inputPush -func InputPush(ctxt ParserCtxtPtr, value ParserInputPtr) c.Int - -//go:linkname InputPop C.inputPop -func InputPop(ctxt ParserCtxtPtr) ParserInputPtr - -//go:linkname NamePop C.namePop -func NamePop(ctxt ParserCtxtPtr) *Char - -//go:linkname NamePush C.namePush -func NamePush(ctxt ParserCtxtPtr, value *Char) c.Int - -/* - * other commodities shared between parser.c and parserInternals. - */ -//go:linkname SkipBlankChars C.xmlSkipBlankChars -func SkipBlankChars(ctxt ParserCtxtPtr) c.Int - -//go:linkname StringCurrentChar C.xmlStringCurrentChar -func StringCurrentChar(ctxt ParserCtxtPtr, cur *Char, len *c.Int) c.Int - -//go:linkname ParserHandlePEReference C.xmlParserHandlePEReference -func ParserHandlePEReference(ctxt ParserCtxtPtr) - -// llgo:link (*Char).CheckLanguageID C.xmlCheckLanguageID -func (recv_ *Char) CheckLanguageID() c.Int { - return 0 -} - -/* - * Really core function shared with HTML parser. - */ -//go:linkname CurrentChar C.xmlCurrentChar -func CurrentChar(ctxt ParserCtxtPtr, len *c.Int) c.Int - -// llgo:link (*Char).CopyCharMultiByte C.xmlCopyCharMultiByte -func (recv_ *Char) CopyCharMultiByte(val c.Int) c.Int { - return 0 -} - -//go:linkname CopyChar C.xmlCopyChar -func CopyChar(len c.Int, out *Char, val c.Int) c.Int - -//go:linkname NextChar C.xmlNextChar -func NextChar(ctxt ParserCtxtPtr) - -//go:linkname ParserInputShrink C.xmlParserInputShrink -func ParserInputShrink(in ParserInputPtr) - -// llgo:type C -type EntityReferenceFunc func(EntityPtr, NodePtr, NodePtr) - -//go:linkname SetEntityReferenceFunc C.xmlSetEntityReferenceFunc -func SetEntityReferenceFunc(func_ EntityReferenceFunc) - -//go:linkname ParseQuotedString C.xmlParseQuotedString -func ParseQuotedString(ctxt ParserCtxtPtr) *Char - -//go:linkname ParseNamespace C.xmlParseNamespace -func ParseNamespace(ctxt ParserCtxtPtr) - -//go:linkname NamespaceParseNSDef C.xmlNamespaceParseNSDef -func NamespaceParseNSDef(ctxt ParserCtxtPtr) *Char - -//go:linkname ScanName C.xmlScanName -func ScanName(ctxt ParserCtxtPtr) *Char - -//go:linkname NamespaceParseNCName C.xmlNamespaceParseNCName -func NamespaceParseNCName(ctxt ParserCtxtPtr) *Char - -//go:linkname ParserHandleReference C.xmlParserHandleReference -func ParserHandleReference(ctxt ParserCtxtPtr) - -//go:linkname NamespaceParseQName C.xmlNamespaceParseQName -func NamespaceParseQName(ctxt ParserCtxtPtr, prefix **Char) *Char - -/** - * Entities - */ -//go:linkname DecodeEntities C.xmlDecodeEntities -func DecodeEntities(ctxt ParserCtxtPtr, len c.Int, what c.Int, end Char, end2 Char, end3 Char) *Char - -//go:linkname HandleEntity C.xmlHandleEntity -func HandleEntity(ctxt ParserCtxtPtr, entity EntityPtr) diff --git a/libxml2/pattern.go b/libxml2/pattern.go deleted file mode 100644 index e43848da..00000000 --- a/libxml2/pattern.go +++ /dev/null @@ -1,78 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlPattern struct { - Unused [8]uint8 -} -type Pattern X_xmlPattern -type PatternPtr *Pattern -type PatternFlags c.Int - -const ( - PATTERN_DEFAULT PatternFlags = 0 - PATTERN_XPATH PatternFlags = 1 - PATTERN_XSSEL PatternFlags = 2 - PATTERN_XSFIELD PatternFlags = 4 -) - -//go:linkname FreePattern C.xmlFreePattern -func FreePattern(comp PatternPtr) - -//go:linkname FreePatternList C.xmlFreePatternList -func FreePatternList(comp PatternPtr) - -// llgo:link (*Char).Patterncompile C.xmlPatterncompile -func (recv_ *Char) Patterncompile(dict *Dict, flags c.Int, namespaces **Char) PatternPtr { - return nil -} - -// llgo:link (*Char).PatternCompileSafe C.xmlPatternCompileSafe -func (recv_ *Char) PatternCompileSafe(dict *Dict, flags c.Int, namespaces **Char, patternOut *PatternPtr) c.Int { - return 0 -} - -//go:linkname PatternMatch C.xmlPatternMatch -func PatternMatch(comp PatternPtr, node NodePtr) c.Int - -type X_xmlStreamCtxt struct { - Unused [8]uint8 -} -type StreamCtxt X_xmlStreamCtxt -type StreamCtxtPtr *StreamCtxt - -//go:linkname PatternStreamable C.xmlPatternStreamable -func PatternStreamable(comp PatternPtr) c.Int - -//go:linkname PatternMaxDepth C.xmlPatternMaxDepth -func PatternMaxDepth(comp PatternPtr) c.Int - -//go:linkname PatternMinDepth C.xmlPatternMinDepth -func PatternMinDepth(comp PatternPtr) c.Int - -//go:linkname PatternFromRoot C.xmlPatternFromRoot -func PatternFromRoot(comp PatternPtr) c.Int - -//go:linkname PatternGetStreamCtxt C.xmlPatternGetStreamCtxt -func PatternGetStreamCtxt(comp PatternPtr) StreamCtxtPtr - -//go:linkname FreeStreamCtxt C.xmlFreeStreamCtxt -func FreeStreamCtxt(stream StreamCtxtPtr) - -//go:linkname StreamPushNode C.xmlStreamPushNode -func StreamPushNode(stream StreamCtxtPtr, name *Char, ns *Char, nodeType c.Int) c.Int - -//go:linkname StreamPush C.xmlStreamPush -func StreamPush(stream StreamCtxtPtr, name *Char, ns *Char) c.Int - -//go:linkname StreamPushAttr C.xmlStreamPushAttr -func StreamPushAttr(stream StreamCtxtPtr, name *Char, ns *Char) c.Int - -//go:linkname StreamPop C.xmlStreamPop -func StreamPop(stream StreamCtxtPtr) c.Int - -//go:linkname StreamWantsAnyNode C.xmlStreamWantsAnyNode -func StreamWantsAnyNode(stream StreamCtxtPtr) c.Int diff --git a/libxml2/relaxng.go b/libxml2/relaxng.go deleted file mode 100644 index 4b04c38c..00000000 --- a/libxml2/relaxng.go +++ /dev/null @@ -1,163 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlRelaxNG struct { - Unused [8]uint8 -} -type RelaxNG X_xmlRelaxNG -type RelaxNGPtr *RelaxNG - -// llgo:type C -type RelaxNGValidityErrorFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type RelaxNGValidityWarningFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -type X_xmlRelaxNGParserCtxt struct { - Unused [8]uint8 -} -type RelaxNGParserCtxt X_xmlRelaxNGParserCtxt -type RelaxNGParserCtxtPtr *RelaxNGParserCtxt - -type X_xmlRelaxNGValidCtxt struct { - Unused [8]uint8 -} -type RelaxNGValidCtxt X_xmlRelaxNGValidCtxt -type RelaxNGValidCtxtPtr *RelaxNGValidCtxt -type RelaxNGValidErr c.Int - -const ( - RELAXNG_OK RelaxNGValidErr = 0 - RELAXNG_ERR_MEMORY RelaxNGValidErr = 1 - RELAXNG_ERR_TYPE RelaxNGValidErr = 2 - RELAXNG_ERR_TYPEVAL RelaxNGValidErr = 3 - RELAXNG_ERR_DUPID RelaxNGValidErr = 4 - RELAXNG_ERR_TYPECMP RelaxNGValidErr = 5 - RELAXNG_ERR_NOSTATE RelaxNGValidErr = 6 - RELAXNG_ERR_NODEFINE RelaxNGValidErr = 7 - RELAXNG_ERR_LISTEXTRA RelaxNGValidErr = 8 - RELAXNG_ERR_LISTEMPTY RelaxNGValidErr = 9 - RELAXNG_ERR_INTERNODATA RelaxNGValidErr = 10 - RELAXNG_ERR_INTERSEQ RelaxNGValidErr = 11 - RELAXNG_ERR_INTEREXTRA RelaxNGValidErr = 12 - RELAXNG_ERR_ELEMNAME RelaxNGValidErr = 13 - RELAXNG_ERR_ATTRNAME RelaxNGValidErr = 14 - RELAXNG_ERR_ELEMNONS RelaxNGValidErr = 15 - RELAXNG_ERR_ATTRNONS RelaxNGValidErr = 16 - RELAXNG_ERR_ELEMWRONGNS RelaxNGValidErr = 17 - RELAXNG_ERR_ATTRWRONGNS RelaxNGValidErr = 18 - RELAXNG_ERR_ELEMEXTRANS RelaxNGValidErr = 19 - RELAXNG_ERR_ATTREXTRANS RelaxNGValidErr = 20 - RELAXNG_ERR_ELEMNOTEMPTY RelaxNGValidErr = 21 - RELAXNG_ERR_NOELEM RelaxNGValidErr = 22 - RELAXNG_ERR_NOTELEM RelaxNGValidErr = 23 - RELAXNG_ERR_ATTRVALID RelaxNGValidErr = 24 - RELAXNG_ERR_CONTENTVALID RelaxNGValidErr = 25 - RELAXNG_ERR_EXTRACONTENT RelaxNGValidErr = 26 - RELAXNG_ERR_INVALIDATTR RelaxNGValidErr = 27 - RELAXNG_ERR_DATAELEM RelaxNGValidErr = 28 - RELAXNG_ERR_VALELEM RelaxNGValidErr = 29 - RELAXNG_ERR_LISTELEM RelaxNGValidErr = 30 - RELAXNG_ERR_DATATYPE RelaxNGValidErr = 31 - RELAXNG_ERR_VALUE RelaxNGValidErr = 32 - RELAXNG_ERR_LIST RelaxNGValidErr = 33 - RELAXNG_ERR_NOGRAMMAR RelaxNGValidErr = 34 - RELAXNG_ERR_EXTRADATA RelaxNGValidErr = 35 - RELAXNG_ERR_LACKDATA RelaxNGValidErr = 36 - RELAXNG_ERR_INTERNAL RelaxNGValidErr = 37 - RELAXNG_ERR_ELEMWRONG RelaxNGValidErr = 38 - RELAXNG_ERR_TEXTWRONG RelaxNGValidErr = 39 -) - -type RelaxNGParserFlag c.Int - -const ( - RELAXNGP_NONE RelaxNGParserFlag = 0 - RELAXNGP_FREE_DOC RelaxNGParserFlag = 1 - RELAXNGP_CRNG RelaxNGParserFlag = 2 -) - -//go:linkname RelaxNGInitTypes C.xmlRelaxNGInitTypes -func RelaxNGInitTypes() c.Int - -//go:linkname RelaxNGCleanupTypes C.xmlRelaxNGCleanupTypes -func RelaxNGCleanupTypes() - -/* - * Interfaces for parsing. - */ -//go:linkname RelaxNGNewParserCtxt C.xmlRelaxNGNewParserCtxt -func RelaxNGNewParserCtxt(URL *c.Char) RelaxNGParserCtxtPtr - -//go:linkname RelaxNGNewMemParserCtxt C.xmlRelaxNGNewMemParserCtxt -func RelaxNGNewMemParserCtxt(buffer *c.Char, size c.Int) RelaxNGParserCtxtPtr - -//go:linkname RelaxNGNewDocParserCtxt C.xmlRelaxNGNewDocParserCtxt -func RelaxNGNewDocParserCtxt(doc DocPtr) RelaxNGParserCtxtPtr - -//go:linkname RelaxParserSetFlag C.xmlRelaxParserSetFlag -func RelaxParserSetFlag(ctxt RelaxNGParserCtxtPtr, flag c.Int) c.Int - -//go:linkname RelaxNGFreeParserCtxt C.xmlRelaxNGFreeParserCtxt -func RelaxNGFreeParserCtxt(ctxt RelaxNGParserCtxtPtr) - -//go:linkname RelaxNGSetParserErrors C.xmlRelaxNGSetParserErrors -func RelaxNGSetParserErrors(ctxt RelaxNGParserCtxtPtr, err RelaxNGValidityErrorFunc, warn RelaxNGValidityWarningFunc, ctx c.Pointer) - -//go:linkname RelaxNGGetParserErrors C.xmlRelaxNGGetParserErrors -func RelaxNGGetParserErrors(ctxt RelaxNGParserCtxtPtr, err RelaxNGValidityErrorFunc, warn RelaxNGValidityWarningFunc, ctx *c.Pointer) c.Int - -//go:linkname RelaxNGSetParserStructuredErrors C.xmlRelaxNGSetParserStructuredErrors -func RelaxNGSetParserStructuredErrors(ctxt RelaxNGParserCtxtPtr, serror StructuredErrorFunc, ctx c.Pointer) - -//go:linkname RelaxNGParse C.xmlRelaxNGParse -func RelaxNGParse(ctxt RelaxNGParserCtxtPtr) RelaxNGPtr - -//go:linkname RelaxNGFree C.xmlRelaxNGFree -func RelaxNGFree(schema RelaxNGPtr) - -//go:linkname RelaxNGDump C.xmlRelaxNGDump -func RelaxNGDump(output *c.FILE, schema RelaxNGPtr) - -//go:linkname RelaxNGDumpTree C.xmlRelaxNGDumpTree -func RelaxNGDumpTree(output *c.FILE, schema RelaxNGPtr) - -/* - * Interfaces for validating - */ -//go:linkname RelaxNGSetValidErrors C.xmlRelaxNGSetValidErrors -func RelaxNGSetValidErrors(ctxt RelaxNGValidCtxtPtr, err RelaxNGValidityErrorFunc, warn RelaxNGValidityWarningFunc, ctx c.Pointer) - -//go:linkname RelaxNGGetValidErrors C.xmlRelaxNGGetValidErrors -func RelaxNGGetValidErrors(ctxt RelaxNGValidCtxtPtr, err RelaxNGValidityErrorFunc, warn RelaxNGValidityWarningFunc, ctx *c.Pointer) c.Int - -//go:linkname RelaxNGSetValidStructuredErrors C.xmlRelaxNGSetValidStructuredErrors -func RelaxNGSetValidStructuredErrors(ctxt RelaxNGValidCtxtPtr, serror StructuredErrorFunc, ctx c.Pointer) - -//go:linkname RelaxNGNewValidCtxt C.xmlRelaxNGNewValidCtxt -func RelaxNGNewValidCtxt(schema RelaxNGPtr) RelaxNGValidCtxtPtr - -//go:linkname RelaxNGFreeValidCtxt C.xmlRelaxNGFreeValidCtxt -func RelaxNGFreeValidCtxt(ctxt RelaxNGValidCtxtPtr) - -//go:linkname RelaxNGValidateDoc C.xmlRelaxNGValidateDoc -func RelaxNGValidateDoc(ctxt RelaxNGValidCtxtPtr, doc DocPtr) c.Int - -/* - * Interfaces for progressive validation when possible - */ -//go:linkname RelaxNGValidatePushElement C.xmlRelaxNGValidatePushElement -func RelaxNGValidatePushElement(ctxt RelaxNGValidCtxtPtr, doc DocPtr, elem NodePtr) c.Int - -//go:linkname RelaxNGValidatePushCData C.xmlRelaxNGValidatePushCData -func RelaxNGValidatePushCData(ctxt RelaxNGValidCtxtPtr, data *Char, len c.Int) c.Int - -//go:linkname RelaxNGValidatePopElement C.xmlRelaxNGValidatePopElement -func RelaxNGValidatePopElement(ctxt RelaxNGValidCtxtPtr, doc DocPtr, elem NodePtr) c.Int - -//go:linkname RelaxNGValidateFullElement C.xmlRelaxNGValidateFullElement -func RelaxNGValidateFullElement(ctxt RelaxNGValidCtxtPtr, doc DocPtr, elem NodePtr) c.Int diff --git a/libxml2/schemasInternals.go b/libxml2/schemasInternals.go deleted file mode 100644 index 0a62c676..00000000 --- a/libxml2/schemasInternals.go +++ /dev/null @@ -1,358 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const SCHEMAS_ANYATTR_SKIP = 1 -const SCHEMAS_ANYATTR_LAX = 2 -const SCHEMAS_ANYATTR_STRICT = 3 -const SCHEMAS_ANY_SKIP = 1 -const SCHEMAS_ANY_LAX = 2 -const SCHEMAS_ANY_STRICT = 3 -const SCHEMAS_ATTR_USE_PROHIBITED = 0 -const SCHEMAS_ATTR_USE_REQUIRED = 1 -const SCHEMAS_ATTR_USE_OPTIONAL = 2 -const SCHEMAS_FACET_UNKNOWN = 0 -const SCHEMAS_FACET_PRESERVE = 1 -const SCHEMAS_FACET_REPLACE = 2 -const SCHEMAS_FACET_COLLAPSE = 3 - -type SchemaValType c.Int - -const ( - SCHEMAS_UNKNOWN SchemaValType = 0 - SCHEMAS_STRING SchemaValType = 1 - SCHEMAS_NORMSTRING SchemaValType = 2 - SCHEMAS_DECIMAL SchemaValType = 3 - SCHEMAS_TIME SchemaValType = 4 - SCHEMAS_GDAY SchemaValType = 5 - SCHEMAS_GMONTH SchemaValType = 6 - SCHEMAS_GMONTHDAY SchemaValType = 7 - SCHEMAS_GYEAR SchemaValType = 8 - SCHEMAS_GYEARMONTH SchemaValType = 9 - SCHEMAS_DATE SchemaValType = 10 - SCHEMAS_DATETIME SchemaValType = 11 - SCHEMAS_DURATION SchemaValType = 12 - SCHEMAS_FLOAT SchemaValType = 13 - SCHEMAS_DOUBLE SchemaValType = 14 - SCHEMAS_BOOLEAN SchemaValType = 15 - SCHEMAS_TOKEN SchemaValType = 16 - SCHEMAS_LANGUAGE SchemaValType = 17 - SCHEMAS_NMTOKEN SchemaValType = 18 - SCHEMAS_NMTOKENS SchemaValType = 19 - SCHEMAS_NAME SchemaValType = 20 - SCHEMAS_QNAME SchemaValType = 21 - SCHEMAS_NCNAME SchemaValType = 22 - SCHEMAS_ID SchemaValType = 23 - SCHEMAS_IDREF SchemaValType = 24 - SCHEMAS_IDREFS SchemaValType = 25 - SCHEMAS_ENTITY SchemaValType = 26 - SCHEMAS_ENTITIES SchemaValType = 27 - SCHEMAS_NOTATION SchemaValType = 28 - SCHEMAS_ANYURI SchemaValType = 29 - SCHEMAS_INTEGER SchemaValType = 30 - SCHEMAS_NPINTEGER SchemaValType = 31 - SCHEMAS_NINTEGER SchemaValType = 32 - SCHEMAS_NNINTEGER SchemaValType = 33 - SCHEMAS_PINTEGER SchemaValType = 34 - SCHEMAS_INT SchemaValType = 35 - SCHEMAS_UINT SchemaValType = 36 - SCHEMAS_LONG SchemaValType = 37 - SCHEMAS_ULONG SchemaValType = 38 - SCHEMAS_SHORT SchemaValType = 39 - SCHEMAS_USHORT SchemaValType = 40 - SCHEMAS_BYTE SchemaValType = 41 - SCHEMAS_UBYTE SchemaValType = 42 - SCHEMAS_HEXBINARY SchemaValType = 43 - SCHEMAS_BASE64BINARY SchemaValType = 44 - SCHEMAS_ANYTYPE SchemaValType = 45 - SCHEMAS_ANYSIMPLETYPE SchemaValType = 46 -) - -type SchemaTypeType c.Int - -const ( - SCHEMA_TYPE_BASIC SchemaTypeType = 1 - SCHEMA_TYPE_ANY SchemaTypeType = 2 - SCHEMA_TYPE_FACET SchemaTypeType = 3 - SCHEMA_TYPE_SIMPLE SchemaTypeType = 4 - SCHEMA_TYPE_COMPLEX SchemaTypeType = 5 - SCHEMA_TYPE_SEQUENCE SchemaTypeType = 6 - SCHEMA_TYPE_CHOICE SchemaTypeType = 7 - SCHEMA_TYPE_ALL SchemaTypeType = 8 - SCHEMA_TYPE_SIMPLE_CONTENT SchemaTypeType = 9 - SCHEMA_TYPE_COMPLEX_CONTENT SchemaTypeType = 10 - SCHEMA_TYPE_UR SchemaTypeType = 11 - SCHEMA_TYPE_RESTRICTION SchemaTypeType = 12 - SCHEMA_TYPE_EXTENSION SchemaTypeType = 13 - SCHEMA_TYPE_ELEMENT SchemaTypeType = 14 - SCHEMA_TYPE_ATTRIBUTE SchemaTypeType = 15 - SCHEMA_TYPE_ATTRIBUTEGROUP SchemaTypeType = 16 - SCHEMA_TYPE_GROUP SchemaTypeType = 17 - SCHEMA_TYPE_NOTATION SchemaTypeType = 18 - SCHEMA_TYPE_LIST SchemaTypeType = 19 - SCHEMA_TYPE_UNION SchemaTypeType = 20 - SCHEMA_TYPE_ANY_ATTRIBUTE SchemaTypeType = 21 - SCHEMA_TYPE_IDC_UNIQUE SchemaTypeType = 22 - SCHEMA_TYPE_IDC_KEY SchemaTypeType = 23 - SCHEMA_TYPE_IDC_KEYREF SchemaTypeType = 24 - SCHEMA_TYPE_PARTICLE SchemaTypeType = 25 - SCHEMA_TYPE_ATTRIBUTE_USE SchemaTypeType = 26 - SCHEMA_FACET_MININCLUSIVE SchemaTypeType = 1000 - SCHEMA_FACET_MINEXCLUSIVE SchemaTypeType = 1001 - SCHEMA_FACET_MAXINCLUSIVE SchemaTypeType = 1002 - SCHEMA_FACET_MAXEXCLUSIVE SchemaTypeType = 1003 - SCHEMA_FACET_TOTALDIGITS SchemaTypeType = 1004 - SCHEMA_FACET_FRACTIONDIGITS SchemaTypeType = 1005 - SCHEMA_FACET_PATTERN SchemaTypeType = 1006 - SCHEMA_FACET_ENUMERATION SchemaTypeType = 1007 - SCHEMA_FACET_WHITESPACE SchemaTypeType = 1008 - SCHEMA_FACET_LENGTH SchemaTypeType = 1009 - SCHEMA_FACET_MAXLENGTH SchemaTypeType = 1010 - SCHEMA_FACET_MINLENGTH SchemaTypeType = 1011 - SCHEMA_EXTRA_QNAMEREF SchemaTypeType = 2000 - SCHEMA_EXTRA_ATTR_USE_PROHIB SchemaTypeType = 2001 -) - -type SchemaContentType c.Int - -const ( - SCHEMA_CONTENT_UNKNOWN SchemaContentType = 0 - SCHEMA_CONTENT_EMPTY SchemaContentType = 1 - SCHEMA_CONTENT_ELEMENTS SchemaContentType = 2 - SCHEMA_CONTENT_MIXED SchemaContentType = 3 - SCHEMA_CONTENT_SIMPLE SchemaContentType = 4 - SCHEMA_CONTENT_MIXED_OR_ELEMENTS SchemaContentType = 5 - SCHEMA_CONTENT_BASIC SchemaContentType = 6 - SCHEMA_CONTENT_ANY SchemaContentType = 7 -) - -type X_xmlSchemaVal struct { - Unused [8]uint8 -} -type SchemaVal X_xmlSchemaVal -type SchemaValPtr *SchemaVal - -type X_xmlSchemaType struct { - Type SchemaTypeType - Next *X_xmlSchemaType - Name *Char - Id *Char - Ref *Char - RefNs *Char - Annot SchemaAnnotPtr - Subtypes SchemaTypePtr - Attributes SchemaAttributePtr - Node NodePtr - MinOccurs c.Int - MaxOccurs c.Int - Flags c.Int - ContentType SchemaContentType - Base *Char - BaseNs *Char - BaseType SchemaTypePtr - Facets SchemaFacetPtr - Redef *X_xmlSchemaType - Recurse c.Int - AttributeUses *SchemaAttributeLinkPtr - AttributeWildcard SchemaWildcardPtr - BuiltInType c.Int - MemberTypes SchemaTypeLinkPtr - FacetSet SchemaFacetLinkPtr - RefPrefix *Char - ContentTypeDef SchemaTypePtr - ContModel RegexpPtr - TargetNamespace *Char - AttrUses c.Pointer -} -type SchemaType X_xmlSchemaType -type SchemaTypePtr *SchemaType - -type X_xmlSchemaFacet struct { - Type SchemaTypeType - Next *X_xmlSchemaFacet - Value *Char - Id *Char - Annot SchemaAnnotPtr - Node NodePtr - Fixed c.Int - Whitespace c.Int - Val SchemaValPtr - Regexp RegexpPtr -} -type SchemaFacet X_xmlSchemaFacet -type SchemaFacetPtr *SchemaFacet - -type X_xmlSchemaAnnot struct { - Next *X_xmlSchemaAnnot - Content NodePtr -} -type SchemaAnnot X_xmlSchemaAnnot -type SchemaAnnotPtr *SchemaAnnot - -type X_xmlSchemaAttribute struct { - Type SchemaTypeType - Next *X_xmlSchemaAttribute - Name *Char - Id *Char - Ref *Char - RefNs *Char - TypeName *Char - TypeNs *Char - Annot SchemaAnnotPtr - Base SchemaTypePtr - Occurs c.Int - DefValue *Char - Subtypes SchemaTypePtr - Node NodePtr - TargetNamespace *Char - Flags c.Int - RefPrefix *Char - DefVal SchemaValPtr - RefDecl SchemaAttributePtr -} -type SchemaAttribute X_xmlSchemaAttribute -type SchemaAttributePtr *SchemaAttribute - -type X_xmlSchemaAttributeLink struct { - Next *X_xmlSchemaAttributeLink - Attr *X_xmlSchemaAttribute -} -type SchemaAttributeLink X_xmlSchemaAttributeLink -type SchemaAttributeLinkPtr *SchemaAttributeLink - -type X_xmlSchemaWildcardNs struct { - Next *X_xmlSchemaWildcardNs - Value *Char -} -type SchemaWildcardNs X_xmlSchemaWildcardNs -type SchemaWildcardNsPtr *SchemaWildcardNs - -type X_xmlSchemaWildcard struct { - Type SchemaTypeType - Id *Char - Annot SchemaAnnotPtr - Node NodePtr - MinOccurs c.Int - MaxOccurs c.Int - ProcessContents c.Int - Any c.Int - NsSet SchemaWildcardNsPtr - NegNsSet SchemaWildcardNsPtr - Flags c.Int -} -type SchemaWildcard X_xmlSchemaWildcard -type SchemaWildcardPtr *SchemaWildcard - -type X_xmlSchemaAttributeGroup struct { - Type SchemaTypeType - Next *X_xmlSchemaAttribute - Name *Char - Id *Char - Ref *Char - RefNs *Char - Annot SchemaAnnotPtr - Attributes SchemaAttributePtr - Node NodePtr - Flags c.Int - AttributeWildcard SchemaWildcardPtr - RefPrefix *Char - RefItem SchemaAttributeGroupPtr - TargetNamespace *Char - AttrUses c.Pointer -} -type SchemaAttributeGroup X_xmlSchemaAttributeGroup -type SchemaAttributeGroupPtr *SchemaAttributeGroup - -type X_xmlSchemaTypeLink struct { - Next *X_xmlSchemaTypeLink - Type SchemaTypePtr -} -type SchemaTypeLink X_xmlSchemaTypeLink -type SchemaTypeLinkPtr *SchemaTypeLink - -type X_xmlSchemaFacetLink struct { - Next *X_xmlSchemaFacetLink - Facet SchemaFacetPtr -} -type SchemaFacetLink X_xmlSchemaFacetLink -type SchemaFacetLinkPtr *SchemaFacetLink - -type X_xmlSchemaElement struct { - Type SchemaTypeType - Next *X_xmlSchemaType - Name *Char - Id *Char - Ref *Char - RefNs *Char - Annot SchemaAnnotPtr - Subtypes SchemaTypePtr - Attributes SchemaAttributePtr - Node NodePtr - MinOccurs c.Int - MaxOccurs c.Int - Flags c.Int - TargetNamespace *Char - NamedType *Char - NamedTypeNs *Char - SubstGroup *Char - SubstGroupNs *Char - Scope *Char - Value *Char - RefDecl *X_xmlSchemaElement - ContModel RegexpPtr - ContentType SchemaContentType - RefPrefix *Char - DefVal SchemaValPtr - Idcs c.Pointer -} -type SchemaElement X_xmlSchemaElement -type SchemaElementPtr *SchemaElement - -type X_xmlSchemaNotation struct { - Type SchemaTypeType - Name *Char - Annot SchemaAnnotPtr - Identifier *Char - TargetNamespace *Char -} -type SchemaNotation X_xmlSchemaNotation -type SchemaNotationPtr *SchemaNotation - -/** - * _xmlSchema: - * - * A Schemas definition - */ - -type X_xmlSchema struct { - Name *Char - TargetNamespace *Char - Version *Char - Id *Char - Doc DocPtr - Annot SchemaAnnotPtr - Flags c.Int - TypeDecl HashTablePtr - AttrDecl HashTablePtr - AttrgrpDecl HashTablePtr - ElemDecl HashTablePtr - NotaDecl HashTablePtr - SchemasImports HashTablePtr - X_private c.Pointer - GroupDecl HashTablePtr - Dict DictPtr - Includes c.Pointer - Preserve c.Int - Counter c.Int - IdcDef HashTablePtr - Volatiles c.Pointer -} - -//go:linkname SchemaFreeType C.xmlSchemaFreeType -func SchemaFreeType(type_ SchemaTypePtr) - -//go:linkname SchemaFreeWildcard C.xmlSchemaFreeWildcard -func SchemaFreeWildcard(wildcard SchemaWildcardPtr) diff --git a/libxml2/schematron.go b/libxml2/schematron.go deleted file mode 100644 index c6ac9cc0..00000000 --- a/libxml2/schematron.go +++ /dev/null @@ -1,112 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type SchematronValidOptions c.Int - -const ( - SCHEMATRON_OUT_QUIET SchematronValidOptions = 1 - SCHEMATRON_OUT_TEXT SchematronValidOptions = 2 - SCHEMATRON_OUT_XML SchematronValidOptions = 4 - SCHEMATRON_OUT_ERROR SchematronValidOptions = 8 - SCHEMATRON_OUT_FILE SchematronValidOptions = 256 - SCHEMATRON_OUT_BUFFER SchematronValidOptions = 512 - SCHEMATRON_OUT_IO SchematronValidOptions = 1024 -) - -type X_xmlSchematron struct { - Unused [8]uint8 -} -type Schematron X_xmlSchematron -type SchematronPtr *Schematron - -// llgo:type C -type SchematronValidityErrorFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type SchematronValidityWarningFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -type X_xmlSchematronParserCtxt struct { - Unused [8]uint8 -} -type SchematronParserCtxt X_xmlSchematronParserCtxt -type SchematronParserCtxtPtr *SchematronParserCtxt - -type X_xmlSchematronValidCtxt struct { - Unused [8]uint8 -} -type SchematronValidCtxt X_xmlSchematronValidCtxt -type SchematronValidCtxtPtr *SchematronValidCtxt - -/* - * Interfaces for parsing. - */ -//go:linkname SchematronNewParserCtxt C.xmlSchematronNewParserCtxt -func SchematronNewParserCtxt(URL *c.Char) SchematronParserCtxtPtr - -//go:linkname SchematronNewMemParserCtxt C.xmlSchematronNewMemParserCtxt -func SchematronNewMemParserCtxt(buffer *c.Char, size c.Int) SchematronParserCtxtPtr - -//go:linkname SchematronNewDocParserCtxt C.xmlSchematronNewDocParserCtxt -func SchematronNewDocParserCtxt(doc DocPtr) SchematronParserCtxtPtr - -//go:linkname SchematronFreeParserCtxt C.xmlSchematronFreeParserCtxt -func SchematronFreeParserCtxt(ctxt SchematronParserCtxtPtr) - -/***** -XMLPUBFUN void - xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, - xmlSchematronValidityErrorFunc err, - xmlSchematronValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int - xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, - xmlSchematronValidityErrorFunc * err, - xmlSchematronValidityWarningFunc * warn, - void **ctx); -XMLPUBFUN int - xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); - *****/ -//go:linkname SchematronParse C.xmlSchematronParse -func SchematronParse(ctxt SchematronParserCtxtPtr) SchematronPtr - -//go:linkname SchematronFree C.xmlSchematronFree -func SchematronFree(schema SchematronPtr) - -/* - * Interfaces for validating - */ -//go:linkname SchematronSetValidStructuredErrors C.xmlSchematronSetValidStructuredErrors -func SchematronSetValidStructuredErrors(ctxt SchematronValidCtxtPtr, serror StructuredErrorFunc, ctx c.Pointer) - -/****** -XMLPUBFUN void - xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, - xmlSchematronValidityErrorFunc err, - xmlSchematronValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int - xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, - xmlSchematronValidityErrorFunc *err, - xmlSchematronValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN int - xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, - int options); -XMLPUBFUN int - xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); -XMLPUBFUN int - xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, - xmlNodePtr elem); - *******/ -//go:linkname SchematronNewValidCtxt C.xmlSchematronNewValidCtxt -func SchematronNewValidCtxt(schema SchematronPtr, options c.Int) SchematronValidCtxtPtr - -//go:linkname SchematronFreeValidCtxt C.xmlSchematronFreeValidCtxt -func SchematronFreeValidCtxt(ctxt SchematronValidCtxtPtr) - -//go:linkname SchematronValidateDoc C.xmlSchematronValidateDoc -func SchematronValidateDoc(ctxt SchematronValidCtxtPtr, instance DocPtr) c.Int diff --git a/libxml2/threads.go b/libxml2/threads.go deleted file mode 100644 index 9592dc5f..00000000 --- a/libxml2/threads.go +++ /dev/null @@ -1,66 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlMutex struct { - Unused [8]uint8 -} -type Mutex X_xmlMutex -type MutexPtr *Mutex - -type X_xmlRMutex struct { - Unused [8]uint8 -} -type RMutex X_xmlRMutex -type RMutexPtr *RMutex - -//go:linkname CheckThreadLocalStorage C.xmlCheckThreadLocalStorage -func CheckThreadLocalStorage() c.Int - -//go:linkname NewMutex C.xmlNewMutex -func NewMutex() MutexPtr - -//go:linkname MutexLock C.xmlMutexLock -func MutexLock(tok MutexPtr) - -//go:linkname MutexUnlock C.xmlMutexUnlock -func MutexUnlock(tok MutexPtr) - -//go:linkname FreeMutex C.xmlFreeMutex -func FreeMutex(tok MutexPtr) - -//go:linkname NewRMutex C.xmlNewRMutex -func NewRMutex() RMutexPtr - -//go:linkname RMutexLock C.xmlRMutexLock -func RMutexLock(tok RMutexPtr) - -//go:linkname RMutexUnlock C.xmlRMutexUnlock -func RMutexUnlock(tok RMutexPtr) - -//go:linkname FreeRMutex C.xmlFreeRMutex -func FreeRMutex(tok RMutexPtr) - -/* - * Library wide APIs. - */ -//go:linkname InitThreads C.xmlInitThreads -func InitThreads() - -//go:linkname LockLibrary C.xmlLockLibrary -func LockLibrary() - -//go:linkname UnlockLibrary C.xmlUnlockLibrary -func UnlockLibrary() - -//go:linkname GetThreadId C.xmlGetThreadId -func GetThreadId() c.Int - -//go:linkname IsMainThread C.xmlIsMainThread -func IsMainThread() c.Int - -//go:linkname CleanupThreads C.xmlCleanupThreads -func CleanupThreads() diff --git a/libxml2/tree.go b/libxml2/tree.go deleted file mode 100644 index 70aca250..00000000 --- a/libxml2/tree.go +++ /dev/null @@ -1,1227 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const BASE_BUFFER_SIZE = 4096 -const DOCB_DOCUMENT_NODE = 21 - -type X_xmlParserInputBuffer struct { - Context c.Pointer - Readcallback InputReadCallback - Closecallback InputCloseCallback - Encoder CharEncodingHandlerPtr - Buffer BufPtr - Raw BufPtr - Compressed c.Int - Error c.Int - Rawconsumed c.Ulong -} -type ParserInputBuffer X_xmlParserInputBuffer -type ParserInputBufferPtr *ParserInputBuffer - -type X_xmlOutputBuffer struct { - Context c.Pointer - Writecallback OutputWriteCallback - Closecallback OutputCloseCallback - Encoder CharEncodingHandlerPtr - Buffer BufPtr - Conv BufPtr - Written c.Int - Error c.Int -} -type OutputBuffer X_xmlOutputBuffer -type OutputBufferPtr *OutputBuffer - -type X_xmlParserInput struct { - Buf ParserInputBufferPtr - Filename *c.Char - Directory *c.Char - Base *Char - Cur *Char - End *Char - Length c.Int - Line c.Int - Col c.Int - Consumed c.Ulong - Free ParserInputDeallocate - Encoding *Char - Version *Char - Flags c.Int - Id c.Int - ParentConsumed c.Ulong - Entity EntityPtr -} -type ParserInput X_xmlParserInput -type ParserInputPtr *ParserInput - -type X_xmlParserCtxt struct { - Sax *X_xmlSAXHandler - UserData c.Pointer - MyDoc DocPtr - WellFormed c.Int - ReplaceEntities c.Int - Version *Char - Encoding *Char - Standalone c.Int - Html c.Int - Input ParserInputPtr - InputNr c.Int - InputMax c.Int - InputTab *ParserInputPtr - Node NodePtr - NodeNr c.Int - NodeMax c.Int - NodeTab *NodePtr - RecordInfo c.Int - NodeSeq ParserNodeInfoSeq - ErrNo c.Int - HasExternalSubset c.Int - HasPErefs c.Int - External c.Int - Valid c.Int - Validate c.Int - Vctxt ValidCtxt - Instate ParserInputState - Token c.Int - Directory *c.Char - Name *Char - NameNr c.Int - NameMax c.Int - NameTab **Char - NbChars c.Long - CheckIndex c.Long - KeepBlanks c.Int - DisableSAX c.Int - InSubset c.Int - IntSubName *Char - ExtSubURI *Char - ExtSubSystem *Char - Space *c.Int - SpaceNr c.Int - SpaceMax c.Int - SpaceTab *c.Int - Depth c.Int - Entity ParserInputPtr - Charset c.Int - Nodelen c.Int - Nodemem c.Int - Pedantic c.Int - X_private c.Pointer - Loadsubset c.Int - Linenumbers c.Int - Catalogs c.Pointer - Recovery c.Int - Progressive c.Int - Dict DictPtr - Atts **Char - Maxatts c.Int - Docdict c.Int - StrXml *Char - StrXmlns *Char - StrXmlNs *Char - Sax2 c.Int - NsNr c.Int - NsMax c.Int - NsTab **Char - Attallocs *c.Uint - PushTab *StartTag - AttsDefault HashTablePtr - AttsSpecial HashTablePtr - NsWellFormed c.Int - Options c.Int - DictNames c.Int - FreeElemsNr c.Int - FreeElems NodePtr - FreeAttrsNr c.Int - FreeAttrs AttrPtr - LastError Error - ParseMode ParserMode - Nbentities c.Ulong - Sizeentities c.Ulong - NodeInfo *ParserNodeInfo - NodeInfoNr c.Int - NodeInfoMax c.Int - NodeInfoTab *ParserNodeInfo - InputId c.Int - Sizeentcopy c.Ulong - EndCheckState c.Int - NbErrors uint16 - NbWarnings uint16 - MaxAmpl c.Uint - Nsdb *ParserNsData - AttrHashMax c.Uint - AttrHash *AttrHashBucket - ErrorHandler StructuredErrorFunc - ErrorCtxt c.Pointer -} -type ParserCtxt X_xmlParserCtxt -type ParserCtxtPtr *ParserCtxt - -type X_xmlSAXLocator struct { - GetPublicId c.Pointer - GetSystemId c.Pointer - GetLineNumber c.Pointer - GetColumnNumber c.Pointer -} -type SAXLocator X_xmlSAXLocator -type SAXLocatorPtr *SAXLocator - -type X_xmlSAXHandler struct { - InternalSubset InternalSubsetSAXFunc - IsStandalone IsStandaloneSAXFunc - HasInternalSubset HasInternalSubsetSAXFunc - HasExternalSubset HasExternalSubsetSAXFunc - ResolveEntity ResolveEntitySAXFunc - GetEntity GetEntitySAXFunc - EntityDecl EntityDeclSAXFunc - NotationDecl NotationDeclSAXFunc - AttributeDecl AttributeDeclSAXFunc - ElementDecl ElementDeclSAXFunc - UnparsedEntityDecl UnparsedEntityDeclSAXFunc - SetDocumentLocator SetDocumentLocatorSAXFunc - StartDocument StartDocumentSAXFunc - EndDocument EndDocumentSAXFunc - StartElement StartElementSAXFunc - EndElement EndElementSAXFunc - Reference ReferenceSAXFunc - Characters CharactersSAXFunc - IgnorableWhitespace IgnorableWhitespaceSAXFunc - ProcessingInstruction ProcessingInstructionSAXFunc - Comment CommentSAXFunc - Warning WarningSAXFunc - Error ErrorSAXFunc - FatalError FatalErrorSAXFunc - GetParameterEntity GetParameterEntitySAXFunc - CdataBlock CdataBlockSAXFunc - ExternalSubset ExternalSubsetSAXFunc - Initialized c.Uint - X_private c.Pointer - StartElementNs StartElementNsSAX2Func - EndElementNs EndElementNsSAX2Func - Serror StructuredErrorFunc -} -type SAXHandler X_xmlSAXHandler -type SAXHandlerPtr *SAXHandler - -type X_xmlEntity struct { - X_private c.Pointer - Type ElementType - Name *Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlDtd - Next *X_xmlNode - Prev *X_xmlNode - Doc *X_xmlDoc - Orig *Char - Content *Char - Length c.Int - Etype EntityType - ExternalID *Char - SystemID *Char - Nexte *X_xmlEntity - URI *Char - Owner c.Int - Flags c.Int - ExpandedSize c.Ulong -} -type Entity X_xmlEntity -type EntityPtr *Entity -type BufferAllocationScheme c.Int - -const ( - BUFFER_ALLOC_DOUBLEIT BufferAllocationScheme = 0 - BUFFER_ALLOC_EXACT BufferAllocationScheme = 1 - BUFFER_ALLOC_IMMUTABLE BufferAllocationScheme = 2 - BUFFER_ALLOC_IO BufferAllocationScheme = 3 - BUFFER_ALLOC_HYBRID BufferAllocationScheme = 4 - BUFFER_ALLOC_BOUNDED BufferAllocationScheme = 5 -) - -type X_xmlBuffer struct { - Content *Char - Use c.Uint - Size c.Uint - Alloc BufferAllocationScheme - ContentIO *Char -} -type Buffer X_xmlBuffer -type BufferPtr *Buffer - -type X_xmlBuf struct { - Unused [8]uint8 -} -type Buf X_xmlBuf -type BufPtr *Buf - -/* - * A few public routines for xmlBuf. As those are expected to be used - * mostly internally the bulk of the routines are internal in buf.h - */ -// llgo:link (*Buf).BufContent C.xmlBufContent -func (recv_ *Buf) BufContent() *Char { - return nil -} - -//go:linkname BufEnd C.xmlBufEnd -func BufEnd(buf BufPtr) *Char - -//go:linkname BufUse C.xmlBufUse -func BufUse(buf BufPtr) c.SizeT - -//go:linkname BufShrink C.xmlBufShrink -func BufShrink(buf BufPtr, len c.SizeT) c.SizeT - -type ElementType c.Int - -const ( - ELEMENT_NODE ElementType = 1 - ATTRIBUTE_NODE ElementType = 2 - TEXT_NODE ElementType = 3 - CDATA_SECTION_NODE ElementType = 4 - ENTITY_REF_NODE ElementType = 5 - ENTITY_NODE ElementType = 6 - PI_NODE ElementType = 7 - COMMENT_NODE ElementType = 8 - DOCUMENT_NODE ElementType = 9 - DOCUMENT_TYPE_NODE ElementType = 10 - DOCUMENT_FRAG_NODE ElementType = 11 - NOTATION_NODE ElementType = 12 - HTML_DOCUMENT_NODE ElementType = 13 - DTD_NODE ElementType = 14 - ELEMENT_DECL ElementType = 15 - ATTRIBUTE_DECL ElementType = 16 - ENTITY_DECL ElementType = 17 - NAMESPACE_DECL ElementType = 18 - XINCLUDE_START ElementType = 19 - XINCLUDE_END ElementType = 20 -) - -type X_xmlNotation struct { - Name *Char - PublicID *Char - SystemID *Char -} -type Notation X_xmlNotation -type NotationPtr *Notation -type AttributeType c.Int - -const ( - ATTRIBUTE_CDATA AttributeType = 1 - ATTRIBUTE_ID AttributeType = 2 - ATTRIBUTE_IDREF AttributeType = 3 - ATTRIBUTE_IDREFS AttributeType = 4 - ATTRIBUTE_ENTITY AttributeType = 5 - ATTRIBUTE_ENTITIES AttributeType = 6 - ATTRIBUTE_NMTOKEN AttributeType = 7 - ATTRIBUTE_NMTOKENS AttributeType = 8 - ATTRIBUTE_ENUMERATION AttributeType = 9 - ATTRIBUTE_NOTATION AttributeType = 10 -) - -type AttributeDefault c.Int - -const ( - ATTRIBUTE_NONE AttributeDefault = 1 - ATTRIBUTE_REQUIRED AttributeDefault = 2 - ATTRIBUTE_IMPLIED AttributeDefault = 3 - ATTRIBUTE_FIXED AttributeDefault = 4 -) - -type X_xmlEnumeration struct { - Next *X_xmlEnumeration - Name *Char -} -type Enumeration X_xmlEnumeration -type EnumerationPtr *Enumeration - -type X_xmlAttribute struct { - X_private c.Pointer - Type ElementType - Name *Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlDtd - Next *X_xmlNode - Prev *X_xmlNode - Doc *X_xmlDoc - Nexth *X_xmlAttribute - Atype AttributeType - Def AttributeDefault - DefaultValue *Char - Tree EnumerationPtr - Prefix *Char - Elem *Char -} -type Attribute X_xmlAttribute -type AttributePtr *Attribute - -type X_xmlNode struct { - X_private c.Pointer - Type ElementType - Name *Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlNode - Next *X_xmlNode - Prev *X_xmlNode - Doc *X_xmlDoc - Ns *Ns - Content *Char - Properties *X_xmlAttr - NsDef *Ns - Psvi c.Pointer - Line uint16 - Extra uint16 -} - -type X_xmlDtd struct { - X_private c.Pointer - Type ElementType - Name *Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlDoc - Next *X_xmlNode - Prev *X_xmlNode - Doc *X_xmlDoc - Notations c.Pointer - Elements c.Pointer - Attributes c.Pointer - Entities c.Pointer - ExternalID *Char - SystemID *Char - Pentities c.Pointer -} - -type X_xmlDoc struct { - X_private c.Pointer - Type ElementType - Name *c.Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlNode - Next *X_xmlNode - Prev *X_xmlNode - Doc *X_xmlDoc - Compression c.Int - Standalone c.Int - IntSubset *X_xmlDtd - ExtSubset *X_xmlDtd - OldNs *X_xmlNs - Version *Char - Encoding *Char - Ids c.Pointer - Refs c.Pointer - URL *Char - Charset c.Int - Dict *X_xmlDict - Psvi c.Pointer - ParseFlags c.Int - Properties c.Int -} -type ElementContentType c.Int - -const ( - ELEMENT_CONTENT_PCDATA ElementContentType = 1 - ELEMENT_CONTENT_ELEMENT ElementContentType = 2 - ELEMENT_CONTENT_SEQ ElementContentType = 3 - ELEMENT_CONTENT_OR ElementContentType = 4 -) - -type ElementContentOccur c.Int - -const ( - ELEMENT_CONTENT_ONCE ElementContentOccur = 1 - ELEMENT_CONTENT_OPT ElementContentOccur = 2 - ELEMENT_CONTENT_MULT ElementContentOccur = 3 - ELEMENT_CONTENT_PLUS ElementContentOccur = 4 -) - -type X_xmlElementContent struct { - Type ElementContentType - Ocur ElementContentOccur - Name *Char - C1 *X_xmlElementContent - C2 *X_xmlElementContent - Parent *X_xmlElementContent - Prefix *Char -} -type ElementContent X_xmlElementContent -type ElementContentPtr *ElementContent -type ElementTypeVal c.Int - -const ( - ELEMENT_TYPE_UNDEFINED ElementTypeVal = 0 - ELEMENT_TYPE_EMPTY ElementTypeVal = 1 - ELEMENT_TYPE_ANY ElementTypeVal = 2 - ELEMENT_TYPE_MIXED ElementTypeVal = 3 - ELEMENT_TYPE_ELEMENT ElementTypeVal = 4 -) - -type X_xmlElement struct { - X_private c.Pointer - Type ElementType - Name *Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlDtd - Next *X_xmlNode - Prev *X_xmlNode - Doc *X_xmlDoc - Etype ElementTypeVal - Content ElementContentPtr - Attributes AttributePtr - Prefix *Char - ContModel RegexpPtr -} -type Element X_xmlElement -type ElementPtr *Element -type NsType ElementType - -type X_xmlNs struct { - Next *X_xmlNs - Type NsType - Href *Char - Prefix *Char - X_private c.Pointer - Context *X_xmlDoc -} -type Ns X_xmlNs -type NsPtr *Ns -type Dtd X_xmlDtd -type DtdPtr *Dtd - -type X_xmlAttr struct { - X_private c.Pointer - Type ElementType - Name *Char - Children *X_xmlNode - Last *X_xmlNode - Parent *X_xmlNode - Next *X_xmlAttr - Prev *X_xmlAttr - Doc *X_xmlDoc - Ns *Ns - Atype AttributeType - Psvi c.Pointer - Id *X_xmlID -} -type Attr X_xmlAttr -type AttrPtr *Attr - -type X_xmlID struct { - Next *X_xmlID - Value *Char - Attr AttrPtr - Name *Char - Lineno c.Int - Doc *X_xmlDoc -} -type ID X_xmlID -type IDPtr *ID - -type X_xmlRef struct { - Next *X_xmlRef - Value *Char - Attr AttrPtr - Name *Char - Lineno c.Int -} -type Ref X_xmlRef -type RefPtr *Ref -type Node X_xmlNode -type NodePtr *Node -type DocProperties c.Int - -const ( - DOC_WELLFORMED DocProperties = 1 - DOC_NSVALID DocProperties = 2 - DOC_OLD10 DocProperties = 4 - DOC_DTDVALID DocProperties = 8 - DOC_XINCLUDE DocProperties = 16 - DOC_USERBUILT DocProperties = 32 - DOC_INTERNAL DocProperties = 64 - DOC_HTML DocProperties = 128 -) - -type Doc X_xmlDoc -type DocPtr *Doc - -type X_xmlDict struct { - Unused [8]uint8 -} - -type X_xmlDOMWrapCtxt struct { - X_private c.Pointer - Type c.Int - NamespaceMap c.Pointer - GetNsForNodeFunc DOMWrapAcquireNsFunction -} -type DOMWrapCtxt X_xmlDOMWrapCtxt -type DOMWrapCtxtPtr *DOMWrapCtxt - -// llgo:type C -type DOMWrapAcquireNsFunction func(DOMWrapCtxtPtr, NodePtr, *Char, *Char) NsPtr - -// llgo:type C -type RegisterNodeFunc func(NodePtr) - -// llgo:type C -type DeregisterNodeFunc func(NodePtr) - -//go:linkname X__xmlBufferAllocScheme C.__xmlBufferAllocScheme -func X__xmlBufferAllocScheme() *BufferAllocationScheme - -//go:linkname X__xmlDefaultBufferSize C.__xmlDefaultBufferSize -func X__xmlDefaultBufferSize() *c.Int - -//go:linkname X__xmlRegisterNodeDefaultValue C.__xmlRegisterNodeDefaultValue -func X__xmlRegisterNodeDefaultValue() RegisterNodeFunc - -//go:linkname X__xmlDeregisterNodeDefaultValue C.__xmlDeregisterNodeDefaultValue -func X__xmlDeregisterNodeDefaultValue() DeregisterNodeFunc - -/* - * Some helper functions - */ -// llgo:link (*Char).ValidateNCName C.xmlValidateNCName -func (recv_ *Char) ValidateNCName(space c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).ValidateQName C.xmlValidateQName -func (recv_ *Char) ValidateQName(space c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).ValidateName C.xmlValidateName -func (recv_ *Char) ValidateName(space c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).ValidateNMToken C.xmlValidateNMToken -func (recv_ *Char) ValidateNMToken(space c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).BuildQName C.xmlBuildQName -func (recv_ *Char) BuildQName(prefix *Char, memory *Char, len c.Int) *Char { - return nil -} - -// llgo:link (*Char).SplitQName2 C.xmlSplitQName2 -func (recv_ *Char) SplitQName2(prefix **Char) *Char { - return nil -} - -// llgo:link (*Char).SplitQName3 C.xmlSplitQName3 -func (recv_ *Char) SplitQName3(len *c.Int) *Char { - return nil -} - -/* - * Handling Buffers, the old ones see @xmlBuf for the new ones. - */ -// llgo:link BufferAllocationScheme.SetBufferAllocationScheme C.xmlSetBufferAllocationScheme -func (recv_ BufferAllocationScheme) SetBufferAllocationScheme() { -} - -//go:linkname GetBufferAllocationScheme C.xmlGetBufferAllocationScheme -func GetBufferAllocationScheme() BufferAllocationScheme - -//go:linkname BufferCreate C.xmlBufferCreate -func BufferCreate() BufferPtr - -//go:linkname BufferCreateSize C.xmlBufferCreateSize -func BufferCreateSize(size c.SizeT) BufferPtr - -//go:linkname BufferCreateStatic C.xmlBufferCreateStatic -func BufferCreateStatic(mem c.Pointer, size c.SizeT) BufferPtr - -//go:linkname BufferResize C.xmlBufferResize -func BufferResize(buf BufferPtr, size c.Uint) c.Int - -//go:linkname BufferFree C.xmlBufferFree -func BufferFree(buf BufferPtr) - -//go:linkname BufferDump C.xmlBufferDump -func BufferDump(file *c.FILE, buf BufferPtr) c.Int - -//go:linkname BufferAdd C.xmlBufferAdd -func BufferAdd(buf BufferPtr, str *Char, len c.Int) c.Int - -//go:linkname BufferAddHead C.xmlBufferAddHead -func BufferAddHead(buf BufferPtr, str *Char, len c.Int) c.Int - -//go:linkname BufferCat C.xmlBufferCat -func BufferCat(buf BufferPtr, str *Char) c.Int - -//go:linkname BufferCCat C.xmlBufferCCat -func BufferCCat(buf BufferPtr, str *c.Char) c.Int - -//go:linkname BufferShrink C.xmlBufferShrink -func BufferShrink(buf BufferPtr, len c.Uint) c.Int - -//go:linkname BufferGrow C.xmlBufferGrow -func BufferGrow(buf BufferPtr, len c.Uint) c.Int - -//go:linkname BufferEmpty C.xmlBufferEmpty -func BufferEmpty(buf BufferPtr) - -// llgo:link (*Buffer).BufferContent C.xmlBufferContent -func (recv_ *Buffer) BufferContent() *Char { - return nil -} - -//go:linkname BufferDetach C.xmlBufferDetach -func BufferDetach(buf BufferPtr) *Char - -//go:linkname BufferSetAllocationScheme C.xmlBufferSetAllocationScheme -func BufferSetAllocationScheme(buf BufferPtr, scheme BufferAllocationScheme) - -// llgo:link (*Buffer).BufferLength C.xmlBufferLength -func (recv_ *Buffer) BufferLength() c.Int { - return 0 -} - -/* - * Creating/freeing new structures. - */ -//go:linkname CreateIntSubset C.xmlCreateIntSubset -func CreateIntSubset(doc DocPtr, name *Char, ExternalID *Char, SystemID *Char) DtdPtr - -//go:linkname NewDtd C.xmlNewDtd -func NewDtd(doc DocPtr, name *Char, ExternalID *Char, SystemID *Char) DtdPtr - -// llgo:link (*Doc).GetIntSubset C.xmlGetIntSubset -func (recv_ *Doc) GetIntSubset() DtdPtr { - return nil -} - -//go:linkname FreeDtd C.xmlFreeDtd -func FreeDtd(cur DtdPtr) - -//go:linkname NewGlobalNs C.xmlNewGlobalNs -func NewGlobalNs(doc DocPtr, href *Char, prefix *Char) NsPtr - -//go:linkname NewNs C.xmlNewNs -func NewNs(node NodePtr, href *Char, prefix *Char) NsPtr - -//go:linkname FreeNs C.xmlFreeNs -func FreeNs(cur NsPtr) - -//go:linkname FreeNsList C.xmlFreeNsList -func FreeNsList(cur NsPtr) - -// llgo:link (*Char).NewDoc C.xmlNewDoc -func (recv_ *Char) NewDoc() DocPtr { - return nil -} - -//go:linkname FreeDoc C.xmlFreeDoc -func FreeDoc(cur DocPtr) - -//go:linkname NewDocProp C.xmlNewDocProp -func NewDocProp(doc DocPtr, name *Char, value *Char) AttrPtr - -//go:linkname NewProp C.xmlNewProp -func NewProp(node NodePtr, name *Char, value *Char) AttrPtr - -//go:linkname NewNsProp C.xmlNewNsProp -func NewNsProp(node NodePtr, ns NsPtr, name *Char, value *Char) AttrPtr - -//go:linkname NewNsPropEatName C.xmlNewNsPropEatName -func NewNsPropEatName(node NodePtr, ns NsPtr, name *Char, value *Char) AttrPtr - -//go:linkname FreePropList C.xmlFreePropList -func FreePropList(cur AttrPtr) - -//go:linkname FreeProp C.xmlFreeProp -func FreeProp(cur AttrPtr) - -//go:linkname CopyProp C.xmlCopyProp -func CopyProp(target NodePtr, cur AttrPtr) AttrPtr - -//go:linkname CopyPropList C.xmlCopyPropList -func CopyPropList(target NodePtr, cur AttrPtr) AttrPtr - -//go:linkname CopyDtd C.xmlCopyDtd -func CopyDtd(dtd DtdPtr) DtdPtr - -//go:linkname CopyDoc C.xmlCopyDoc -func CopyDoc(doc DocPtr, recursive c.Int) DocPtr - -/* - * Creating new nodes. - */ -//go:linkname NewDocNode C.xmlNewDocNode -func NewDocNode(doc DocPtr, ns NsPtr, name *Char, content *Char) NodePtr - -//go:linkname NewDocNodeEatName C.xmlNewDocNodeEatName -func NewDocNodeEatName(doc DocPtr, ns NsPtr, name *Char, content *Char) NodePtr - -//go:linkname NewNode C.xmlNewNode -func NewNode(ns NsPtr, name *Char) NodePtr - -//go:linkname NewNodeEatName C.xmlNewNodeEatName -func NewNodeEatName(ns NsPtr, name *Char) NodePtr - -//go:linkname NewChild C.xmlNewChild -func NewChild(parent NodePtr, ns NsPtr, name *Char, content *Char) NodePtr - -// llgo:link (*Doc).NewDocText C.xmlNewDocText -func (recv_ *Doc) NewDocText(content *Char) NodePtr { - return nil -} - -// llgo:link (*Char).NewText C.xmlNewText -func (recv_ *Char) NewText() NodePtr { - return nil -} - -//go:linkname NewDocPI C.xmlNewDocPI -func NewDocPI(doc DocPtr, name *Char, content *Char) NodePtr - -// llgo:link (*Char).NewPI C.xmlNewPI -func (recv_ *Char) NewPI(content *Char) NodePtr { - return nil -} - -//go:linkname NewDocTextLen C.xmlNewDocTextLen -func NewDocTextLen(doc DocPtr, content *Char, len c.Int) NodePtr - -// llgo:link (*Char).NewTextLen C.xmlNewTextLen -func (recv_ *Char) NewTextLen(len c.Int) NodePtr { - return nil -} - -//go:linkname NewDocComment C.xmlNewDocComment -func NewDocComment(doc DocPtr, content *Char) NodePtr - -// llgo:link (*Char).NewComment C.xmlNewComment -func (recv_ *Char) NewComment() NodePtr { - return nil -} - -//go:linkname NewCDataBlock C.xmlNewCDataBlock -func NewCDataBlock(doc DocPtr, content *Char, len c.Int) NodePtr - -//go:linkname NewCharRef C.xmlNewCharRef -func NewCharRef(doc DocPtr, name *Char) NodePtr - -// llgo:link (*Doc).NewReference C.xmlNewReference -func (recv_ *Doc) NewReference(name *Char) NodePtr { - return nil -} - -//go:linkname CopyNode C.xmlCopyNode -func CopyNode(node NodePtr, recursive c.Int) NodePtr - -//go:linkname DocCopyNode C.xmlDocCopyNode -func DocCopyNode(node NodePtr, doc DocPtr, recursive c.Int) NodePtr - -//go:linkname DocCopyNodeList C.xmlDocCopyNodeList -func DocCopyNodeList(doc DocPtr, node NodePtr) NodePtr - -//go:linkname CopyNodeList C.xmlCopyNodeList -func CopyNodeList(node NodePtr) NodePtr - -//go:linkname NewTextChild C.xmlNewTextChild -func NewTextChild(parent NodePtr, ns NsPtr, name *Char, content *Char) NodePtr - -//go:linkname NewDocRawNode C.xmlNewDocRawNode -func NewDocRawNode(doc DocPtr, ns NsPtr, name *Char, content *Char) NodePtr - -//go:linkname NewDocFragment C.xmlNewDocFragment -func NewDocFragment(doc DocPtr) NodePtr - -/* - * Navigating. - */ -// llgo:link (*Node).GetLineNo C.xmlGetLineNo -func (recv_ *Node) GetLineNo() c.Long { - return 0 -} - -// llgo:link (*Node).GetNodePath C.xmlGetNodePath -func (recv_ *Node) GetNodePath() *Char { - return nil -} - -// llgo:link (*Doc).DocGetRootElement C.xmlDocGetRootElement -func (recv_ *Doc) DocGetRootElement() NodePtr { - return nil -} - -// llgo:link (*Node).GetLastChild C.xmlGetLastChild -func (recv_ *Node) GetLastChild() NodePtr { - return nil -} - -// llgo:link (*Node).NodeIsText C.xmlNodeIsText -func (recv_ *Node) NodeIsText() c.Int { - return 0 -} - -// llgo:link (*Node).IsBlankNode C.xmlIsBlankNode -func (recv_ *Node) IsBlankNode() c.Int { - return 0 -} - -/* - * Changing the structure. - */ -//go:linkname DocSetRootElement C.xmlDocSetRootElement -func DocSetRootElement(doc DocPtr, root NodePtr) NodePtr - -//go:linkname NodeSetName C.xmlNodeSetName -func NodeSetName(cur NodePtr, name *Char) - -//go:linkname AddChild C.xmlAddChild -func AddChild(parent NodePtr, cur NodePtr) NodePtr - -//go:linkname AddChildList C.xmlAddChildList -func AddChildList(parent NodePtr, cur NodePtr) NodePtr - -//go:linkname ReplaceNode C.xmlReplaceNode -func ReplaceNode(old NodePtr, cur NodePtr) NodePtr - -//go:linkname AddPrevSibling C.xmlAddPrevSibling -func AddPrevSibling(cur NodePtr, elem NodePtr) NodePtr - -//go:linkname AddSibling C.xmlAddSibling -func AddSibling(cur NodePtr, elem NodePtr) NodePtr - -//go:linkname AddNextSibling C.xmlAddNextSibling -func AddNextSibling(cur NodePtr, elem NodePtr) NodePtr - -//go:linkname UnlinkNode C.xmlUnlinkNode -func UnlinkNode(cur NodePtr) - -//go:linkname TextMerge C.xmlTextMerge -func TextMerge(first NodePtr, second NodePtr) NodePtr - -//go:linkname TextConcat C.xmlTextConcat -func TextConcat(node NodePtr, content *Char, len c.Int) c.Int - -//go:linkname FreeNodeList C.xmlFreeNodeList -func FreeNodeList(cur NodePtr) - -//go:linkname FreeNode C.xmlFreeNode -func FreeNode(cur NodePtr) - -//go:linkname SetTreeDoc C.xmlSetTreeDoc -func SetTreeDoc(tree NodePtr, doc DocPtr) c.Int - -//go:linkname SetListDoc C.xmlSetListDoc -func SetListDoc(list NodePtr, doc DocPtr) c.Int - -/* - * Namespaces. - */ -//go:linkname SearchNs C.xmlSearchNs -func SearchNs(doc DocPtr, node NodePtr, nameSpace *Char) NsPtr - -//go:linkname SearchNsByHref C.xmlSearchNsByHref -func SearchNsByHref(doc DocPtr, node NodePtr, href *Char) NsPtr - -// llgo:link (*Doc).GetNsListSafe C.xmlGetNsListSafe -func (recv_ *Doc) GetNsListSafe(node *Node, out **NsPtr) c.Int { - return 0 -} - -// llgo:link (*Doc).GetNsList C.xmlGetNsList -func (recv_ *Doc) GetNsList(node *Node) *NsPtr { - return nil -} - -//go:linkname SetNs C.xmlSetNs -func SetNs(node NodePtr, ns NsPtr) - -//go:linkname CopyNamespace C.xmlCopyNamespace -func CopyNamespace(cur NsPtr) NsPtr - -//go:linkname CopyNamespaceList C.xmlCopyNamespaceList -func CopyNamespaceList(cur NsPtr) NsPtr - -/* - * Changing the content. - */ -//go:linkname SetProp C.xmlSetProp -func SetProp(node NodePtr, name *Char, value *Char) AttrPtr - -//go:linkname SetNsProp C.xmlSetNsProp -func SetNsProp(node NodePtr, ns NsPtr, name *Char, value *Char) AttrPtr - -// llgo:link (*Node).NodeGetAttrValue C.xmlNodeGetAttrValue -func (recv_ *Node) NodeGetAttrValue(name *Char, nsUri *Char, out **Char) c.Int { - return 0 -} - -// llgo:link (*Node).GetNoNsProp C.xmlGetNoNsProp -func (recv_ *Node) GetNoNsProp(name *Char) *Char { - return nil -} - -// llgo:link (*Node).GetProp C.xmlGetProp -func (recv_ *Node) GetProp(name *Char) *Char { - return nil -} - -// llgo:link (*Node).HasProp C.xmlHasProp -func (recv_ *Node) HasProp(name *Char) AttrPtr { - return nil -} - -// llgo:link (*Node).HasNsProp C.xmlHasNsProp -func (recv_ *Node) HasNsProp(name *Char, nameSpace *Char) AttrPtr { - return nil -} - -// llgo:link (*Node).GetNsProp C.xmlGetNsProp -func (recv_ *Node) GetNsProp(name *Char, nameSpace *Char) *Char { - return nil -} - -// llgo:link (*Doc).StringGetNodeList C.xmlStringGetNodeList -func (recv_ *Doc) StringGetNodeList(value *Char) NodePtr { - return nil -} - -// llgo:link (*Doc).StringLenGetNodeList C.xmlStringLenGetNodeList -func (recv_ *Doc) StringLenGetNodeList(value *Char, len c.Int) NodePtr { - return nil -} - -//go:linkname NodeListGetString C.xmlNodeListGetString -func NodeListGetString(doc DocPtr, list *Node, inLine c.Int) *Char - -// llgo:link (*Doc).NodeListGetRawString C.xmlNodeListGetRawString -func (recv_ *Doc) NodeListGetRawString(list *Node, inLine c.Int) *Char { - return nil -} - -//go:linkname NodeSetContent C.xmlNodeSetContent -func NodeSetContent(cur NodePtr, content *Char) c.Int - -//go:linkname NodeSetContentLen C.xmlNodeSetContentLen -func NodeSetContentLen(cur NodePtr, content *Char, len c.Int) c.Int - -//go:linkname NodeAddContent C.xmlNodeAddContent -func NodeAddContent(cur NodePtr, content *Char) c.Int - -//go:linkname NodeAddContentLen C.xmlNodeAddContentLen -func NodeAddContentLen(cur NodePtr, content *Char, len c.Int) c.Int - -// llgo:link (*Node).NodeGetContent C.xmlNodeGetContent -func (recv_ *Node) NodeGetContent() *Char { - return nil -} - -//go:linkname NodeBufGetContent C.xmlNodeBufGetContent -func NodeBufGetContent(buffer BufferPtr, cur *Node) c.Int - -//go:linkname BufGetNodeContent C.xmlBufGetNodeContent -func BufGetNodeContent(buf BufPtr, cur *Node) c.Int - -// llgo:link (*Node).NodeGetLang C.xmlNodeGetLang -func (recv_ *Node) NodeGetLang() *Char { - return nil -} - -// llgo:link (*Node).NodeGetSpacePreserve C.xmlNodeGetSpacePreserve -func (recv_ *Node) NodeGetSpacePreserve() c.Int { - return 0 -} - -//go:linkname NodeSetLang C.xmlNodeSetLang -func NodeSetLang(cur NodePtr, lang *Char) c.Int - -//go:linkname NodeSetSpacePreserve C.xmlNodeSetSpacePreserve -func NodeSetSpacePreserve(cur NodePtr, val c.Int) c.Int - -// llgo:link (*Doc).NodeGetBaseSafe C.xmlNodeGetBaseSafe -func (recv_ *Doc) NodeGetBaseSafe(cur *Node, baseOut **Char) c.Int { - return 0 -} - -// llgo:link (*Doc).NodeGetBase C.xmlNodeGetBase -func (recv_ *Doc) NodeGetBase(cur *Node) *Char { - return nil -} - -//go:linkname NodeSetBase C.xmlNodeSetBase -func NodeSetBase(cur NodePtr, uri *Char) c.Int - -/* - * Removing content. - */ -//go:linkname RemoveProp C.xmlRemoveProp -func RemoveProp(cur AttrPtr) c.Int - -//go:linkname UnsetNsProp C.xmlUnsetNsProp -func UnsetNsProp(node NodePtr, ns NsPtr, name *Char) c.Int - -//go:linkname UnsetProp C.xmlUnsetProp -func UnsetProp(node NodePtr, name *Char) c.Int - -/* - * Internal, don't use. - */ -//go:linkname BufferWriteCHAR C.xmlBufferWriteCHAR -func BufferWriteCHAR(buf BufferPtr, string *Char) - -//go:linkname BufferWriteChar C.xmlBufferWriteChar -func BufferWriteChar(buf BufferPtr, string *c.Char) - -//go:linkname BufferWriteQuotedString C.xmlBufferWriteQuotedString -func BufferWriteQuotedString(buf BufferPtr, string *Char) - -//go:linkname AttrSerializeTxtContent C.xmlAttrSerializeTxtContent -func AttrSerializeTxtContent(buf BufferPtr, doc DocPtr, attr AttrPtr, string *Char) - -/* - * Namespace handling. - */ -//go:linkname ReconciliateNs C.xmlReconciliateNs -func ReconciliateNs(doc DocPtr, tree NodePtr) c.Int - -/* - * Saving. - */ -//go:linkname DocDumpFormatMemory C.xmlDocDumpFormatMemory -func DocDumpFormatMemory(cur DocPtr, mem **Char, size *c.Int, format c.Int) - -//go:linkname DocDumpMemory C.xmlDocDumpMemory -func DocDumpMemory(cur DocPtr, mem **Char, size *c.Int) - -//go:linkname DocDumpMemoryEnc C.xmlDocDumpMemoryEnc -func DocDumpMemoryEnc(out_doc DocPtr, doc_txt_ptr **Char, doc_txt_len *c.Int, txt_encoding *c.Char) - -//go:linkname DocDumpFormatMemoryEnc C.xmlDocDumpFormatMemoryEnc -func DocDumpFormatMemoryEnc(out_doc DocPtr, doc_txt_ptr **Char, doc_txt_len *c.Int, txt_encoding *c.Char, format c.Int) - -//go:linkname DocFormatDump C.xmlDocFormatDump -func DocFormatDump(f *c.FILE, cur DocPtr, format c.Int) c.Int - -//go:linkname DocDump C.xmlDocDump -func DocDump(f *c.FILE, cur DocPtr) c.Int - -//go:linkname ElemDump C.xmlElemDump -func ElemDump(f *c.FILE, doc DocPtr, cur NodePtr) - -//go:linkname SaveFile C.xmlSaveFile -func SaveFile(filename *c.Char, cur DocPtr) c.Int - -//go:linkname SaveFormatFile C.xmlSaveFormatFile -func SaveFormatFile(filename *c.Char, cur DocPtr, format c.Int) c.Int - -//go:linkname BufNodeDump C.xmlBufNodeDump -func BufNodeDump(buf BufPtr, doc DocPtr, cur NodePtr, level c.Int, format c.Int) c.SizeT - -//go:linkname NodeDump C.xmlNodeDump -func NodeDump(buf BufferPtr, doc DocPtr, cur NodePtr, level c.Int, format c.Int) c.Int - -//go:linkname SaveFileTo C.xmlSaveFileTo -func SaveFileTo(buf OutputBufferPtr, cur DocPtr, encoding *c.Char) c.Int - -//go:linkname SaveFormatFileTo C.xmlSaveFormatFileTo -func SaveFormatFileTo(buf OutputBufferPtr, cur DocPtr, encoding *c.Char, format c.Int) c.Int - -//go:linkname NodeDumpOutput C.xmlNodeDumpOutput -func NodeDumpOutput(buf OutputBufferPtr, doc DocPtr, cur NodePtr, level c.Int, format c.Int, encoding *c.Char) - -//go:linkname SaveFormatFileEnc C.xmlSaveFormatFileEnc -func SaveFormatFileEnc(filename *c.Char, cur DocPtr, encoding *c.Char, format c.Int) c.Int - -//go:linkname SaveFileEnc C.xmlSaveFileEnc -func SaveFileEnc(filename *c.Char, cur DocPtr, encoding *c.Char) c.Int - -/* - * XHTML - */ -// llgo:link (*Char).IsXHTML C.xmlIsXHTML -func (recv_ *Char) IsXHTML(publicID *Char) c.Int { - return 0 -} - -/* - * Compression. - */ -// llgo:link (*Doc).GetDocCompressMode C.xmlGetDocCompressMode -func (recv_ *Doc) GetDocCompressMode() c.Int { - return 0 -} - -//go:linkname SetDocCompressMode C.xmlSetDocCompressMode -func SetDocCompressMode(doc DocPtr, mode c.Int) - -//go:linkname GetCompressMode C.xmlGetCompressMode -func GetCompressMode() c.Int - -//go:linkname SetCompressMode C.xmlSetCompressMode -func SetCompressMode(mode c.Int) - -/* -* DOM-wrapper helper functions. - */ -//go:linkname DOMWrapNewCtxt C.xmlDOMWrapNewCtxt -func DOMWrapNewCtxt() DOMWrapCtxtPtr - -//go:linkname DOMWrapFreeCtxt C.xmlDOMWrapFreeCtxt -func DOMWrapFreeCtxt(ctxt DOMWrapCtxtPtr) - -//go:linkname DOMWrapReconcileNamespaces C.xmlDOMWrapReconcileNamespaces -func DOMWrapReconcileNamespaces(ctxt DOMWrapCtxtPtr, elem NodePtr, options c.Int) c.Int - -//go:linkname DOMWrapAdoptNode C.xmlDOMWrapAdoptNode -func DOMWrapAdoptNode(ctxt DOMWrapCtxtPtr, sourceDoc DocPtr, node NodePtr, destDoc DocPtr, destParent NodePtr, options c.Int) c.Int - -//go:linkname DOMWrapRemoveNode C.xmlDOMWrapRemoveNode -func DOMWrapRemoveNode(ctxt DOMWrapCtxtPtr, doc DocPtr, node NodePtr, options c.Int) c.Int - -//go:linkname DOMWrapCloneNode C.xmlDOMWrapCloneNode -func DOMWrapCloneNode(ctxt DOMWrapCtxtPtr, sourceDoc DocPtr, node NodePtr, clonedNode *NodePtr, destDoc DocPtr, destParent NodePtr, deep c.Int, options c.Int) c.Int - -/* - * 5 interfaces from DOM ElementTraversal, but different in entities - * traversal. - */ -//go:linkname ChildElementCount C.xmlChildElementCount -func ChildElementCount(parent NodePtr) c.Ulong - -//go:linkname NextElementSibling C.xmlNextElementSibling -func NextElementSibling(node NodePtr) NodePtr - -//go:linkname FirstElementChild C.xmlFirstElementChild -func FirstElementChild(parent NodePtr) NodePtr - -//go:linkname LastElementChild C.xmlLastElementChild -func LastElementChild(parent NodePtr) NodePtr - -//go:linkname PreviousElementSibling C.xmlPreviousElementSibling -func PreviousElementSibling(node NodePtr) NodePtr - -//go:linkname RegisterNodeDefault C.xmlRegisterNodeDefault -func RegisterNodeDefault(func_ RegisterNodeFunc) RegisterNodeFunc - -//go:linkname DeregisterNodeDefault C.xmlDeregisterNodeDefault -func DeregisterNodeDefault(func_ DeregisterNodeFunc) DeregisterNodeFunc - -//go:linkname ThrDefRegisterNodeDefault C.xmlThrDefRegisterNodeDefault -func ThrDefRegisterNodeDefault(func_ RegisterNodeFunc) RegisterNodeFunc - -//go:linkname ThrDefDeregisterNodeDefault C.xmlThrDefDeregisterNodeDefault -func ThrDefDeregisterNodeDefault(func_ DeregisterNodeFunc) DeregisterNodeFunc - -// llgo:link BufferAllocationScheme.ThrDefBufferAllocScheme C.xmlThrDefBufferAllocScheme -func (recv_ BufferAllocationScheme) ThrDefBufferAllocScheme() BufferAllocationScheme { - return 0 -} - -//go:linkname ThrDefDefaultBufferSize C.xmlThrDefDefaultBufferSize -func ThrDefDefaultBufferSize(v c.Int) c.Int diff --git a/libxml2/uri.go b/libxml2/uri.go deleted file mode 100644 index 39c06856..00000000 --- a/libxml2/uri.go +++ /dev/null @@ -1,97 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlURI struct { - Scheme *c.Char - Opaque *c.Char - Authority *c.Char - Server *c.Char - User *c.Char - Port c.Int - Path *c.Char - Query *c.Char - Fragment *c.Char - Cleanup c.Int - QueryRaw *c.Char -} -type URI X_xmlURI -type URIPtr *URI - -/* - * This function is in tree.h: - * xmlChar * xmlNodeGetBase (xmlDocPtr doc, - * xmlNodePtr cur); - */ -//go:linkname CreateURI C.xmlCreateURI -func CreateURI() URIPtr - -// llgo:link (*Char).BuildURISafe C.xmlBuildURISafe -func (recv_ *Char) BuildURISafe(base *Char, out **Char) c.Int { - return 0 -} - -// llgo:link (*Char).BuildURI C.xmlBuildURI -func (recv_ *Char) BuildURI(base *Char) *Char { - return nil -} - -// llgo:link (*Char).BuildRelativeURISafe C.xmlBuildRelativeURISafe -func (recv_ *Char) BuildRelativeURISafe(base *Char, out **Char) c.Int { - return 0 -} - -// llgo:link (*Char).BuildRelativeURI C.xmlBuildRelativeURI -func (recv_ *Char) BuildRelativeURI(base *Char) *Char { - return nil -} - -//go:linkname ParseURI C.xmlParseURI -func ParseURI(str *c.Char) URIPtr - -//go:linkname ParseURISafe C.xmlParseURISafe -func ParseURISafe(str *c.Char, uri *URIPtr) c.Int - -//go:linkname ParseURIRaw C.xmlParseURIRaw -func ParseURIRaw(str *c.Char, raw c.Int) URIPtr - -//go:linkname ParseURIReference C.xmlParseURIReference -func ParseURIReference(uri URIPtr, str *c.Char) c.Int - -//go:linkname SaveUri C.xmlSaveUri -func SaveUri(uri URIPtr) *Char - -//go:linkname PrintURI C.xmlPrintURI -func PrintURI(stream *c.FILE, uri URIPtr) - -// llgo:link (*Char).URIEscapeStr C.xmlURIEscapeStr -func (recv_ *Char) URIEscapeStr(list *Char) *Char { - return nil -} - -//go:linkname URIUnescapeString C.xmlURIUnescapeString -func URIUnescapeString(str *c.Char, len c.Int, target *c.Char) *c.Char - -//go:linkname NormalizeURIPath C.xmlNormalizeURIPath -func NormalizeURIPath(path *c.Char) c.Int - -// llgo:link (*Char).URIEscape C.xmlURIEscape -func (recv_ *Char) URIEscape() *Char { - return nil -} - -//go:linkname FreeURI C.xmlFreeURI -func FreeURI(uri URIPtr) - -// llgo:link (*Char).CanonicPath C.xmlCanonicPath -func (recv_ *Char) CanonicPath() *Char { - return nil -} - -// llgo:link (*Char).PathToURI C.xmlPathToURI -func (recv_ *Char) PathToURI() *Char { - return nil -} diff --git a/libxml2/valid.go b/libxml2/valid.go deleted file mode 100644 index 2ca85a79..00000000 --- a/libxml2/valid.go +++ /dev/null @@ -1,294 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlValidState struct { - Unused [8]uint8 -} -type ValidState X_xmlValidState -type ValidStatePtr *ValidState - -// llgo:type C -type ValidityErrorFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type ValidityWarningFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -type X_xmlValidCtxt struct { - UserData c.Pointer - Error ValidityErrorFunc - Warning ValidityWarningFunc - Node NodePtr - NodeNr c.Int - NodeMax c.Int - NodeTab *NodePtr - Flags c.Uint - Doc DocPtr - Valid c.Int - Vstate *ValidState - VstateNr c.Int - VstateMax c.Int - VstateTab *ValidState - Am AutomataPtr - State AutomataStatePtr -} -type ValidCtxt X_xmlValidCtxt -type ValidCtxtPtr *ValidCtxt -type NotationTable X_xmlHashTable -type NotationTablePtr *NotationTable -type ElementTable X_xmlHashTable -type ElementTablePtr *ElementTable -type AttributeTable X_xmlHashTable -type AttributeTablePtr *AttributeTable -type IDTable X_xmlHashTable -type IDTablePtr *IDTable -type RefTable X_xmlHashTable -type RefTablePtr *RefTable - -/* Notation */ -//go:linkname AddNotationDecl C.xmlAddNotationDecl -func AddNotationDecl(ctxt ValidCtxtPtr, dtd DtdPtr, name *Char, PublicID *Char, SystemID *Char) NotationPtr - -//go:linkname CopyNotationTable C.xmlCopyNotationTable -func CopyNotationTable(table NotationTablePtr) NotationTablePtr - -//go:linkname FreeNotationTable C.xmlFreeNotationTable -func FreeNotationTable(table NotationTablePtr) - -//go:linkname DumpNotationDecl C.xmlDumpNotationDecl -func DumpNotationDecl(buf BufferPtr, nota NotationPtr) - -/* XML_DEPRECATED, still used in lxml */ -//go:linkname DumpNotationTable C.xmlDumpNotationTable -func DumpNotationTable(buf BufferPtr, table NotationTablePtr) - -/* Element Content */ -/* the non Doc version are being deprecated */ -// llgo:link (*Char).NewElementContent C.xmlNewElementContent -func (recv_ *Char) NewElementContent(type_ ElementContentType) ElementContentPtr { - return nil -} - -//go:linkname CopyElementContent C.xmlCopyElementContent -func CopyElementContent(content ElementContentPtr) ElementContentPtr - -//go:linkname FreeElementContent C.xmlFreeElementContent -func FreeElementContent(cur ElementContentPtr) - -/* the new versions with doc argument */ -//go:linkname NewDocElementContent C.xmlNewDocElementContent -func NewDocElementContent(doc DocPtr, name *Char, type_ ElementContentType) ElementContentPtr - -//go:linkname CopyDocElementContent C.xmlCopyDocElementContent -func CopyDocElementContent(doc DocPtr, content ElementContentPtr) ElementContentPtr - -//go:linkname FreeDocElementContent C.xmlFreeDocElementContent -func FreeDocElementContent(doc DocPtr, cur ElementContentPtr) - -//go:linkname SnprintfElementContent C.xmlSnprintfElementContent -func SnprintfElementContent(buf *c.Char, size c.Int, content ElementContentPtr, englob c.Int) - -//go:linkname SprintfElementContent C.xmlSprintfElementContent -func SprintfElementContent(buf *c.Char, content ElementContentPtr, englob c.Int) - -/* Element */ -//go:linkname AddElementDecl C.xmlAddElementDecl -func AddElementDecl(ctxt ValidCtxtPtr, dtd DtdPtr, name *Char, type_ ElementTypeVal, content ElementContentPtr) ElementPtr - -//go:linkname CopyElementTable C.xmlCopyElementTable -func CopyElementTable(table ElementTablePtr) ElementTablePtr - -//go:linkname FreeElementTable C.xmlFreeElementTable -func FreeElementTable(table ElementTablePtr) - -//go:linkname DumpElementTable C.xmlDumpElementTable -func DumpElementTable(buf BufferPtr, table ElementTablePtr) - -//go:linkname DumpElementDecl C.xmlDumpElementDecl -func DumpElementDecl(buf BufferPtr, elem ElementPtr) - -/* Enumeration */ -// llgo:link (*Char).CreateEnumeration C.xmlCreateEnumeration -func (recv_ *Char) CreateEnumeration() EnumerationPtr { - return nil -} - -//go:linkname FreeEnumeration C.xmlFreeEnumeration -func FreeEnumeration(cur EnumerationPtr) - -//go:linkname CopyEnumeration C.xmlCopyEnumeration -func CopyEnumeration(cur EnumerationPtr) EnumerationPtr - -/* Attribute */ -//go:linkname AddAttributeDecl C.xmlAddAttributeDecl -func AddAttributeDecl(ctxt ValidCtxtPtr, dtd DtdPtr, elem *Char, name *Char, ns *Char, type_ AttributeType, def AttributeDefault, defaultValue *Char, tree EnumerationPtr) AttributePtr - -//go:linkname CopyAttributeTable C.xmlCopyAttributeTable -func CopyAttributeTable(table AttributeTablePtr) AttributeTablePtr - -//go:linkname FreeAttributeTable C.xmlFreeAttributeTable -func FreeAttributeTable(table AttributeTablePtr) - -//go:linkname DumpAttributeTable C.xmlDumpAttributeTable -func DumpAttributeTable(buf BufferPtr, table AttributeTablePtr) - -//go:linkname DumpAttributeDecl C.xmlDumpAttributeDecl -func DumpAttributeDecl(buf BufferPtr, attr AttributePtr) - -/* IDs */ -//go:linkname AddIDSafe C.xmlAddIDSafe -func AddIDSafe(attr AttrPtr, value *Char) c.Int - -//go:linkname AddID C.xmlAddID -func AddID(ctxt ValidCtxtPtr, doc DocPtr, value *Char, attr AttrPtr) IDPtr - -//go:linkname FreeIDTable C.xmlFreeIDTable -func FreeIDTable(table IDTablePtr) - -//go:linkname GetID C.xmlGetID -func GetID(doc DocPtr, ID *Char) AttrPtr - -//go:linkname IsID C.xmlIsID -func IsID(doc DocPtr, elem NodePtr, attr AttrPtr) c.Int - -//go:linkname RemoveID C.xmlRemoveID -func RemoveID(doc DocPtr, attr AttrPtr) c.Int - -/* IDREFs */ -//go:linkname AddRef C.xmlAddRef -func AddRef(ctxt ValidCtxtPtr, doc DocPtr, value *Char, attr AttrPtr) RefPtr - -//go:linkname FreeRefTable C.xmlFreeRefTable -func FreeRefTable(table RefTablePtr) - -//go:linkname IsRef C.xmlIsRef -func IsRef(doc DocPtr, elem NodePtr, attr AttrPtr) c.Int - -//go:linkname RemoveRef C.xmlRemoveRef -func RemoveRef(doc DocPtr, attr AttrPtr) c.Int - -//go:linkname GetRefs C.xmlGetRefs -func GetRefs(doc DocPtr, ID *Char) ListPtr - -/* Allocate/Release Validation Contexts */ -//go:linkname NewValidCtxt C.xmlNewValidCtxt -func NewValidCtxt() ValidCtxtPtr - -//go:linkname FreeValidCtxt C.xmlFreeValidCtxt -func FreeValidCtxt(ValidCtxtPtr) - -//go:linkname ValidateRoot C.xmlValidateRoot -func ValidateRoot(ctxt ValidCtxtPtr, doc DocPtr) c.Int - -//go:linkname ValidateElementDecl C.xmlValidateElementDecl -func ValidateElementDecl(ctxt ValidCtxtPtr, doc DocPtr, elem ElementPtr) c.Int - -//go:linkname ValidNormalizeAttributeValue C.xmlValidNormalizeAttributeValue -func ValidNormalizeAttributeValue(doc DocPtr, elem NodePtr, name *Char, value *Char) *Char - -//go:linkname ValidCtxtNormalizeAttributeValue C.xmlValidCtxtNormalizeAttributeValue -func ValidCtxtNormalizeAttributeValue(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr, name *Char, value *Char) *Char - -//go:linkname ValidateAttributeDecl C.xmlValidateAttributeDecl -func ValidateAttributeDecl(ctxt ValidCtxtPtr, doc DocPtr, attr AttributePtr) c.Int - -// llgo:link AttributeType.ValidateAttributeValue C.xmlValidateAttributeValue -func (recv_ AttributeType) ValidateAttributeValue(value *Char) c.Int { - return 0 -} - -//go:linkname ValidateNotationDecl C.xmlValidateNotationDecl -func ValidateNotationDecl(ctxt ValidCtxtPtr, doc DocPtr, nota NotationPtr) c.Int - -//go:linkname ValidateDtd C.xmlValidateDtd -func ValidateDtd(ctxt ValidCtxtPtr, doc DocPtr, dtd DtdPtr) c.Int - -//go:linkname ValidateDtdFinal C.xmlValidateDtdFinal -func ValidateDtdFinal(ctxt ValidCtxtPtr, doc DocPtr) c.Int - -//go:linkname ValidateDocument C.xmlValidateDocument -func ValidateDocument(ctxt ValidCtxtPtr, doc DocPtr) c.Int - -//go:linkname ValidateElement C.xmlValidateElement -func ValidateElement(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr) c.Int - -//go:linkname ValidateOneElement C.xmlValidateOneElement -func ValidateOneElement(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr) c.Int - -//go:linkname ValidateOneAttribute C.xmlValidateOneAttribute -func ValidateOneAttribute(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr, attr AttrPtr, value *Char) c.Int - -//go:linkname ValidateOneNamespace C.xmlValidateOneNamespace -func ValidateOneNamespace(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr, prefix *Char, ns NsPtr, value *Char) c.Int - -//go:linkname ValidateDocumentFinal C.xmlValidateDocumentFinal -func ValidateDocumentFinal(ctxt ValidCtxtPtr, doc DocPtr) c.Int - -//go:linkname ValidateNotationUse C.xmlValidateNotationUse -func ValidateNotationUse(ctxt ValidCtxtPtr, doc DocPtr, notationName *Char) c.Int - -//go:linkname IsMixedElement C.xmlIsMixedElement -func IsMixedElement(doc DocPtr, name *Char) c.Int - -//go:linkname GetDtdAttrDesc C.xmlGetDtdAttrDesc -func GetDtdAttrDesc(dtd DtdPtr, elem *Char, name *Char) AttributePtr - -//go:linkname GetDtdQAttrDesc C.xmlGetDtdQAttrDesc -func GetDtdQAttrDesc(dtd DtdPtr, elem *Char, name *Char, prefix *Char) AttributePtr - -//go:linkname GetDtdNotationDesc C.xmlGetDtdNotationDesc -func GetDtdNotationDesc(dtd DtdPtr, name *Char) NotationPtr - -//go:linkname GetDtdQElementDesc C.xmlGetDtdQElementDesc -func GetDtdQElementDesc(dtd DtdPtr, name *Char, prefix *Char) ElementPtr - -//go:linkname GetDtdElementDesc C.xmlGetDtdElementDesc -func GetDtdElementDesc(dtd DtdPtr, name *Char) ElementPtr - -// llgo:link (*ElementContent).ValidGetPotentialChildren C.xmlValidGetPotentialChildren -func (recv_ *ElementContent) ValidGetPotentialChildren(names **Char, len *c.Int, max c.Int) c.Int { - return 0 -} - -// llgo:link (*Node).ValidGetValidElements C.xmlValidGetValidElements -func (recv_ *Node) ValidGetValidElements(next *Node, names **Char, max c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).ValidateNameValue C.xmlValidateNameValue -func (recv_ *Char) ValidateNameValue() c.Int { - return 0 -} - -// llgo:link (*Char).ValidateNamesValue C.xmlValidateNamesValue -func (recv_ *Char) ValidateNamesValue() c.Int { - return 0 -} - -// llgo:link (*Char).ValidateNmtokenValue C.xmlValidateNmtokenValue -func (recv_ *Char) ValidateNmtokenValue() c.Int { - return 0 -} - -// llgo:link (*Char).ValidateNmtokensValue C.xmlValidateNmtokensValue -func (recv_ *Char) ValidateNmtokensValue() c.Int { - return 0 -} - -/* - * Validation based on the regexp support - */ -//go:linkname ValidBuildContentModel C.xmlValidBuildContentModel -func ValidBuildContentModel(ctxt ValidCtxtPtr, elem ElementPtr) c.Int - -//go:linkname ValidatePushElement C.xmlValidatePushElement -func ValidatePushElement(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr, qname *Char) c.Int - -//go:linkname ValidatePushCData C.xmlValidatePushCData -func ValidatePushCData(ctxt ValidCtxtPtr, data *Char, len c.Int) c.Int - -//go:linkname ValidatePopElement C.xmlValidatePopElement -func ValidatePopElement(ctxt ValidCtxtPtr, doc DocPtr, elem NodePtr, qname *Char) c.Int diff --git a/libxml2/xinclude.go b/libxml2/xinclude.go deleted file mode 100644 index fa7a014f..00000000 --- a/libxml2/xinclude.go +++ /dev/null @@ -1,54 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlXIncludeCtxt struct { - Unused [8]uint8 -} -type XIncludeCtxt X_xmlXIncludeCtxt -type XIncludeCtxtPtr *XIncludeCtxt - -/* - * standalone processing - */ -//go:linkname XIncludeProcess C.xmlXIncludeProcess -func XIncludeProcess(doc DocPtr) c.Int - -//go:linkname XIncludeProcessFlags C.xmlXIncludeProcessFlags -func XIncludeProcessFlags(doc DocPtr, flags c.Int) c.Int - -//go:linkname XIncludeProcessFlagsData C.xmlXIncludeProcessFlagsData -func XIncludeProcessFlagsData(doc DocPtr, flags c.Int, data c.Pointer) c.Int - -//go:linkname XIncludeProcessTreeFlagsData C.xmlXIncludeProcessTreeFlagsData -func XIncludeProcessTreeFlagsData(tree NodePtr, flags c.Int, data c.Pointer) c.Int - -//go:linkname XIncludeProcessTree C.xmlXIncludeProcessTree -func XIncludeProcessTree(tree NodePtr) c.Int - -//go:linkname XIncludeProcessTreeFlags C.xmlXIncludeProcessTreeFlags -func XIncludeProcessTreeFlags(tree NodePtr, flags c.Int) c.Int - -/* - * contextual processing - */ -//go:linkname XIncludeNewContext C.xmlXIncludeNewContext -func XIncludeNewContext(doc DocPtr) XIncludeCtxtPtr - -//go:linkname XIncludeSetFlags C.xmlXIncludeSetFlags -func XIncludeSetFlags(ctxt XIncludeCtxtPtr, flags c.Int) c.Int - -//go:linkname XIncludeSetErrorHandler C.xmlXIncludeSetErrorHandler -func XIncludeSetErrorHandler(ctxt XIncludeCtxtPtr, handler StructuredErrorFunc, data c.Pointer) - -//go:linkname XIncludeGetLastError C.xmlXIncludeGetLastError -func XIncludeGetLastError(ctxt XIncludeCtxtPtr) c.Int - -//go:linkname XIncludeFreeContext C.xmlXIncludeFreeContext -func XIncludeFreeContext(ctxt XIncludeCtxtPtr) - -//go:linkname XIncludeProcessNode C.xmlXIncludeProcessNode -func XIncludeProcessNode(ctxt XIncludeCtxtPtr, tree NodePtr) c.Int diff --git a/libxml2/xlink.go b/libxml2/xlink.go deleted file mode 100644 index 638fc3d5..00000000 --- a/libxml2/xlink.go +++ /dev/null @@ -1,80 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type XlinkHRef *Char -type XlinkRole *Char -type XlinkTitle *Char -type XlinkType c.Int - -const ( - XLINK_TYPE_NONE XlinkType = 0 - XLINK_TYPE_SIMPLE XlinkType = 1 - XLINK_TYPE_EXTENDED XlinkType = 2 - XLINK_TYPE_EXTENDED_SET XlinkType = 3 -) - -type XlinkShow c.Int - -const ( - XLINK_SHOW_NONE XlinkShow = 0 - XLINK_SHOW_NEW XlinkShow = 1 - XLINK_SHOW_EMBED XlinkShow = 2 - XLINK_SHOW_REPLACE XlinkShow = 3 -) - -type XlinkActuate c.Int - -const ( - XLINK_ACTUATE_NONE XlinkActuate = 0 - XLINK_ACTUATE_AUTO XlinkActuate = 1 - XLINK_ACTUATE_ONREQUEST XlinkActuate = 2 -) - -// llgo:type C -type XlinkNodeDetectFunc func(c.Pointer, NodePtr) - -// llgo:type C -type XlinkSimpleLinkFunk func(c.Pointer, NodePtr, XlinkHRef, XlinkRole, XlinkTitle) - -// llgo:type C -type XlinkExtendedLinkFunk func(c.Pointer, NodePtr, c.Int, *XlinkHRef, *XlinkRole, c.Int, *XlinkRole, *XlinkRole, *XlinkShow, *XlinkActuate, c.Int, *XlinkTitle, **Char) - -// llgo:type C -type XlinkExtendedLinkSetFunk func(c.Pointer, NodePtr, c.Int, *XlinkHRef, *XlinkRole, c.Int, *XlinkTitle, **Char) - -type X_xlinkHandler struct { - Simple XlinkSimpleLinkFunk - Extended XlinkExtendedLinkFunk - Set XlinkExtendedLinkSetFunk -} -type XlinkHandler X_xlinkHandler -type XlinkHandlerPtr *XlinkHandler - -/* - * The default detection routine, can be overridden, they call the default - * detection callbacks. - */ -//go:linkname XlinkGetDefaultDetect C.xlinkGetDefaultDetect -func XlinkGetDefaultDetect() XlinkNodeDetectFunc - -//go:linkname XlinkSetDefaultDetect C.xlinkSetDefaultDetect -func XlinkSetDefaultDetect(func_ XlinkNodeDetectFunc) - -/* - * Routines to set/get the default handlers. - */ -//go:linkname XlinkGetDefaultHandler C.xlinkGetDefaultHandler -func XlinkGetDefaultHandler() XlinkHandlerPtr - -//go:linkname XlinkSetDefaultHandler C.xlinkSetDefaultHandler -func XlinkSetDefaultHandler(handler XlinkHandlerPtr) - -/* - * Link detection module itself. - */ -//go:linkname XlinkIsLink C.xlinkIsLink -func XlinkIsLink(doc DocPtr, node NodePtr) XlinkType diff --git a/libxml2/xmlIO.go b/libxml2/xmlIO.go deleted file mode 100644 index 3d392e78..00000000 --- a/libxml2/xmlIO.go +++ /dev/null @@ -1,237 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// llgo:type C -type InputMatchCallback func(*c.Char) c.Int - -// llgo:type C -type InputOpenCallback func(*c.Char) c.Pointer - -// llgo:type C -type InputReadCallback func(c.Pointer, *c.Char, c.Int) c.Int - -// llgo:type C -type InputCloseCallback func(c.Pointer) c.Int - -// llgo:type C -type OutputMatchCallback func(*c.Char) c.Int - -// llgo:type C -type OutputOpenCallback func(*c.Char) c.Pointer - -// llgo:type C -type OutputWriteCallback func(c.Pointer, *c.Char, c.Int) c.Int - -// llgo:type C -type OutputCloseCallback func(c.Pointer) c.Int - -// llgo:type C -type ParserInputBufferCreateFilenameFunc func(*c.Char, CharEncoding) ParserInputBufferPtr - -// llgo:type C -type OutputBufferCreateFilenameFunc func(*c.Char, CharEncodingHandlerPtr, c.Int) OutputBufferPtr - -//go:linkname X__xmlParserInputBufferCreateFilenameValue C.__xmlParserInputBufferCreateFilenameValue -func X__xmlParserInputBufferCreateFilenameValue() ParserInputBufferCreateFilenameFunc - -//go:linkname X__xmlOutputBufferCreateFilenameValue C.__xmlOutputBufferCreateFilenameValue -func X__xmlOutputBufferCreateFilenameValue() OutputBufferCreateFilenameFunc - -/* - * Interfaces for input - */ -//go:linkname CleanupInputCallbacks C.xmlCleanupInputCallbacks -func CleanupInputCallbacks() - -//go:linkname PopInputCallbacks C.xmlPopInputCallbacks -func PopInputCallbacks() c.Int - -//go:linkname RegisterDefaultInputCallbacks C.xmlRegisterDefaultInputCallbacks -func RegisterDefaultInputCallbacks() - -// llgo:link CharEncoding.AllocParserInputBuffer C.xmlAllocParserInputBuffer -func (recv_ CharEncoding) AllocParserInputBuffer() ParserInputBufferPtr { - return nil -} - -//go:linkname ParserInputBufferCreateFilename C.xmlParserInputBufferCreateFilename -func ParserInputBufferCreateFilename(URI *c.Char, enc CharEncoding) ParserInputBufferPtr - -//go:linkname ParserInputBufferCreateFile C.xmlParserInputBufferCreateFile -func ParserInputBufferCreateFile(file *c.FILE, enc CharEncoding) ParserInputBufferPtr - -//go:linkname ParserInputBufferCreateFd C.xmlParserInputBufferCreateFd -func ParserInputBufferCreateFd(fd c.Int, enc CharEncoding) ParserInputBufferPtr - -//go:linkname ParserInputBufferCreateMem C.xmlParserInputBufferCreateMem -func ParserInputBufferCreateMem(mem *c.Char, size c.Int, enc CharEncoding) ParserInputBufferPtr - -//go:linkname ParserInputBufferCreateStatic C.xmlParserInputBufferCreateStatic -func ParserInputBufferCreateStatic(mem *c.Char, size c.Int, enc CharEncoding) ParserInputBufferPtr - -//go:linkname ParserInputBufferCreateIO C.xmlParserInputBufferCreateIO -func ParserInputBufferCreateIO(ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, enc CharEncoding) ParserInputBufferPtr - -//go:linkname ParserInputBufferRead C.xmlParserInputBufferRead -func ParserInputBufferRead(in ParserInputBufferPtr, len c.Int) c.Int - -//go:linkname ParserInputBufferGrow C.xmlParserInputBufferGrow -func ParserInputBufferGrow(in ParserInputBufferPtr, len c.Int) c.Int - -//go:linkname ParserInputBufferPush C.xmlParserInputBufferPush -func ParserInputBufferPush(in ParserInputBufferPtr, len c.Int, buf *c.Char) c.Int - -//go:linkname FreeParserInputBuffer C.xmlFreeParserInputBuffer -func FreeParserInputBuffer(in ParserInputBufferPtr) - -//go:linkname ParserGetDirectory C.xmlParserGetDirectory -func ParserGetDirectory(filename *c.Char) *c.Char - -//go:linkname RegisterInputCallbacks C.xmlRegisterInputCallbacks -func RegisterInputCallbacks(matchFunc InputMatchCallback, openFunc InputOpenCallback, readFunc InputReadCallback, closeFunc InputCloseCallback) c.Int - -//go:linkname X__xmlParserInputBufferCreateFilename C.__xmlParserInputBufferCreateFilename -func X__xmlParserInputBufferCreateFilename(URI *c.Char, enc CharEncoding) ParserInputBufferPtr - -/* - * Interfaces for output - */ -//go:linkname CleanupOutputCallbacks C.xmlCleanupOutputCallbacks -func CleanupOutputCallbacks() - -//go:linkname PopOutputCallbacks C.xmlPopOutputCallbacks -func PopOutputCallbacks() c.Int - -//go:linkname RegisterDefaultOutputCallbacks C.xmlRegisterDefaultOutputCallbacks -func RegisterDefaultOutputCallbacks() - -//go:linkname AllocOutputBuffer C.xmlAllocOutputBuffer -func AllocOutputBuffer(encoder CharEncodingHandlerPtr) OutputBufferPtr - -//go:linkname OutputBufferCreateFilename C.xmlOutputBufferCreateFilename -func OutputBufferCreateFilename(URI *c.Char, encoder CharEncodingHandlerPtr, compression c.Int) OutputBufferPtr - -//go:linkname OutputBufferCreateFile C.xmlOutputBufferCreateFile -func OutputBufferCreateFile(file *c.FILE, encoder CharEncodingHandlerPtr) OutputBufferPtr - -//go:linkname OutputBufferCreateBuffer C.xmlOutputBufferCreateBuffer -func OutputBufferCreateBuffer(buffer BufferPtr, encoder CharEncodingHandlerPtr) OutputBufferPtr - -//go:linkname OutputBufferCreateFd C.xmlOutputBufferCreateFd -func OutputBufferCreateFd(fd c.Int, encoder CharEncodingHandlerPtr) OutputBufferPtr - -//go:linkname OutputBufferCreateIO C.xmlOutputBufferCreateIO -func OutputBufferCreateIO(iowrite OutputWriteCallback, ioclose OutputCloseCallback, ioctx c.Pointer, encoder CharEncodingHandlerPtr) OutputBufferPtr - -/* Couple of APIs to get the output without digging into the buffers */ -//go:linkname OutputBufferGetContent C.xmlOutputBufferGetContent -func OutputBufferGetContent(out OutputBufferPtr) *Char - -//go:linkname OutputBufferGetSize C.xmlOutputBufferGetSize -func OutputBufferGetSize(out OutputBufferPtr) c.SizeT - -//go:linkname OutputBufferWrite C.xmlOutputBufferWrite -func OutputBufferWrite(out OutputBufferPtr, len c.Int, buf *c.Char) c.Int - -//go:linkname OutputBufferWriteString C.xmlOutputBufferWriteString -func OutputBufferWriteString(out OutputBufferPtr, str *c.Char) c.Int - -//go:linkname OutputBufferWriteEscape C.xmlOutputBufferWriteEscape -func OutputBufferWriteEscape(out OutputBufferPtr, str *Char, escaping CharEncodingOutputFunc) c.Int - -//go:linkname OutputBufferFlush C.xmlOutputBufferFlush -func OutputBufferFlush(out OutputBufferPtr) c.Int - -//go:linkname OutputBufferClose C.xmlOutputBufferClose -func OutputBufferClose(out OutputBufferPtr) c.Int - -//go:linkname RegisterOutputCallbacks C.xmlRegisterOutputCallbacks -func RegisterOutputCallbacks(matchFunc OutputMatchCallback, openFunc OutputOpenCallback, writeFunc OutputWriteCallback, closeFunc OutputCloseCallback) c.Int - -//go:linkname X__xmlOutputBufferCreateFilename C.__xmlOutputBufferCreateFilename -func X__xmlOutputBufferCreateFilename(URI *c.Char, encoder CharEncodingHandlerPtr, compression c.Int) OutputBufferPtr - -/* This function only exists if HTTP support built into the library */ -//go:linkname RegisterHTTPPostCallbacks C.xmlRegisterHTTPPostCallbacks -func RegisterHTTPPostCallbacks() - -//go:linkname CheckHTTPInput C.xmlCheckHTTPInput -func CheckHTTPInput(ctxt ParserCtxtPtr, ret ParserInputPtr) ParserInputPtr - -/* - * A predefined entity loader disabling network accesses - */ -//go:linkname NoNetExternalEntityLoader C.xmlNoNetExternalEntityLoader -func NoNetExternalEntityLoader(URL *c.Char, ID *c.Char, ctxt ParserCtxtPtr) ParserInputPtr - -// llgo:link (*Char).NormalizeWindowsPath C.xmlNormalizeWindowsPath -func (recv_ *Char) NormalizeWindowsPath() *Char { - return nil -} - -//go:linkname CheckFilename C.xmlCheckFilename -func CheckFilename(path *c.Char) c.Int - -/** - * Default 'file://' protocol callbacks - */ -//go:linkname FileMatch C.xmlFileMatch -func FileMatch(filename *c.Char) c.Int - -//go:linkname FileOpen C.xmlFileOpen -func FileOpen(filename *c.Char) c.Pointer - -//go:linkname FileRead C.xmlFileRead -func FileRead(context c.Pointer, buffer *c.Char, len c.Int) c.Int - -//go:linkname FileClose C.xmlFileClose -func FileClose(context c.Pointer) c.Int - -/** - * Default 'http://' protocol callbacks - */ -//go:linkname IOHTTPMatch C.xmlIOHTTPMatch -func IOHTTPMatch(filename *c.Char) c.Int - -//go:linkname IOHTTPOpen C.xmlIOHTTPOpen -func IOHTTPOpen(filename *c.Char) c.Pointer - -//go:linkname IOHTTPOpenW C.xmlIOHTTPOpenW -func IOHTTPOpenW(post_uri *c.Char, compression c.Int) c.Pointer - -//go:linkname IOHTTPRead C.xmlIOHTTPRead -func IOHTTPRead(context c.Pointer, buffer *c.Char, len c.Int) c.Int - -//go:linkname IOHTTPClose C.xmlIOHTTPClose -func IOHTTPClose(context c.Pointer) c.Int - -/** - * Default 'ftp://' protocol callbacks - */ -//go:linkname IOFTPMatch C.xmlIOFTPMatch -func IOFTPMatch(filename *c.Char) c.Int - -//go:linkname IOFTPOpen C.xmlIOFTPOpen -func IOFTPOpen(filename *c.Char) c.Pointer - -//go:linkname IOFTPRead C.xmlIOFTPRead -func IOFTPRead(context c.Pointer, buffer *c.Char, len c.Int) c.Int - -//go:linkname IOFTPClose C.xmlIOFTPClose -func IOFTPClose(context c.Pointer) c.Int - -//go:linkname ParserInputBufferCreateFilenameDefault C.xmlParserInputBufferCreateFilenameDefault -func ParserInputBufferCreateFilenameDefault(func_ ParserInputBufferCreateFilenameFunc) ParserInputBufferCreateFilenameFunc - -//go:linkname OutputBufferCreateFilenameDefault C.xmlOutputBufferCreateFilenameDefault -func OutputBufferCreateFilenameDefault(func_ OutputBufferCreateFilenameFunc) OutputBufferCreateFilenameFunc - -//go:linkname ThrDefOutputBufferCreateFilenameDefault C.xmlThrDefOutputBufferCreateFilenameDefault -func ThrDefOutputBufferCreateFilenameDefault(func_ OutputBufferCreateFilenameFunc) OutputBufferCreateFilenameFunc - -//go:linkname ThrDefParserInputBufferCreateFilenameDefault C.xmlThrDefParserInputBufferCreateFilenameDefault -func ThrDefParserInputBufferCreateFilenameDefault(func_ ParserInputBufferCreateFilenameFunc) ParserInputBufferCreateFilenameFunc diff --git a/libxml2/xmlautomata.go b/libxml2/xmlautomata.go deleted file mode 100644 index c4c6a6a1..00000000 --- a/libxml2/xmlautomata.go +++ /dev/null @@ -1,78 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlAutomata struct { - Unused [8]uint8 -} -type Automata X_xmlAutomata -type AutomataPtr *Automata - -type X_xmlAutomataState struct { - Unused [8]uint8 -} -type AutomataState X_xmlAutomataState -type AutomataStatePtr *AutomataState - -/* - * Building API - */ -//go:linkname NewAutomata C.xmlNewAutomata -func NewAutomata() AutomataPtr - -//go:linkname FreeAutomata C.xmlFreeAutomata -func FreeAutomata(am AutomataPtr) - -//go:linkname AutomataGetInitState C.xmlAutomataGetInitState -func AutomataGetInitState(am AutomataPtr) AutomataStatePtr - -//go:linkname AutomataSetFinalState C.xmlAutomataSetFinalState -func AutomataSetFinalState(am AutomataPtr, state AutomataStatePtr) c.Int - -//go:linkname AutomataNewState C.xmlAutomataNewState -func AutomataNewState(am AutomataPtr) AutomataStatePtr - -//go:linkname AutomataNewTransition C.xmlAutomataNewTransition -func AutomataNewTransition(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewTransition2 C.xmlAutomataNewTransition2 -func AutomataNewTransition2(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, token2 *Char, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewNegTrans C.xmlAutomataNewNegTrans -func AutomataNewNegTrans(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, token2 *Char, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewCountTrans C.xmlAutomataNewCountTrans -func AutomataNewCountTrans(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, min c.Int, max c.Int, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewCountTrans2 C.xmlAutomataNewCountTrans2 -func AutomataNewCountTrans2(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, token2 *Char, min c.Int, max c.Int, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewOnceTrans C.xmlAutomataNewOnceTrans -func AutomataNewOnceTrans(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, min c.Int, max c.Int, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewOnceTrans2 C.xmlAutomataNewOnceTrans2 -func AutomataNewOnceTrans2(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, token *Char, token2 *Char, min c.Int, max c.Int, data c.Pointer) AutomataStatePtr - -//go:linkname AutomataNewAllTrans C.xmlAutomataNewAllTrans -func AutomataNewAllTrans(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, lax c.Int) AutomataStatePtr - -//go:linkname AutomataNewEpsilon C.xmlAutomataNewEpsilon -func AutomataNewEpsilon(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr) AutomataStatePtr - -//go:linkname AutomataNewCountedTrans C.xmlAutomataNewCountedTrans -func AutomataNewCountedTrans(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, counter c.Int) AutomataStatePtr - -//go:linkname AutomataNewCounterTrans C.xmlAutomataNewCounterTrans -func AutomataNewCounterTrans(am AutomataPtr, from AutomataStatePtr, to AutomataStatePtr, counter c.Int) AutomataStatePtr - -//go:linkname AutomataNewCounter C.xmlAutomataNewCounter -func AutomataNewCounter(am AutomataPtr, min c.Int, max c.Int) c.Int - -//go:linkname AutomataCompile C.xmlAutomataCompile -func AutomataCompile(am AutomataPtr) *X_xmlRegexp - -//go:linkname AutomataIsDeterminist C.xmlAutomataIsDeterminist -func AutomataIsDeterminist(am AutomataPtr) c.Int diff --git a/libxml2/xmlerror.go b/libxml2/xmlerror.go deleted file mode 100644 index 0699bbca..00000000 --- a/libxml2/xmlerror.go +++ /dev/null @@ -1,908 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type ErrorLevel c.Int - -const ( - ERR_NONE ErrorLevel = 0 - ERR_WARNING ErrorLevel = 1 - ERR_ERROR ErrorLevel = 2 - ERR_FATAL ErrorLevel = 3 -) - -type ErrorDomain c.Int - -const ( - FROM_NONE ErrorDomain = 0 - FROM_PARSER ErrorDomain = 1 - FROM_TREE ErrorDomain = 2 - FROM_NAMESPACE ErrorDomain = 3 - FROM_DTD ErrorDomain = 4 - FROM_HTML ErrorDomain = 5 - FROM_MEMORY ErrorDomain = 6 - FROM_OUTPUT ErrorDomain = 7 - FROM_IO ErrorDomain = 8 - FROM_FTP ErrorDomain = 9 - FROM_HTTP ErrorDomain = 10 - FROM_XINCLUDE ErrorDomain = 11 - FROM_XPATH ErrorDomain = 12 - FROM_XPOINTER ErrorDomain = 13 - FROM_REGEXP ErrorDomain = 14 - FROM_DATATYPE ErrorDomain = 15 - FROM_SCHEMASP ErrorDomain = 16 - FROM_SCHEMASV ErrorDomain = 17 - FROM_RELAXNGP ErrorDomain = 18 - FROM_RELAXNGV ErrorDomain = 19 - FROM_CATALOG ErrorDomain = 20 - FROM_C14N ErrorDomain = 21 - FROM_XSLT ErrorDomain = 22 - FROM_VALID ErrorDomain = 23 - FROM_CHECK ErrorDomain = 24 - FROM_WRITER ErrorDomain = 25 - FROM_MODULE ErrorDomain = 26 - FROM_I18N ErrorDomain = 27 - FROM_SCHEMATRONV ErrorDomain = 28 - FROM_BUFFER ErrorDomain = 29 - FROM_URI ErrorDomain = 30 -) - -type X_xmlError struct { - Domain c.Int - Code c.Int - Message *c.Char - Level ErrorLevel - File *c.Char - Line c.Int - Str1 *c.Char - Str2 *c.Char - Str3 *c.Char - Int1 c.Int - Int2 c.Int - Ctxt c.Pointer - Node c.Pointer -} -type Error X_xmlError -type ErrorPtr *Error -type ParserErrors c.Int - -const ( - ERR_OK ParserErrors = 0 - ERR_INTERNAL_ERROR ParserErrors = 1 - ERR_NO_MEMORY ParserErrors = 2 - ERR_DOCUMENT_START ParserErrors = 3 - ERR_DOCUMENT_EMPTY ParserErrors = 4 - ERR_DOCUMENT_END ParserErrors = 5 - ERR_INVALID_HEX_CHARREF ParserErrors = 6 - ERR_INVALID_DEC_CHARREF ParserErrors = 7 - ERR_INVALID_CHARREF ParserErrors = 8 - ERR_INVALID_CHAR ParserErrors = 9 - ERR_CHARREF_AT_EOF ParserErrors = 10 - ERR_CHARREF_IN_PROLOG ParserErrors = 11 - ERR_CHARREF_IN_EPILOG ParserErrors = 12 - ERR_CHARREF_IN_DTD ParserErrors = 13 - ERR_ENTITYREF_AT_EOF ParserErrors = 14 - ERR_ENTITYREF_IN_PROLOG ParserErrors = 15 - ERR_ENTITYREF_IN_EPILOG ParserErrors = 16 - ERR_ENTITYREF_IN_DTD ParserErrors = 17 - ERR_PEREF_AT_EOF ParserErrors = 18 - ERR_PEREF_IN_PROLOG ParserErrors = 19 - ERR_PEREF_IN_EPILOG ParserErrors = 20 - ERR_PEREF_IN_INT_SUBSET ParserErrors = 21 - ERR_ENTITYREF_NO_NAME ParserErrors = 22 - ERR_ENTITYREF_SEMICOL_MISSING ParserErrors = 23 - ERR_PEREF_NO_NAME ParserErrors = 24 - ERR_PEREF_SEMICOL_MISSING ParserErrors = 25 - ERR_UNDECLARED_ENTITY ParserErrors = 26 - WAR_UNDECLARED_ENTITY ParserErrors = 27 - ERR_UNPARSED_ENTITY ParserErrors = 28 - ERR_ENTITY_IS_EXTERNAL ParserErrors = 29 - ERR_ENTITY_IS_PARAMETER ParserErrors = 30 - ERR_UNKNOWN_ENCODING ParserErrors = 31 - ERR_UNSUPPORTED_ENCODING ParserErrors = 32 - ERR_STRING_NOT_STARTED ParserErrors = 33 - ERR_STRING_NOT_CLOSED ParserErrors = 34 - ERR_NS_DECL_ERROR ParserErrors = 35 - ERR_ENTITY_NOT_STARTED ParserErrors = 36 - ERR_ENTITY_NOT_FINISHED ParserErrors = 37 - ERR_LT_IN_ATTRIBUTE ParserErrors = 38 - ERR_ATTRIBUTE_NOT_STARTED ParserErrors = 39 - ERR_ATTRIBUTE_NOT_FINISHED ParserErrors = 40 - ERR_ATTRIBUTE_WITHOUT_VALUE ParserErrors = 41 - ERR_ATTRIBUTE_REDEFINED ParserErrors = 42 - ERR_LITERAL_NOT_STARTED ParserErrors = 43 - ERR_LITERAL_NOT_FINISHED ParserErrors = 44 - ERR_COMMENT_NOT_FINISHED ParserErrors = 45 - ERR_PI_NOT_STARTED ParserErrors = 46 - ERR_PI_NOT_FINISHED ParserErrors = 47 - ERR_NOTATION_NOT_STARTED ParserErrors = 48 - ERR_NOTATION_NOT_FINISHED ParserErrors = 49 - ERR_ATTLIST_NOT_STARTED ParserErrors = 50 - ERR_ATTLIST_NOT_FINISHED ParserErrors = 51 - ERR_MIXED_NOT_STARTED ParserErrors = 52 - ERR_MIXED_NOT_FINISHED ParserErrors = 53 - ERR_ELEMCONTENT_NOT_STARTED ParserErrors = 54 - ERR_ELEMCONTENT_NOT_FINISHED ParserErrors = 55 - ERR_XMLDECL_NOT_STARTED ParserErrors = 56 - ERR_XMLDECL_NOT_FINISHED ParserErrors = 57 - ERR_CONDSEC_NOT_STARTED ParserErrors = 58 - ERR_CONDSEC_NOT_FINISHED ParserErrors = 59 - ERR_EXT_SUBSET_NOT_FINISHED ParserErrors = 60 - ERR_DOCTYPE_NOT_FINISHED ParserErrors = 61 - ERR_MISPLACED_CDATA_END ParserErrors = 62 - ERR_CDATA_NOT_FINISHED ParserErrors = 63 - ERR_RESERVED_XML_NAME ParserErrors = 64 - ERR_SPACE_REQUIRED ParserErrors = 65 - ERR_SEPARATOR_REQUIRED ParserErrors = 66 - ERR_NMTOKEN_REQUIRED ParserErrors = 67 - ERR_NAME_REQUIRED ParserErrors = 68 - ERR_PCDATA_REQUIRED ParserErrors = 69 - ERR_URI_REQUIRED ParserErrors = 70 - ERR_PUBID_REQUIRED ParserErrors = 71 - ERR_LT_REQUIRED ParserErrors = 72 - ERR_GT_REQUIRED ParserErrors = 73 - ERR_LTSLASH_REQUIRED ParserErrors = 74 - ERR_EQUAL_REQUIRED ParserErrors = 75 - ERR_TAG_NAME_MISMATCH ParserErrors = 76 - ERR_TAG_NOT_FINISHED ParserErrors = 77 - ERR_STANDALONE_VALUE ParserErrors = 78 - ERR_ENCODING_NAME ParserErrors = 79 - ERR_HYPHEN_IN_COMMENT ParserErrors = 80 - ERR_INVALID_ENCODING ParserErrors = 81 - ERR_EXT_ENTITY_STANDALONE ParserErrors = 82 - ERR_CONDSEC_INVALID ParserErrors = 83 - ERR_VALUE_REQUIRED ParserErrors = 84 - ERR_NOT_WELL_BALANCED ParserErrors = 85 - ERR_EXTRA_CONTENT ParserErrors = 86 - ERR_ENTITY_CHAR_ERROR ParserErrors = 87 - ERR_ENTITY_PE_INTERNAL ParserErrors = 88 - ERR_ENTITY_LOOP ParserErrors = 89 - ERR_ENTITY_BOUNDARY ParserErrors = 90 - ERR_INVALID_URI ParserErrors = 91 - ERR_URI_FRAGMENT ParserErrors = 92 - WAR_CATALOG_PI ParserErrors = 93 - ERR_NO_DTD ParserErrors = 94 - ERR_CONDSEC_INVALID_KEYWORD ParserErrors = 95 - ERR_VERSION_MISSING ParserErrors = 96 - WAR_UNKNOWN_VERSION ParserErrors = 97 - WAR_LANG_VALUE ParserErrors = 98 - WAR_NS_URI ParserErrors = 99 - WAR_NS_URI_RELATIVE ParserErrors = 100 - ERR_MISSING_ENCODING ParserErrors = 101 - WAR_SPACE_VALUE ParserErrors = 102 - ERR_NOT_STANDALONE ParserErrors = 103 - ERR_ENTITY_PROCESSING ParserErrors = 104 - ERR_NOTATION_PROCESSING ParserErrors = 105 - WAR_NS_COLUMN ParserErrors = 106 - WAR_ENTITY_REDEFINED ParserErrors = 107 - ERR_UNKNOWN_VERSION ParserErrors = 108 - ERR_VERSION_MISMATCH ParserErrors = 109 - ERR_NAME_TOO_LONG ParserErrors = 110 - ERR_USER_STOP ParserErrors = 111 - ERR_COMMENT_ABRUPTLY_ENDED ParserErrors = 112 - WAR_ENCODING_MISMATCH ParserErrors = 113 - ERR_RESOURCE_LIMIT ParserErrors = 114 - ERR_ARGUMENT ParserErrors = 115 - ERR_SYSTEM ParserErrors = 116 - ERR_REDECL_PREDEF_ENTITY ParserErrors = 117 - ERR_INT_SUBSET_NOT_FINISHED ParserErrors = 118 - NS_ERR_XML_NAMESPACE ParserErrors = 200 - NS_ERR_UNDEFINED_NAMESPACE ParserErrors = 201 - NS_ERR_QNAME ParserErrors = 202 - NS_ERR_ATTRIBUTE_REDEFINED ParserErrors = 203 - NS_ERR_EMPTY ParserErrors = 204 - NS_ERR_COLON ParserErrors = 205 - DTD_ATTRIBUTE_DEFAULT ParserErrors = 500 - DTD_ATTRIBUTE_REDEFINED ParserErrors = 501 - DTD_ATTRIBUTE_VALUE ParserErrors = 502 - DTD_CONTENT_ERROR ParserErrors = 503 - DTD_CONTENT_MODEL ParserErrors = 504 - DTD_CONTENT_NOT_DETERMINIST ParserErrors = 505 - DTD_DIFFERENT_PREFIX ParserErrors = 506 - DTD_ELEM_DEFAULT_NAMESPACE ParserErrors = 507 - DTD_ELEM_NAMESPACE ParserErrors = 508 - DTD_ELEM_REDEFINED ParserErrors = 509 - DTD_EMPTY_NOTATION ParserErrors = 510 - DTD_ENTITY_TYPE ParserErrors = 511 - DTD_ID_FIXED ParserErrors = 512 - DTD_ID_REDEFINED ParserErrors = 513 - DTD_ID_SUBSET ParserErrors = 514 - DTD_INVALID_CHILD ParserErrors = 515 - DTD_INVALID_DEFAULT ParserErrors = 516 - DTD_LOAD_ERROR ParserErrors = 517 - DTD_MISSING_ATTRIBUTE ParserErrors = 518 - DTD_MIXED_CORRUPT ParserErrors = 519 - DTD_MULTIPLE_ID ParserErrors = 520 - DTD_NO_DOC ParserErrors = 521 - DTD_NO_DTD ParserErrors = 522 - DTD_NO_ELEM_NAME ParserErrors = 523 - DTD_NO_PREFIX ParserErrors = 524 - DTD_NO_ROOT ParserErrors = 525 - DTD_NOTATION_REDEFINED ParserErrors = 526 - DTD_NOTATION_VALUE ParserErrors = 527 - DTD_NOT_EMPTY ParserErrors = 528 - DTD_NOT_PCDATA ParserErrors = 529 - DTD_NOT_STANDALONE ParserErrors = 530 - DTD_ROOT_NAME ParserErrors = 531 - DTD_STANDALONE_WHITE_SPACE ParserErrors = 532 - DTD_UNKNOWN_ATTRIBUTE ParserErrors = 533 - DTD_UNKNOWN_ELEM ParserErrors = 534 - DTD_UNKNOWN_ENTITY ParserErrors = 535 - DTD_UNKNOWN_ID ParserErrors = 536 - DTD_UNKNOWN_NOTATION ParserErrors = 537 - DTD_STANDALONE_DEFAULTED ParserErrors = 538 - DTD_XMLID_VALUE ParserErrors = 539 - DTD_XMLID_TYPE ParserErrors = 540 - DTD_DUP_TOKEN ParserErrors = 541 - HTML_STRUCURE_ERROR ParserErrors = 800 - HTML_UNKNOWN_TAG ParserErrors = 801 - HTML_INCORRECTLY_OPENED_COMMENT ParserErrors = 802 - RNGP_ANYNAME_ATTR_ANCESTOR ParserErrors = 1000 - RNGP_ATTR_CONFLICT ParserErrors = 1001 - RNGP_ATTRIBUTE_CHILDREN ParserErrors = 1002 - RNGP_ATTRIBUTE_CONTENT ParserErrors = 1003 - RNGP_ATTRIBUTE_EMPTY ParserErrors = 1004 - RNGP_ATTRIBUTE_NOOP ParserErrors = 1005 - RNGP_CHOICE_CONTENT ParserErrors = 1006 - RNGP_CHOICE_EMPTY ParserErrors = 1007 - RNGP_CREATE_FAILURE ParserErrors = 1008 - RNGP_DATA_CONTENT ParserErrors = 1009 - RNGP_DEF_CHOICE_AND_INTERLEAVE ParserErrors = 1010 - RNGP_DEFINE_CREATE_FAILED ParserErrors = 1011 - RNGP_DEFINE_EMPTY ParserErrors = 1012 - RNGP_DEFINE_MISSING ParserErrors = 1013 - RNGP_DEFINE_NAME_MISSING ParserErrors = 1014 - RNGP_ELEM_CONTENT_EMPTY ParserErrors = 1015 - RNGP_ELEM_CONTENT_ERROR ParserErrors = 1016 - RNGP_ELEMENT_EMPTY ParserErrors = 1017 - RNGP_ELEMENT_CONTENT ParserErrors = 1018 - RNGP_ELEMENT_NAME ParserErrors = 1019 - RNGP_ELEMENT_NO_CONTENT ParserErrors = 1020 - RNGP_ELEM_TEXT_CONFLICT ParserErrors = 1021 - RNGP_EMPTY ParserErrors = 1022 - RNGP_EMPTY_CONSTRUCT ParserErrors = 1023 - RNGP_EMPTY_CONTENT ParserErrors = 1024 - RNGP_EMPTY_NOT_EMPTY ParserErrors = 1025 - RNGP_ERROR_TYPE_LIB ParserErrors = 1026 - RNGP_EXCEPT_EMPTY ParserErrors = 1027 - RNGP_EXCEPT_MISSING ParserErrors = 1028 - RNGP_EXCEPT_MULTIPLE ParserErrors = 1029 - RNGP_EXCEPT_NO_CONTENT ParserErrors = 1030 - RNGP_EXTERNALREF_EMTPY ParserErrors = 1031 - RNGP_EXTERNAL_REF_FAILURE ParserErrors = 1032 - RNGP_EXTERNALREF_RECURSE ParserErrors = 1033 - RNGP_FORBIDDEN_ATTRIBUTE ParserErrors = 1034 - RNGP_FOREIGN_ELEMENT ParserErrors = 1035 - RNGP_GRAMMAR_CONTENT ParserErrors = 1036 - RNGP_GRAMMAR_EMPTY ParserErrors = 1037 - RNGP_GRAMMAR_MISSING ParserErrors = 1038 - RNGP_GRAMMAR_NO_START ParserErrors = 1039 - RNGP_GROUP_ATTR_CONFLICT ParserErrors = 1040 - RNGP_HREF_ERROR ParserErrors = 1041 - RNGP_INCLUDE_EMPTY ParserErrors = 1042 - RNGP_INCLUDE_FAILURE ParserErrors = 1043 - RNGP_INCLUDE_RECURSE ParserErrors = 1044 - RNGP_INTERLEAVE_ADD ParserErrors = 1045 - RNGP_INTERLEAVE_CREATE_FAILED ParserErrors = 1046 - RNGP_INTERLEAVE_EMPTY ParserErrors = 1047 - RNGP_INTERLEAVE_NO_CONTENT ParserErrors = 1048 - RNGP_INVALID_DEFINE_NAME ParserErrors = 1049 - RNGP_INVALID_URI ParserErrors = 1050 - RNGP_INVALID_VALUE ParserErrors = 1051 - RNGP_MISSING_HREF ParserErrors = 1052 - RNGP_NAME_MISSING ParserErrors = 1053 - RNGP_NEED_COMBINE ParserErrors = 1054 - RNGP_NOTALLOWED_NOT_EMPTY ParserErrors = 1055 - RNGP_NSNAME_ATTR_ANCESTOR ParserErrors = 1056 - RNGP_NSNAME_NO_NS ParserErrors = 1057 - RNGP_PARAM_FORBIDDEN ParserErrors = 1058 - RNGP_PARAM_NAME_MISSING ParserErrors = 1059 - RNGP_PARENTREF_CREATE_FAILED ParserErrors = 1060 - RNGP_PARENTREF_NAME_INVALID ParserErrors = 1061 - RNGP_PARENTREF_NO_NAME ParserErrors = 1062 - RNGP_PARENTREF_NO_PARENT ParserErrors = 1063 - RNGP_PARENTREF_NOT_EMPTY ParserErrors = 1064 - RNGP_PARSE_ERROR ParserErrors = 1065 - RNGP_PAT_ANYNAME_EXCEPT_ANYNAME ParserErrors = 1066 - RNGP_PAT_ATTR_ATTR ParserErrors = 1067 - RNGP_PAT_ATTR_ELEM ParserErrors = 1068 - RNGP_PAT_DATA_EXCEPT_ATTR ParserErrors = 1069 - RNGP_PAT_DATA_EXCEPT_ELEM ParserErrors = 1070 - RNGP_PAT_DATA_EXCEPT_EMPTY ParserErrors = 1071 - RNGP_PAT_DATA_EXCEPT_GROUP ParserErrors = 1072 - RNGP_PAT_DATA_EXCEPT_INTERLEAVE ParserErrors = 1073 - RNGP_PAT_DATA_EXCEPT_LIST ParserErrors = 1074 - RNGP_PAT_DATA_EXCEPT_ONEMORE ParserErrors = 1075 - RNGP_PAT_DATA_EXCEPT_REF ParserErrors = 1076 - RNGP_PAT_DATA_EXCEPT_TEXT ParserErrors = 1077 - RNGP_PAT_LIST_ATTR ParserErrors = 1078 - RNGP_PAT_LIST_ELEM ParserErrors = 1079 - RNGP_PAT_LIST_INTERLEAVE ParserErrors = 1080 - RNGP_PAT_LIST_LIST ParserErrors = 1081 - RNGP_PAT_LIST_REF ParserErrors = 1082 - RNGP_PAT_LIST_TEXT ParserErrors = 1083 - RNGP_PAT_NSNAME_EXCEPT_ANYNAME ParserErrors = 1084 - RNGP_PAT_NSNAME_EXCEPT_NSNAME ParserErrors = 1085 - RNGP_PAT_ONEMORE_GROUP_ATTR ParserErrors = 1086 - RNGP_PAT_ONEMORE_INTERLEAVE_ATTR ParserErrors = 1087 - RNGP_PAT_START_ATTR ParserErrors = 1088 - RNGP_PAT_START_DATA ParserErrors = 1089 - RNGP_PAT_START_EMPTY ParserErrors = 1090 - RNGP_PAT_START_GROUP ParserErrors = 1091 - RNGP_PAT_START_INTERLEAVE ParserErrors = 1092 - RNGP_PAT_START_LIST ParserErrors = 1093 - RNGP_PAT_START_ONEMORE ParserErrors = 1094 - RNGP_PAT_START_TEXT ParserErrors = 1095 - RNGP_PAT_START_VALUE ParserErrors = 1096 - RNGP_PREFIX_UNDEFINED ParserErrors = 1097 - RNGP_REF_CREATE_FAILED ParserErrors = 1098 - RNGP_REF_CYCLE ParserErrors = 1099 - RNGP_REF_NAME_INVALID ParserErrors = 1100 - RNGP_REF_NO_DEF ParserErrors = 1101 - RNGP_REF_NO_NAME ParserErrors = 1102 - RNGP_REF_NOT_EMPTY ParserErrors = 1103 - RNGP_START_CHOICE_AND_INTERLEAVE ParserErrors = 1104 - RNGP_START_CONTENT ParserErrors = 1105 - RNGP_START_EMPTY ParserErrors = 1106 - RNGP_START_MISSING ParserErrors = 1107 - RNGP_TEXT_EXPECTED ParserErrors = 1108 - RNGP_TEXT_HAS_CHILD ParserErrors = 1109 - RNGP_TYPE_MISSING ParserErrors = 1110 - RNGP_TYPE_NOT_FOUND ParserErrors = 1111 - RNGP_TYPE_VALUE ParserErrors = 1112 - RNGP_UNKNOWN_ATTRIBUTE ParserErrors = 1113 - RNGP_UNKNOWN_COMBINE ParserErrors = 1114 - RNGP_UNKNOWN_CONSTRUCT ParserErrors = 1115 - RNGP_UNKNOWN_TYPE_LIB ParserErrors = 1116 - RNGP_URI_FRAGMENT ParserErrors = 1117 - RNGP_URI_NOT_ABSOLUTE ParserErrors = 1118 - RNGP_VALUE_EMPTY ParserErrors = 1119 - RNGP_VALUE_NO_CONTENT ParserErrors = 1120 - RNGP_XMLNS_NAME ParserErrors = 1121 - RNGP_XML_NS ParserErrors = 1122 - XPATH_EXPRESSION_OK ParserErrors = 1200 - XPATH_NUMBER_ERROR ParserErrors = 1201 - XPATH_UNFINISHED_LITERAL_ERROR ParserErrors = 1202 - XPATH_START_LITERAL_ERROR ParserErrors = 1203 - XPATH_VARIABLE_REF_ERROR ParserErrors = 1204 - XPATH_UNDEF_VARIABLE_ERROR ParserErrors = 1205 - XPATH_INVALID_PREDICATE_ERROR ParserErrors = 1206 - XPATH_EXPR_ERROR ParserErrors = 1207 - XPATH_UNCLOSED_ERROR ParserErrors = 1208 - XPATH_UNKNOWN_FUNC_ERROR ParserErrors = 1209 - XPATH_INVALID_OPERAND ParserErrors = 1210 - XPATH_INVALID_TYPE ParserErrors = 1211 - XPATH_INVALID_ARITY ParserErrors = 1212 - XPATH_INVALID_CTXT_SIZE ParserErrors = 1213 - XPATH_INVALID_CTXT_POSITION ParserErrors = 1214 - XPATH_MEMORY_ERROR ParserErrors = 1215 - XPTR_SYNTAX_ERROR ParserErrors = 1216 - XPTR_RESOURCE_ERROR ParserErrors = 1217 - XPTR_SUB_RESOURCE_ERROR ParserErrors = 1218 - XPATH_UNDEF_PREFIX_ERROR ParserErrors = 1219 - XPATH_ENCODING_ERROR ParserErrors = 1220 - XPATH_INVALID_CHAR_ERROR ParserErrors = 1221 - TREE_INVALID_HEX ParserErrors = 1300 - TREE_INVALID_DEC ParserErrors = 1301 - TREE_UNTERMINATED_ENTITY ParserErrors = 1302 - TREE_NOT_UTF8 ParserErrors = 1303 - SAVE_NOT_UTF8 ParserErrors = 1400 - SAVE_CHAR_INVALID ParserErrors = 1401 - SAVE_NO_DOCTYPE ParserErrors = 1402 - SAVE_UNKNOWN_ENCODING ParserErrors = 1403 - REGEXP_COMPILE_ERROR ParserErrors = 1450 - IO_UNKNOWN ParserErrors = 1500 - IO_EACCES ParserErrors = 1501 - IO_EAGAIN ParserErrors = 1502 - IO_EBADF ParserErrors = 1503 - IO_EBADMSG ParserErrors = 1504 - IO_EBUSY ParserErrors = 1505 - IO_ECANCELED ParserErrors = 1506 - IO_ECHILD ParserErrors = 1507 - IO_EDEADLK ParserErrors = 1508 - IO_EDOM ParserErrors = 1509 - IO_EEXIST ParserErrors = 1510 - IO_EFAULT ParserErrors = 1511 - IO_EFBIG ParserErrors = 1512 - IO_EINPROGRESS ParserErrors = 1513 - IO_EINTR ParserErrors = 1514 - IO_EINVAL ParserErrors = 1515 - IO_EIO ParserErrors = 1516 - IO_EISDIR ParserErrors = 1517 - IO_EMFILE ParserErrors = 1518 - IO_EMLINK ParserErrors = 1519 - IO_EMSGSIZE ParserErrors = 1520 - IO_ENAMETOOLONG ParserErrors = 1521 - IO_ENFILE ParserErrors = 1522 - IO_ENODEV ParserErrors = 1523 - IO_ENOENT ParserErrors = 1524 - IO_ENOEXEC ParserErrors = 1525 - IO_ENOLCK ParserErrors = 1526 - IO_ENOMEM ParserErrors = 1527 - IO_ENOSPC ParserErrors = 1528 - IO_ENOSYS ParserErrors = 1529 - IO_ENOTDIR ParserErrors = 1530 - IO_ENOTEMPTY ParserErrors = 1531 - IO_ENOTSUP ParserErrors = 1532 - IO_ENOTTY ParserErrors = 1533 - IO_ENXIO ParserErrors = 1534 - IO_EPERM ParserErrors = 1535 - IO_EPIPE ParserErrors = 1536 - IO_ERANGE ParserErrors = 1537 - IO_EROFS ParserErrors = 1538 - IO_ESPIPE ParserErrors = 1539 - IO_ESRCH ParserErrors = 1540 - IO_ETIMEDOUT ParserErrors = 1541 - IO_EXDEV ParserErrors = 1542 - IO_NETWORK_ATTEMPT ParserErrors = 1543 - IO_ENCODER ParserErrors = 1544 - IO_FLUSH ParserErrors = 1545 - IO_WRITE ParserErrors = 1546 - IO_NO_INPUT ParserErrors = 1547 - IO_BUFFER_FULL ParserErrors = 1548 - IO_LOAD_ERROR ParserErrors = 1549 - IO_ENOTSOCK ParserErrors = 1550 - IO_EISCONN ParserErrors = 1551 - IO_ECONNREFUSED ParserErrors = 1552 - IO_ENETUNREACH ParserErrors = 1553 - IO_EADDRINUSE ParserErrors = 1554 - IO_EALREADY ParserErrors = 1555 - IO_EAFNOSUPPORT ParserErrors = 1556 - IO_UNSUPPORTED_PROTOCOL ParserErrors = 1557 - XINCLUDE_RECURSION ParserErrors = 1600 - XINCLUDE_PARSE_VALUE ParserErrors = 1601 - XINCLUDE_ENTITY_DEF_MISMATCH ParserErrors = 1602 - XINCLUDE_NO_HREF ParserErrors = 1603 - XINCLUDE_NO_FALLBACK ParserErrors = 1604 - XINCLUDE_HREF_URI ParserErrors = 1605 - XINCLUDE_TEXT_FRAGMENT ParserErrors = 1606 - XINCLUDE_TEXT_DOCUMENT ParserErrors = 1607 - XINCLUDE_INVALID_CHAR ParserErrors = 1608 - XINCLUDE_BUILD_FAILED ParserErrors = 1609 - XINCLUDE_UNKNOWN_ENCODING ParserErrors = 1610 - XINCLUDE_MULTIPLE_ROOT ParserErrors = 1611 - XINCLUDE_XPTR_FAILED ParserErrors = 1612 - XINCLUDE_XPTR_RESULT ParserErrors = 1613 - XINCLUDE_INCLUDE_IN_INCLUDE ParserErrors = 1614 - XINCLUDE_FALLBACKS_IN_INCLUDE ParserErrors = 1615 - XINCLUDE_FALLBACK_NOT_IN_INCLUDE ParserErrors = 1616 - XINCLUDE_DEPRECATED_NS ParserErrors = 1617 - XINCLUDE_FRAGMENT_ID ParserErrors = 1618 - CATALOG_MISSING_ATTR ParserErrors = 1650 - CATALOG_ENTRY_BROKEN ParserErrors = 1651 - CATALOG_PREFER_VALUE ParserErrors = 1652 - CATALOG_NOT_CATALOG ParserErrors = 1653 - CATALOG_RECURSION ParserErrors = 1654 - SCHEMAP_PREFIX_UNDEFINED ParserErrors = 1700 - SCHEMAP_ATTRFORMDEFAULT_VALUE ParserErrors = 1701 - SCHEMAP_ATTRGRP_NONAME_NOREF ParserErrors = 1702 - SCHEMAP_ATTR_NONAME_NOREF ParserErrors = 1703 - SCHEMAP_COMPLEXTYPE_NONAME_NOREF ParserErrors = 1704 - SCHEMAP_ELEMFORMDEFAULT_VALUE ParserErrors = 1705 - SCHEMAP_ELEM_NONAME_NOREF ParserErrors = 1706 - SCHEMAP_EXTENSION_NO_BASE ParserErrors = 1707 - SCHEMAP_FACET_NO_VALUE ParserErrors = 1708 - SCHEMAP_FAILED_BUILD_IMPORT ParserErrors = 1709 - SCHEMAP_GROUP_NONAME_NOREF ParserErrors = 1710 - SCHEMAP_IMPORT_NAMESPACE_NOT_URI ParserErrors = 1711 - SCHEMAP_IMPORT_REDEFINE_NSNAME ParserErrors = 1712 - SCHEMAP_IMPORT_SCHEMA_NOT_URI ParserErrors = 1713 - SCHEMAP_INVALID_BOOLEAN ParserErrors = 1714 - SCHEMAP_INVALID_ENUM ParserErrors = 1715 - SCHEMAP_INVALID_FACET ParserErrors = 1716 - SCHEMAP_INVALID_FACET_VALUE ParserErrors = 1717 - SCHEMAP_INVALID_MAXOCCURS ParserErrors = 1718 - SCHEMAP_INVALID_MINOCCURS ParserErrors = 1719 - SCHEMAP_INVALID_REF_AND_SUBTYPE ParserErrors = 1720 - SCHEMAP_INVALID_WHITE_SPACE ParserErrors = 1721 - SCHEMAP_NOATTR_NOREF ParserErrors = 1722 - SCHEMAP_NOTATION_NO_NAME ParserErrors = 1723 - SCHEMAP_NOTYPE_NOREF ParserErrors = 1724 - SCHEMAP_REF_AND_SUBTYPE ParserErrors = 1725 - SCHEMAP_RESTRICTION_NONAME_NOREF ParserErrors = 1726 - SCHEMAP_SIMPLETYPE_NONAME ParserErrors = 1727 - SCHEMAP_TYPE_AND_SUBTYPE ParserErrors = 1728 - SCHEMAP_UNKNOWN_ALL_CHILD ParserErrors = 1729 - SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD ParserErrors = 1730 - SCHEMAP_UNKNOWN_ATTR_CHILD ParserErrors = 1731 - SCHEMAP_UNKNOWN_ATTRGRP_CHILD ParserErrors = 1732 - SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP ParserErrors = 1733 - SCHEMAP_UNKNOWN_BASE_TYPE ParserErrors = 1734 - SCHEMAP_UNKNOWN_CHOICE_CHILD ParserErrors = 1735 - SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD ParserErrors = 1736 - SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD ParserErrors = 1737 - SCHEMAP_UNKNOWN_ELEM_CHILD ParserErrors = 1738 - SCHEMAP_UNKNOWN_EXTENSION_CHILD ParserErrors = 1739 - SCHEMAP_UNKNOWN_FACET_CHILD ParserErrors = 1740 - SCHEMAP_UNKNOWN_FACET_TYPE ParserErrors = 1741 - SCHEMAP_UNKNOWN_GROUP_CHILD ParserErrors = 1742 - SCHEMAP_UNKNOWN_IMPORT_CHILD ParserErrors = 1743 - SCHEMAP_UNKNOWN_LIST_CHILD ParserErrors = 1744 - SCHEMAP_UNKNOWN_NOTATION_CHILD ParserErrors = 1745 - SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD ParserErrors = 1746 - SCHEMAP_UNKNOWN_REF ParserErrors = 1747 - SCHEMAP_UNKNOWN_RESTRICTION_CHILD ParserErrors = 1748 - SCHEMAP_UNKNOWN_SCHEMAS_CHILD ParserErrors = 1749 - SCHEMAP_UNKNOWN_SEQUENCE_CHILD ParserErrors = 1750 - SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD ParserErrors = 1751 - SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD ParserErrors = 1752 - SCHEMAP_UNKNOWN_TYPE ParserErrors = 1753 - SCHEMAP_UNKNOWN_UNION_CHILD ParserErrors = 1754 - SCHEMAP_ELEM_DEFAULT_FIXED ParserErrors = 1755 - SCHEMAP_REGEXP_INVALID ParserErrors = 1756 - SCHEMAP_FAILED_LOAD ParserErrors = 1757 - SCHEMAP_NOTHING_TO_PARSE ParserErrors = 1758 - SCHEMAP_NOROOT ParserErrors = 1759 - SCHEMAP_REDEFINED_GROUP ParserErrors = 1760 - SCHEMAP_REDEFINED_TYPE ParserErrors = 1761 - SCHEMAP_REDEFINED_ELEMENT ParserErrors = 1762 - SCHEMAP_REDEFINED_ATTRGROUP ParserErrors = 1763 - SCHEMAP_REDEFINED_ATTR ParserErrors = 1764 - SCHEMAP_REDEFINED_NOTATION ParserErrors = 1765 - SCHEMAP_FAILED_PARSE ParserErrors = 1766 - SCHEMAP_UNKNOWN_PREFIX ParserErrors = 1767 - SCHEMAP_DEF_AND_PREFIX ParserErrors = 1768 - SCHEMAP_UNKNOWN_INCLUDE_CHILD ParserErrors = 1769 - SCHEMAP_INCLUDE_SCHEMA_NOT_URI ParserErrors = 1770 - SCHEMAP_INCLUDE_SCHEMA_NO_URI ParserErrors = 1771 - SCHEMAP_NOT_SCHEMA ParserErrors = 1772 - SCHEMAP_UNKNOWN_MEMBER_TYPE ParserErrors = 1773 - SCHEMAP_INVALID_ATTR_USE ParserErrors = 1774 - SCHEMAP_RECURSIVE ParserErrors = 1775 - SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE ParserErrors = 1776 - SCHEMAP_INVALID_ATTR_COMBINATION ParserErrors = 1777 - SCHEMAP_INVALID_ATTR_INLINE_COMBINATION ParserErrors = 1778 - SCHEMAP_MISSING_SIMPLETYPE_CHILD ParserErrors = 1779 - SCHEMAP_INVALID_ATTR_NAME ParserErrors = 1780 - SCHEMAP_REF_AND_CONTENT ParserErrors = 1781 - SCHEMAP_CT_PROPS_CORRECT_1 ParserErrors = 1782 - SCHEMAP_CT_PROPS_CORRECT_2 ParserErrors = 1783 - SCHEMAP_CT_PROPS_CORRECT_3 ParserErrors = 1784 - SCHEMAP_CT_PROPS_CORRECT_4 ParserErrors = 1785 - SCHEMAP_CT_PROPS_CORRECT_5 ParserErrors = 1786 - SCHEMAP_DERIVATION_OK_RESTRICTION_1 ParserErrors = 1787 - SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 ParserErrors = 1788 - SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 ParserErrors = 1789 - SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 ParserErrors = 1790 - SCHEMAP_DERIVATION_OK_RESTRICTION_3 ParserErrors = 1791 - SCHEMAP_WILDCARD_INVALID_NS_MEMBER ParserErrors = 1792 - SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE ParserErrors = 1793 - SCHEMAP_UNION_NOT_EXPRESSIBLE ParserErrors = 1794 - SCHEMAP_SRC_IMPORT_3_1 ParserErrors = 1795 - SCHEMAP_SRC_IMPORT_3_2 ParserErrors = 1796 - SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 ParserErrors = 1797 - SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 ParserErrors = 1798 - SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 ParserErrors = 1799 - SCHEMAP_COS_CT_EXTENDS_1_3 ParserErrors = 1800 - SCHEMAV_NOROOT ParserErrors = 1801 - SCHEMAV_UNDECLAREDELEM ParserErrors = 1802 - SCHEMAV_NOTTOPLEVEL ParserErrors = 1803 - SCHEMAV_MISSING ParserErrors = 1804 - SCHEMAV_WRONGELEM ParserErrors = 1805 - SCHEMAV_NOTYPE ParserErrors = 1806 - SCHEMAV_NOROLLBACK ParserErrors = 1807 - SCHEMAV_ISABSTRACT ParserErrors = 1808 - SCHEMAV_NOTEMPTY ParserErrors = 1809 - SCHEMAV_ELEMCONT ParserErrors = 1810 - SCHEMAV_HAVEDEFAULT ParserErrors = 1811 - SCHEMAV_NOTNILLABLE ParserErrors = 1812 - SCHEMAV_EXTRACONTENT ParserErrors = 1813 - SCHEMAV_INVALIDATTR ParserErrors = 1814 - SCHEMAV_INVALIDELEM ParserErrors = 1815 - SCHEMAV_NOTDETERMINIST ParserErrors = 1816 - SCHEMAV_CONSTRUCT ParserErrors = 1817 - SCHEMAV_INTERNAL ParserErrors = 1818 - SCHEMAV_NOTSIMPLE ParserErrors = 1819 - SCHEMAV_ATTRUNKNOWN ParserErrors = 1820 - SCHEMAV_ATTRINVALID ParserErrors = 1821 - SCHEMAV_VALUE ParserErrors = 1822 - SCHEMAV_FACET ParserErrors = 1823 - SCHEMAV_CVC_DATATYPE_VALID_1_2_1 ParserErrors = 1824 - SCHEMAV_CVC_DATATYPE_VALID_1_2_2 ParserErrors = 1825 - SCHEMAV_CVC_DATATYPE_VALID_1_2_3 ParserErrors = 1826 - SCHEMAV_CVC_TYPE_3_1_1 ParserErrors = 1827 - SCHEMAV_CVC_TYPE_3_1_2 ParserErrors = 1828 - SCHEMAV_CVC_FACET_VALID ParserErrors = 1829 - SCHEMAV_CVC_LENGTH_VALID ParserErrors = 1830 - SCHEMAV_CVC_MINLENGTH_VALID ParserErrors = 1831 - SCHEMAV_CVC_MAXLENGTH_VALID ParserErrors = 1832 - SCHEMAV_CVC_MININCLUSIVE_VALID ParserErrors = 1833 - SCHEMAV_CVC_MAXINCLUSIVE_VALID ParserErrors = 1834 - SCHEMAV_CVC_MINEXCLUSIVE_VALID ParserErrors = 1835 - SCHEMAV_CVC_MAXEXCLUSIVE_VALID ParserErrors = 1836 - SCHEMAV_CVC_TOTALDIGITS_VALID ParserErrors = 1837 - SCHEMAV_CVC_FRACTIONDIGITS_VALID ParserErrors = 1838 - SCHEMAV_CVC_PATTERN_VALID ParserErrors = 1839 - SCHEMAV_CVC_ENUMERATION_VALID ParserErrors = 1840 - SCHEMAV_CVC_COMPLEX_TYPE_2_1 ParserErrors = 1841 - SCHEMAV_CVC_COMPLEX_TYPE_2_2 ParserErrors = 1842 - SCHEMAV_CVC_COMPLEX_TYPE_2_3 ParserErrors = 1843 - SCHEMAV_CVC_COMPLEX_TYPE_2_4 ParserErrors = 1844 - SCHEMAV_CVC_ELT_1 ParserErrors = 1845 - SCHEMAV_CVC_ELT_2 ParserErrors = 1846 - SCHEMAV_CVC_ELT_3_1 ParserErrors = 1847 - SCHEMAV_CVC_ELT_3_2_1 ParserErrors = 1848 - SCHEMAV_CVC_ELT_3_2_2 ParserErrors = 1849 - SCHEMAV_CVC_ELT_4_1 ParserErrors = 1850 - SCHEMAV_CVC_ELT_4_2 ParserErrors = 1851 - SCHEMAV_CVC_ELT_4_3 ParserErrors = 1852 - SCHEMAV_CVC_ELT_5_1_1 ParserErrors = 1853 - SCHEMAV_CVC_ELT_5_1_2 ParserErrors = 1854 - SCHEMAV_CVC_ELT_5_2_1 ParserErrors = 1855 - SCHEMAV_CVC_ELT_5_2_2_1 ParserErrors = 1856 - SCHEMAV_CVC_ELT_5_2_2_2_1 ParserErrors = 1857 - SCHEMAV_CVC_ELT_5_2_2_2_2 ParserErrors = 1858 - SCHEMAV_CVC_ELT_6 ParserErrors = 1859 - SCHEMAV_CVC_ELT_7 ParserErrors = 1860 - SCHEMAV_CVC_ATTRIBUTE_1 ParserErrors = 1861 - SCHEMAV_CVC_ATTRIBUTE_2 ParserErrors = 1862 - SCHEMAV_CVC_ATTRIBUTE_3 ParserErrors = 1863 - SCHEMAV_CVC_ATTRIBUTE_4 ParserErrors = 1864 - SCHEMAV_CVC_COMPLEX_TYPE_3_1 ParserErrors = 1865 - SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 ParserErrors = 1866 - SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 ParserErrors = 1867 - SCHEMAV_CVC_COMPLEX_TYPE_4 ParserErrors = 1868 - SCHEMAV_CVC_COMPLEX_TYPE_5_1 ParserErrors = 1869 - SCHEMAV_CVC_COMPLEX_TYPE_5_2 ParserErrors = 1870 - SCHEMAV_ELEMENT_CONTENT ParserErrors = 1871 - SCHEMAV_DOCUMENT_ELEMENT_MISSING ParserErrors = 1872 - SCHEMAV_CVC_COMPLEX_TYPE_1 ParserErrors = 1873 - SCHEMAV_CVC_AU ParserErrors = 1874 - SCHEMAV_CVC_TYPE_1 ParserErrors = 1875 - SCHEMAV_CVC_TYPE_2 ParserErrors = 1876 - SCHEMAV_CVC_IDC ParserErrors = 1877 - SCHEMAV_CVC_WILDCARD ParserErrors = 1878 - SCHEMAV_MISC ParserErrors = 1879 - XPTR_UNKNOWN_SCHEME ParserErrors = 1900 - XPTR_CHILDSEQ_START ParserErrors = 1901 - XPTR_EVAL_FAILED ParserErrors = 1902 - XPTR_EXTRA_OBJECTS ParserErrors = 1903 - C14N_CREATE_CTXT ParserErrors = 1950 - C14N_REQUIRES_UTF8 ParserErrors = 1951 - C14N_CREATE_STACK ParserErrors = 1952 - C14N_INVALID_NODE ParserErrors = 1953 - C14N_UNKNOW_NODE ParserErrors = 1954 - C14N_RELATIVE_NAMESPACE ParserErrors = 1955 - FTP_PASV_ANSWER ParserErrors = 2000 - FTP_EPSV_ANSWER ParserErrors = 2001 - FTP_ACCNT ParserErrors = 2002 - FTP_URL_SYNTAX ParserErrors = 2003 - HTTP_URL_SYNTAX ParserErrors = 2020 - HTTP_USE_IP ParserErrors = 2021 - HTTP_UNKNOWN_HOST ParserErrors = 2022 - SCHEMAP_SRC_SIMPLE_TYPE_1 ParserErrors = 3000 - SCHEMAP_SRC_SIMPLE_TYPE_2 ParserErrors = 3001 - SCHEMAP_SRC_SIMPLE_TYPE_3 ParserErrors = 3002 - SCHEMAP_SRC_SIMPLE_TYPE_4 ParserErrors = 3003 - SCHEMAP_SRC_RESOLVE ParserErrors = 3004 - SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE ParserErrors = 3005 - SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE ParserErrors = 3006 - SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES ParserErrors = 3007 - SCHEMAP_ST_PROPS_CORRECT_1 ParserErrors = 3008 - SCHEMAP_ST_PROPS_CORRECT_2 ParserErrors = 3009 - SCHEMAP_ST_PROPS_CORRECT_3 ParserErrors = 3010 - SCHEMAP_COS_ST_RESTRICTS_1_1 ParserErrors = 3011 - SCHEMAP_COS_ST_RESTRICTS_1_2 ParserErrors = 3012 - SCHEMAP_COS_ST_RESTRICTS_1_3_1 ParserErrors = 3013 - SCHEMAP_COS_ST_RESTRICTS_1_3_2 ParserErrors = 3014 - SCHEMAP_COS_ST_RESTRICTS_2_1 ParserErrors = 3015 - SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 ParserErrors = 3016 - SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 ParserErrors = 3017 - SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 ParserErrors = 3018 - SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 ParserErrors = 3019 - SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 ParserErrors = 3020 - SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 ParserErrors = 3021 - SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 ParserErrors = 3022 - SCHEMAP_COS_ST_RESTRICTS_3_1 ParserErrors = 3023 - SCHEMAP_COS_ST_RESTRICTS_3_3_1 ParserErrors = 3024 - SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 ParserErrors = 3025 - SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 ParserErrors = 3026 - SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 ParserErrors = 3027 - SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 ParserErrors = 3028 - SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 ParserErrors = 3029 - SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 ParserErrors = 3030 - SCHEMAP_COS_ST_DERIVED_OK_2_1 ParserErrors = 3031 - SCHEMAP_COS_ST_DERIVED_OK_2_2 ParserErrors = 3032 - SCHEMAP_S4S_ELEM_NOT_ALLOWED ParserErrors = 3033 - SCHEMAP_S4S_ELEM_MISSING ParserErrors = 3034 - SCHEMAP_S4S_ATTR_NOT_ALLOWED ParserErrors = 3035 - SCHEMAP_S4S_ATTR_MISSING ParserErrors = 3036 - SCHEMAP_S4S_ATTR_INVALID_VALUE ParserErrors = 3037 - SCHEMAP_SRC_ELEMENT_1 ParserErrors = 3038 - SCHEMAP_SRC_ELEMENT_2_1 ParserErrors = 3039 - SCHEMAP_SRC_ELEMENT_2_2 ParserErrors = 3040 - SCHEMAP_SRC_ELEMENT_3 ParserErrors = 3041 - SCHEMAP_P_PROPS_CORRECT_1 ParserErrors = 3042 - SCHEMAP_P_PROPS_CORRECT_2_1 ParserErrors = 3043 - SCHEMAP_P_PROPS_CORRECT_2_2 ParserErrors = 3044 - SCHEMAP_E_PROPS_CORRECT_2 ParserErrors = 3045 - SCHEMAP_E_PROPS_CORRECT_3 ParserErrors = 3046 - SCHEMAP_E_PROPS_CORRECT_4 ParserErrors = 3047 - SCHEMAP_E_PROPS_CORRECT_5 ParserErrors = 3048 - SCHEMAP_E_PROPS_CORRECT_6 ParserErrors = 3049 - SCHEMAP_SRC_INCLUDE ParserErrors = 3050 - SCHEMAP_SRC_ATTRIBUTE_1 ParserErrors = 3051 - SCHEMAP_SRC_ATTRIBUTE_2 ParserErrors = 3052 - SCHEMAP_SRC_ATTRIBUTE_3_1 ParserErrors = 3053 - SCHEMAP_SRC_ATTRIBUTE_3_2 ParserErrors = 3054 - SCHEMAP_SRC_ATTRIBUTE_4 ParserErrors = 3055 - SCHEMAP_NO_XMLNS ParserErrors = 3056 - SCHEMAP_NO_XSI ParserErrors = 3057 - SCHEMAP_COS_VALID_DEFAULT_1 ParserErrors = 3058 - SCHEMAP_COS_VALID_DEFAULT_2_1 ParserErrors = 3059 - SCHEMAP_COS_VALID_DEFAULT_2_2_1 ParserErrors = 3060 - SCHEMAP_COS_VALID_DEFAULT_2_2_2 ParserErrors = 3061 - SCHEMAP_CVC_SIMPLE_TYPE ParserErrors = 3062 - SCHEMAP_COS_CT_EXTENDS_1_1 ParserErrors = 3063 - SCHEMAP_SRC_IMPORT_1_1 ParserErrors = 3064 - SCHEMAP_SRC_IMPORT_1_2 ParserErrors = 3065 - SCHEMAP_SRC_IMPORT_2 ParserErrors = 3066 - SCHEMAP_SRC_IMPORT_2_1 ParserErrors = 3067 - SCHEMAP_SRC_IMPORT_2_2 ParserErrors = 3068 - SCHEMAP_INTERNAL ParserErrors = 3069 - SCHEMAP_NOT_DETERMINISTIC ParserErrors = 3070 - SCHEMAP_SRC_ATTRIBUTE_GROUP_1 ParserErrors = 3071 - SCHEMAP_SRC_ATTRIBUTE_GROUP_2 ParserErrors = 3072 - SCHEMAP_SRC_ATTRIBUTE_GROUP_3 ParserErrors = 3073 - SCHEMAP_MG_PROPS_CORRECT_1 ParserErrors = 3074 - SCHEMAP_MG_PROPS_CORRECT_2 ParserErrors = 3075 - SCHEMAP_SRC_CT_1 ParserErrors = 3076 - SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 ParserErrors = 3077 - SCHEMAP_AU_PROPS_CORRECT_2 ParserErrors = 3078 - SCHEMAP_A_PROPS_CORRECT_2 ParserErrors = 3079 - SCHEMAP_C_PROPS_CORRECT ParserErrors = 3080 - SCHEMAP_SRC_REDEFINE ParserErrors = 3081 - SCHEMAP_SRC_IMPORT ParserErrors = 3082 - SCHEMAP_WARN_SKIP_SCHEMA ParserErrors = 3083 - SCHEMAP_WARN_UNLOCATED_SCHEMA ParserErrors = 3084 - SCHEMAP_WARN_ATTR_REDECL_PROH ParserErrors = 3085 - SCHEMAP_WARN_ATTR_POINTLESS_PROH ParserErrors = 3086 - SCHEMAP_AG_PROPS_CORRECT ParserErrors = 3087 - SCHEMAP_COS_CT_EXTENDS_1_2 ParserErrors = 3088 - SCHEMAP_AU_PROPS_CORRECT ParserErrors = 3089 - SCHEMAP_A_PROPS_CORRECT_3 ParserErrors = 3090 - SCHEMAP_COS_ALL_LIMITED ParserErrors = 3091 - SCHEMATRONV_ASSERT ParserErrors = 4000 - SCHEMATRONV_REPORT ParserErrors = 4001 - MODULE_OPEN ParserErrors = 4900 - MODULE_CLOSE ParserErrors = 4901 - CHECK_FOUND_ELEMENT ParserErrors = 5000 - CHECK_FOUND_ATTRIBUTE ParserErrors = 5001 - CHECK_FOUND_TEXT ParserErrors = 5002 - CHECK_FOUND_CDATA ParserErrors = 5003 - CHECK_FOUND_ENTITYREF ParserErrors = 5004 - CHECK_FOUND_ENTITY ParserErrors = 5005 - CHECK_FOUND_PI ParserErrors = 5006 - CHECK_FOUND_COMMENT ParserErrors = 5007 - CHECK_FOUND_DOCTYPE ParserErrors = 5008 - CHECK_FOUND_FRAGMENT ParserErrors = 5009 - CHECK_FOUND_NOTATION ParserErrors = 5010 - CHECK_UNKNOWN_NODE ParserErrors = 5011 - CHECK_ENTITY_TYPE ParserErrors = 5012 - CHECK_NO_PARENT ParserErrors = 5013 - CHECK_NO_DOC ParserErrors = 5014 - CHECK_NO_NAME ParserErrors = 5015 - CHECK_NO_ELEM ParserErrors = 5016 - CHECK_WRONG_DOC ParserErrors = 5017 - CHECK_NO_PREV ParserErrors = 5018 - CHECK_WRONG_PREV ParserErrors = 5019 - CHECK_NO_NEXT ParserErrors = 5020 - CHECK_WRONG_NEXT ParserErrors = 5021 - CHECK_NOT_DTD ParserErrors = 5022 - CHECK_NOT_ATTR ParserErrors = 5023 - CHECK_NOT_ATTR_DECL ParserErrors = 5024 - CHECK_NOT_ELEM_DECL ParserErrors = 5025 - CHECK_NOT_ENTITY_DECL ParserErrors = 5026 - CHECK_NOT_NS_DECL ParserErrors = 5027 - CHECK_NO_HREF ParserErrors = 5028 - CHECK_WRONG_PARENT ParserErrors = 5029 - CHECK_NS_SCOPE ParserErrors = 5030 - CHECK_NS_ANCESTOR ParserErrors = 5031 - CHECK_NOT_UTF8 ParserErrors = 5032 - CHECK_NO_DICT ParserErrors = 5033 - CHECK_NOT_NCNAME ParserErrors = 5034 - CHECK_OUTSIDE_DICT ParserErrors = 5035 - CHECK_WRONG_NAME ParserErrors = 5036 - CHECK_NAME_NOT_NULL ParserErrors = 5037 - I18N_NO_NAME ParserErrors = 6000 - I18N_NO_HANDLER ParserErrors = 6001 - I18N_EXCESS_HANDLER ParserErrors = 6002 - I18N_CONV_FAILED ParserErrors = 6003 - I18N_NO_OUTPUT ParserErrors = 6004 - BUF_OVERFLOW ParserErrors = 7000 -) - -// llgo:type C -type GenericErrorFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type StructuredErrorFunc func(c.Pointer, *Error) - -//go:linkname X__xmlLastError C.__xmlLastError -func X__xmlLastError() *Error - -//go:linkname X__xmlGenericError C.__xmlGenericError -func X__xmlGenericError() GenericErrorFunc - -//go:linkname X__xmlGenericErrorContext C.__xmlGenericErrorContext -func X__xmlGenericErrorContext() *c.Pointer - -//go:linkname X__xmlStructuredError C.__xmlStructuredError -func X__xmlStructuredError() StructuredErrorFunc - -//go:linkname X__xmlStructuredErrorContext C.__xmlStructuredErrorContext -func X__xmlStructuredErrorContext() *c.Pointer - -/* - * Use the following function to reset the two global variables - * xmlGenericError and xmlGenericErrorContext. - */ -//go:linkname SetGenericErrorFunc C.xmlSetGenericErrorFunc -func SetGenericErrorFunc(ctx c.Pointer, handler GenericErrorFunc) - -//go:linkname ThrDefSetGenericErrorFunc C.xmlThrDefSetGenericErrorFunc -func ThrDefSetGenericErrorFunc(ctx c.Pointer, handler GenericErrorFunc) - -//go:linkname InitGenericErrorDefaultFunc C.initGenericErrorDefaultFunc -func InitGenericErrorDefaultFunc(handler GenericErrorFunc) - -//go:linkname SetStructuredErrorFunc C.xmlSetStructuredErrorFunc -func SetStructuredErrorFunc(ctx c.Pointer, handler StructuredErrorFunc) - -//go:linkname ThrDefSetStructuredErrorFunc C.xmlThrDefSetStructuredErrorFunc -func ThrDefSetStructuredErrorFunc(ctx c.Pointer, handler StructuredErrorFunc) - -/* - * Default message routines used by SAX and Valid context for error - * and warning reporting. - */ -//go:linkname ParserError C.xmlParserError -func ParserError(ctx c.Pointer, msg *c.Char, __llgo_va_list ...interface{}) - -//go:linkname ParserWarning C.xmlParserWarning -func ParserWarning(ctx c.Pointer, msg *c.Char, __llgo_va_list ...interface{}) - -//go:linkname ParserValidityError C.xmlParserValidityError -func ParserValidityError(ctx c.Pointer, msg *c.Char, __llgo_va_list ...interface{}) - -//go:linkname ParserValidityWarning C.xmlParserValidityWarning -func ParserValidityWarning(ctx c.Pointer, msg *c.Char, __llgo_va_list ...interface{}) - -/** DOC_ENABLE */ -// llgo:link (*X_xmlParserInput).ParserPrintFileInfo C.xmlParserPrintFileInfo -func (recv_ *X_xmlParserInput) ParserPrintFileInfo() { -} - -// llgo:link (*X_xmlParserInput).ParserPrintFileContext C.xmlParserPrintFileContext -func (recv_ *X_xmlParserInput) ParserPrintFileContext() { -} - -// llgo:link (*Error).FormatError C.xmlFormatError -func (recv_ *Error) FormatError(channel GenericErrorFunc, data c.Pointer) { -} - -/* - * Extended error information routines - */ -//go:linkname GetLastError C.xmlGetLastError -func GetLastError() *Error - -//go:linkname ResetLastError C.xmlResetLastError -func ResetLastError() - -//go:linkname CtxtGetLastError C.xmlCtxtGetLastError -func CtxtGetLastError(ctx c.Pointer) *Error - -//go:linkname CtxtResetLastError C.xmlCtxtResetLastError -func CtxtResetLastError(ctx c.Pointer) - -//go:linkname ResetError C.xmlResetError -func ResetError(err ErrorPtr) - -// llgo:link (*Error).CopyError C.xmlCopyError -func (recv_ *Error) CopyError(to ErrorPtr) c.Int { - return 0 -} diff --git a/libxml2/xmlexports.go b/libxml2/xmlexports.go deleted file mode 100644 index 31e3a101..00000000 --- a/libxml2/xmlexports.go +++ /dev/null @@ -1,12 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -/* - * Originally declared in xmlversion.h which is generated - */ -//go:linkname CheckVersion C.xmlCheckVersion -func CheckVersion(version c.Int) diff --git a/libxml2/xmlmemory.go b/libxml2/xmlmemory.go deleted file mode 100644 index 9debab38..00000000 --- a/libxml2/xmlmemory.go +++ /dev/null @@ -1,95 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// llgo:type C -type FreeFunc func(c.Pointer) - -// llgo:type C -type MallocFunc func(c.SizeT) c.Pointer - -// llgo:type C -type ReallocFunc func(c.Pointer, c.SizeT) c.Pointer - -// llgo:type C -type StrdupFunc func(*c.Char) *c.Char - -/* - * The way to overload the existing functions. - * The xmlGc function have an extra entry for atomic block - * allocations useful for garbage collected memory allocators - */ -//go:linkname MemSetup C.xmlMemSetup -func MemSetup(freeFunc FreeFunc, mallocFunc MallocFunc, reallocFunc ReallocFunc, strdupFunc StrdupFunc) c.Int - -//go:linkname MemGet C.xmlMemGet -func MemGet(freeFunc FreeFunc, mallocFunc MallocFunc, reallocFunc ReallocFunc, strdupFunc StrdupFunc) c.Int - -//go:linkname GcMemSetup C.xmlGcMemSetup -func GcMemSetup(freeFunc FreeFunc, mallocFunc MallocFunc, mallocAtomicFunc MallocFunc, reallocFunc ReallocFunc, strdupFunc StrdupFunc) c.Int - -//go:linkname GcMemGet C.xmlGcMemGet -func GcMemGet(freeFunc FreeFunc, mallocFunc MallocFunc, mallocAtomicFunc MallocFunc, reallocFunc ReallocFunc, strdupFunc StrdupFunc) c.Int - -/* - * Initialization of the memory layer. - */ -//go:linkname InitMemory C.xmlInitMemory -func InitMemory() c.Int - -/* - * Cleanup of the memory layer. - */ -//go:linkname CleanupMemory C.xmlCleanupMemory -func CleanupMemory() - -/* - * These are specific to the XML debug memory wrapper. - */ -//go:linkname MemSize C.xmlMemSize -func MemSize(ptr c.Pointer) c.SizeT - -//go:linkname MemUsed C.xmlMemUsed -func MemUsed() c.Int - -//go:linkname MemBlocks C.xmlMemBlocks -func MemBlocks() c.Int - -//go:linkname MemDisplay C.xmlMemDisplay -func MemDisplay(fp *c.FILE) - -//go:linkname MemDisplayLast C.xmlMemDisplayLast -func MemDisplayLast(fp *c.FILE, nbBytes c.Long) - -//go:linkname MemShow C.xmlMemShow -func MemShow(fp *c.FILE, nr c.Int) - -//go:linkname MemoryDump C.xmlMemoryDump -func MemoryDump() - -//go:linkname MemMalloc C.xmlMemMalloc -func MemMalloc(size c.SizeT) c.Pointer - -//go:linkname MemRealloc C.xmlMemRealloc -func MemRealloc(ptr c.Pointer, size c.SizeT) c.Pointer - -//go:linkname MemFree C.xmlMemFree -func MemFree(ptr c.Pointer) - -//go:linkname MemoryStrdup C.xmlMemoryStrdup -func MemoryStrdup(str *c.Char) *c.Char - -//go:linkname MallocLoc C.xmlMallocLoc -func MallocLoc(size c.SizeT, file *c.Char, line c.Int) c.Pointer - -//go:linkname ReallocLoc C.xmlReallocLoc -func ReallocLoc(ptr c.Pointer, size c.SizeT, file *c.Char, line c.Int) c.Pointer - -//go:linkname MallocAtomicLoc C.xmlMallocAtomicLoc -func MallocAtomicLoc(size c.SizeT, file *c.Char, line c.Int) c.Pointer - -//go:linkname MemStrdupLoc C.xmlMemStrdupLoc -func MemStrdupLoc(str *c.Char, file *c.Char, line c.Int) *c.Char diff --git a/libxml2/xmlmodule.go b/libxml2/xmlmodule.go deleted file mode 100644 index 8d66f5e3..00000000 --- a/libxml2/xmlmodule.go +++ /dev/null @@ -1,30 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlModule struct { - Unused [8]uint8 -} -type Module X_xmlModule -type ModulePtr *Module -type ModuleOption c.Int - -const ( - MODULE_LAZY ModuleOption = 1 - MODULE_LOCAL ModuleOption = 2 -) - -//go:linkname ModuleOpen C.xmlModuleOpen -func ModuleOpen(filename *c.Char, options c.Int) ModulePtr - -//go:linkname ModuleSymbol C.xmlModuleSymbol -func ModuleSymbol(module ModulePtr, name *c.Char, result *c.Pointer) c.Int - -//go:linkname ModuleClose C.xmlModuleClose -func ModuleClose(module ModulePtr) c.Int - -//go:linkname ModuleFree C.xmlModuleFree -func ModuleFree(module ModulePtr) c.Int diff --git a/libxml2/xmlreader.go b/libxml2/xmlreader.go deleted file mode 100644 index 0cf89be6..00000000 --- a/libxml2/xmlreader.go +++ /dev/null @@ -1,360 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type ParserSeverities c.Int - -const ( - PARSER_SEVERITY_VALIDITY_WARNING ParserSeverities = 1 - PARSER_SEVERITY_VALIDITY_ERROR ParserSeverities = 2 - PARSER_SEVERITY_WARNING ParserSeverities = 3 - PARSER_SEVERITY_ERROR ParserSeverities = 4 -) - -type TextReaderMode c.Int - -const ( - TEXTREADER_MODE_INITIAL TextReaderMode = 0 - TEXTREADER_MODE_INTERACTIVE TextReaderMode = 1 - TEXTREADER_MODE_ERROR TextReaderMode = 2 - TEXTREADER_MODE_EOF TextReaderMode = 3 - TEXTREADER_MODE_CLOSED TextReaderMode = 4 - TEXTREADER_MODE_READING TextReaderMode = 5 -) - -type ParserProperties c.Int - -const ( - PARSER_LOADDTD ParserProperties = 1 - PARSER_DEFAULTATTRS ParserProperties = 2 - PARSER_VALIDATE ParserProperties = 3 - PARSER_SUBST_ENTITIES ParserProperties = 4 -) - -type ReaderTypes c.Int - -const ( - READER_TYPE_NONE ReaderTypes = 0 - READER_TYPE_ELEMENT ReaderTypes = 1 - READER_TYPE_ATTRIBUTE ReaderTypes = 2 - READER_TYPE_TEXT ReaderTypes = 3 - READER_TYPE_CDATA ReaderTypes = 4 - READER_TYPE_ENTITY_REFERENCE ReaderTypes = 5 - READER_TYPE_ENTITY ReaderTypes = 6 - READER_TYPE_PROCESSING_INSTRUCTION ReaderTypes = 7 - READER_TYPE_COMMENT ReaderTypes = 8 - READER_TYPE_DOCUMENT ReaderTypes = 9 - READER_TYPE_DOCUMENT_TYPE ReaderTypes = 10 - READER_TYPE_DOCUMENT_FRAGMENT ReaderTypes = 11 - READER_TYPE_NOTATION ReaderTypes = 12 - READER_TYPE_WHITESPACE ReaderTypes = 13 - READER_TYPE_SIGNIFICANT_WHITESPACE ReaderTypes = 14 - READER_TYPE_END_ELEMENT ReaderTypes = 15 - READER_TYPE_END_ENTITY ReaderTypes = 16 - READER_TYPE_XML_DECLARATION ReaderTypes = 17 -) - -type X_xmlTextReader struct { - Unused [8]uint8 -} -type TextReader X_xmlTextReader -type TextReaderPtr *TextReader - -/* - * Constructors & Destructor - */ -//go:linkname NewTextReader C.xmlNewTextReader -func NewTextReader(input ParserInputBufferPtr, URI *c.Char) TextReaderPtr - -//go:linkname NewTextReaderFilename C.xmlNewTextReaderFilename -func NewTextReaderFilename(URI *c.Char) TextReaderPtr - -//go:linkname FreeTextReader C.xmlFreeTextReader -func FreeTextReader(reader TextReaderPtr) - -//go:linkname TextReaderSetup C.xmlTextReaderSetup -func TextReaderSetup(reader TextReaderPtr, input ParserInputBufferPtr, URL *c.Char, encoding *c.Char, options c.Int) c.Int - -//go:linkname TextReaderSetMaxAmplification C.xmlTextReaderSetMaxAmplification -func TextReaderSetMaxAmplification(reader TextReaderPtr, maxAmpl c.Uint) - -//go:linkname TextReaderGetLastError C.xmlTextReaderGetLastError -func TextReaderGetLastError(reader TextReaderPtr) *Error - -/* - * Iterators - */ -//go:linkname TextReaderRead C.xmlTextReaderRead -func TextReaderRead(reader TextReaderPtr) c.Int - -//go:linkname TextReaderReadInnerXml C.xmlTextReaderReadInnerXml -func TextReaderReadInnerXml(reader TextReaderPtr) *Char - -//go:linkname TextReaderReadOuterXml C.xmlTextReaderReadOuterXml -func TextReaderReadOuterXml(reader TextReaderPtr) *Char - -//go:linkname TextReaderReadString C.xmlTextReaderReadString -func TextReaderReadString(reader TextReaderPtr) *Char - -//go:linkname TextReaderReadAttributeValue C.xmlTextReaderReadAttributeValue -func TextReaderReadAttributeValue(reader TextReaderPtr) c.Int - -/* - * Attributes of the node - */ -//go:linkname TextReaderAttributeCount C.xmlTextReaderAttributeCount -func TextReaderAttributeCount(reader TextReaderPtr) c.Int - -//go:linkname TextReaderDepth C.xmlTextReaderDepth -func TextReaderDepth(reader TextReaderPtr) c.Int - -//go:linkname TextReaderHasAttributes C.xmlTextReaderHasAttributes -func TextReaderHasAttributes(reader TextReaderPtr) c.Int - -//go:linkname TextReaderHasValue C.xmlTextReaderHasValue -func TextReaderHasValue(reader TextReaderPtr) c.Int - -//go:linkname TextReaderIsDefault C.xmlTextReaderIsDefault -func TextReaderIsDefault(reader TextReaderPtr) c.Int - -//go:linkname TextReaderIsEmptyElement C.xmlTextReaderIsEmptyElement -func TextReaderIsEmptyElement(reader TextReaderPtr) c.Int - -//go:linkname TextReaderNodeType C.xmlTextReaderNodeType -func TextReaderNodeType(reader TextReaderPtr) c.Int - -//go:linkname TextReaderQuoteChar C.xmlTextReaderQuoteChar -func TextReaderQuoteChar(reader TextReaderPtr) c.Int - -//go:linkname TextReaderReadState C.xmlTextReaderReadState -func TextReaderReadState(reader TextReaderPtr) c.Int - -//go:linkname TextReaderIsNamespaceDecl C.xmlTextReaderIsNamespaceDecl -func TextReaderIsNamespaceDecl(reader TextReaderPtr) c.Int - -//go:linkname TextReaderConstBaseUri C.xmlTextReaderConstBaseUri -func TextReaderConstBaseUri(reader TextReaderPtr) *Char - -//go:linkname TextReaderConstLocalName C.xmlTextReaderConstLocalName -func TextReaderConstLocalName(reader TextReaderPtr) *Char - -//go:linkname TextReaderConstName C.xmlTextReaderConstName -func TextReaderConstName(reader TextReaderPtr) *Char - -//go:linkname TextReaderConstNamespaceUri C.xmlTextReaderConstNamespaceUri -func TextReaderConstNamespaceUri(reader TextReaderPtr) *Char - -//go:linkname TextReaderConstPrefix C.xmlTextReaderConstPrefix -func TextReaderConstPrefix(reader TextReaderPtr) *Char - -//go:linkname TextReaderConstXmlLang C.xmlTextReaderConstXmlLang -func TextReaderConstXmlLang(reader TextReaderPtr) *Char - -//go:linkname TextReaderConstString C.xmlTextReaderConstString -func TextReaderConstString(reader TextReaderPtr, str *Char) *Char - -//go:linkname TextReaderConstValue C.xmlTextReaderConstValue -func TextReaderConstValue(reader TextReaderPtr) *Char - -/* - * use the Const version of the routine for - * better performance and simpler code - */ -//go:linkname TextReaderBaseUri C.xmlTextReaderBaseUri -func TextReaderBaseUri(reader TextReaderPtr) *Char - -//go:linkname TextReaderLocalName C.xmlTextReaderLocalName -func TextReaderLocalName(reader TextReaderPtr) *Char - -//go:linkname TextReaderName C.xmlTextReaderName -func TextReaderName(reader TextReaderPtr) *Char - -//go:linkname TextReaderNamespaceUri C.xmlTextReaderNamespaceUri -func TextReaderNamespaceUri(reader TextReaderPtr) *Char - -//go:linkname TextReaderPrefix C.xmlTextReaderPrefix -func TextReaderPrefix(reader TextReaderPtr) *Char - -//go:linkname TextReaderXmlLang C.xmlTextReaderXmlLang -func TextReaderXmlLang(reader TextReaderPtr) *Char - -//go:linkname TextReaderValue C.xmlTextReaderValue -func TextReaderValue(reader TextReaderPtr) *Char - -/* - * Methods of the XmlTextReader - */ -//go:linkname TextReaderClose C.xmlTextReaderClose -func TextReaderClose(reader TextReaderPtr) c.Int - -//go:linkname TextReaderGetAttributeNo C.xmlTextReaderGetAttributeNo -func TextReaderGetAttributeNo(reader TextReaderPtr, no c.Int) *Char - -//go:linkname TextReaderGetAttribute C.xmlTextReaderGetAttribute -func TextReaderGetAttribute(reader TextReaderPtr, name *Char) *Char - -//go:linkname TextReaderGetAttributeNs C.xmlTextReaderGetAttributeNs -func TextReaderGetAttributeNs(reader TextReaderPtr, localName *Char, namespaceURI *Char) *Char - -//go:linkname TextReaderGetRemainder C.xmlTextReaderGetRemainder -func TextReaderGetRemainder(reader TextReaderPtr) ParserInputBufferPtr - -//go:linkname TextReaderLookupNamespace C.xmlTextReaderLookupNamespace -func TextReaderLookupNamespace(reader TextReaderPtr, prefix *Char) *Char - -//go:linkname TextReaderMoveToAttributeNo C.xmlTextReaderMoveToAttributeNo -func TextReaderMoveToAttributeNo(reader TextReaderPtr, no c.Int) c.Int - -//go:linkname TextReaderMoveToAttribute C.xmlTextReaderMoveToAttribute -func TextReaderMoveToAttribute(reader TextReaderPtr, name *Char) c.Int - -//go:linkname TextReaderMoveToAttributeNs C.xmlTextReaderMoveToAttributeNs -func TextReaderMoveToAttributeNs(reader TextReaderPtr, localName *Char, namespaceURI *Char) c.Int - -//go:linkname TextReaderMoveToFirstAttribute C.xmlTextReaderMoveToFirstAttribute -func TextReaderMoveToFirstAttribute(reader TextReaderPtr) c.Int - -//go:linkname TextReaderMoveToNextAttribute C.xmlTextReaderMoveToNextAttribute -func TextReaderMoveToNextAttribute(reader TextReaderPtr) c.Int - -//go:linkname TextReaderMoveToElement C.xmlTextReaderMoveToElement -func TextReaderMoveToElement(reader TextReaderPtr) c.Int - -//go:linkname TextReaderNormalization C.xmlTextReaderNormalization -func TextReaderNormalization(reader TextReaderPtr) c.Int - -//go:linkname TextReaderConstEncoding C.xmlTextReaderConstEncoding -func TextReaderConstEncoding(reader TextReaderPtr) *Char - -/* - * Extensions - */ -//go:linkname TextReaderSetParserProp C.xmlTextReaderSetParserProp -func TextReaderSetParserProp(reader TextReaderPtr, prop c.Int, value c.Int) c.Int - -//go:linkname TextReaderGetParserProp C.xmlTextReaderGetParserProp -func TextReaderGetParserProp(reader TextReaderPtr, prop c.Int) c.Int - -//go:linkname TextReaderCurrentNode C.xmlTextReaderCurrentNode -func TextReaderCurrentNode(reader TextReaderPtr) NodePtr - -//go:linkname TextReaderGetParserLineNumber C.xmlTextReaderGetParserLineNumber -func TextReaderGetParserLineNumber(reader TextReaderPtr) c.Int - -//go:linkname TextReaderGetParserColumnNumber C.xmlTextReaderGetParserColumnNumber -func TextReaderGetParserColumnNumber(reader TextReaderPtr) c.Int - -//go:linkname TextReaderPreserve C.xmlTextReaderPreserve -func TextReaderPreserve(reader TextReaderPtr) NodePtr - -//go:linkname TextReaderPreservePattern C.xmlTextReaderPreservePattern -func TextReaderPreservePattern(reader TextReaderPtr, pattern *Char, namespaces **Char) c.Int - -//go:linkname TextReaderCurrentDoc C.xmlTextReaderCurrentDoc -func TextReaderCurrentDoc(reader TextReaderPtr) DocPtr - -//go:linkname TextReaderExpand C.xmlTextReaderExpand -func TextReaderExpand(reader TextReaderPtr) NodePtr - -//go:linkname TextReaderNext C.xmlTextReaderNext -func TextReaderNext(reader TextReaderPtr) c.Int - -//go:linkname TextReaderNextSibling C.xmlTextReaderNextSibling -func TextReaderNextSibling(reader TextReaderPtr) c.Int - -//go:linkname TextReaderIsValid C.xmlTextReaderIsValid -func TextReaderIsValid(reader TextReaderPtr) c.Int - -//go:linkname TextReaderRelaxNGValidate C.xmlTextReaderRelaxNGValidate -func TextReaderRelaxNGValidate(reader TextReaderPtr, rng *c.Char) c.Int - -//go:linkname TextReaderRelaxNGValidateCtxt C.xmlTextReaderRelaxNGValidateCtxt -func TextReaderRelaxNGValidateCtxt(reader TextReaderPtr, ctxt RelaxNGValidCtxtPtr, options c.Int) c.Int - -//go:linkname TextReaderRelaxNGSetSchema C.xmlTextReaderRelaxNGSetSchema -func TextReaderRelaxNGSetSchema(reader TextReaderPtr, schema RelaxNGPtr) c.Int - -//go:linkname TextReaderSchemaValidate C.xmlTextReaderSchemaValidate -func TextReaderSchemaValidate(reader TextReaderPtr, xsd *c.Char) c.Int - -//go:linkname TextReaderSchemaValidateCtxt C.xmlTextReaderSchemaValidateCtxt -func TextReaderSchemaValidateCtxt(reader TextReaderPtr, ctxt SchemaValidCtxtPtr, options c.Int) c.Int - -//go:linkname TextReaderSetSchema C.xmlTextReaderSetSchema -func TextReaderSetSchema(reader TextReaderPtr, schema SchemaPtr) c.Int - -//go:linkname TextReaderConstXmlVersion C.xmlTextReaderConstXmlVersion -func TextReaderConstXmlVersion(reader TextReaderPtr) *Char - -//go:linkname TextReaderStandalone C.xmlTextReaderStandalone -func TextReaderStandalone(reader TextReaderPtr) c.Int - -/* - * Index lookup - */ -//go:linkname TextReaderByteConsumed C.xmlTextReaderByteConsumed -func TextReaderByteConsumed(reader TextReaderPtr) c.Long - -/* - * New more complete APIs for simpler creation and reuse of readers - */ -//go:linkname ReaderWalker C.xmlReaderWalker -func ReaderWalker(doc DocPtr) TextReaderPtr - -// llgo:link (*Char).ReaderForDoc C.xmlReaderForDoc -func (recv_ *Char) ReaderForDoc(URL *c.Char, encoding *c.Char, options c.Int) TextReaderPtr { - return nil -} - -//go:linkname ReaderForFile C.xmlReaderForFile -func ReaderForFile(filename *c.Char, encoding *c.Char, options c.Int) TextReaderPtr - -//go:linkname ReaderForMemory C.xmlReaderForMemory -func ReaderForMemory(buffer *c.Char, size c.Int, URL *c.Char, encoding *c.Char, options c.Int) TextReaderPtr - -//go:linkname ReaderForFd C.xmlReaderForFd -func ReaderForFd(fd c.Int, URL *c.Char, encoding *c.Char, options c.Int) TextReaderPtr - -//go:linkname ReaderForIO C.xmlReaderForIO -func ReaderForIO(ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, URL *c.Char, encoding *c.Char, options c.Int) TextReaderPtr - -//go:linkname ReaderNewWalker C.xmlReaderNewWalker -func ReaderNewWalker(reader TextReaderPtr, doc DocPtr) c.Int - -//go:linkname ReaderNewDoc C.xmlReaderNewDoc -func ReaderNewDoc(reader TextReaderPtr, cur *Char, URL *c.Char, encoding *c.Char, options c.Int) c.Int - -//go:linkname ReaderNewFile C.xmlReaderNewFile -func ReaderNewFile(reader TextReaderPtr, filename *c.Char, encoding *c.Char, options c.Int) c.Int - -//go:linkname ReaderNewMemory C.xmlReaderNewMemory -func ReaderNewMemory(reader TextReaderPtr, buffer *c.Char, size c.Int, URL *c.Char, encoding *c.Char, options c.Int) c.Int - -//go:linkname ReaderNewFd C.xmlReaderNewFd -func ReaderNewFd(reader TextReaderPtr, fd c.Int, URL *c.Char, encoding *c.Char, options c.Int) c.Int - -//go:linkname ReaderNewIO C.xmlReaderNewIO -func ReaderNewIO(reader TextReaderPtr, ioread InputReadCallback, ioclose InputCloseCallback, ioctx c.Pointer, URL *c.Char, encoding *c.Char, options c.Int) c.Int - -type TextReaderLocatorPtr c.Pointer - -// llgo:type C -type TextReaderErrorFunc func(c.Pointer, *c.Char, ParserSeverities, TextReaderLocatorPtr) - -//go:linkname TextReaderLocatorLineNumber C.xmlTextReaderLocatorLineNumber -func TextReaderLocatorLineNumber(locator TextReaderLocatorPtr) c.Int - -//go:linkname TextReaderLocatorBaseURI C.xmlTextReaderLocatorBaseURI -func TextReaderLocatorBaseURI(locator TextReaderLocatorPtr) *Char - -//go:linkname TextReaderSetErrorHandler C.xmlTextReaderSetErrorHandler -func TextReaderSetErrorHandler(reader TextReaderPtr, f TextReaderErrorFunc, arg c.Pointer) - -//go:linkname TextReaderSetStructuredErrorHandler C.xmlTextReaderSetStructuredErrorHandler -func TextReaderSetStructuredErrorHandler(reader TextReaderPtr, f StructuredErrorFunc, arg c.Pointer) - -//go:linkname TextReaderGetErrorHandler C.xmlTextReaderGetErrorHandler -func TextReaderGetErrorHandler(reader TextReaderPtr, f TextReaderErrorFunc, arg *c.Pointer) diff --git a/libxml2/xmlregexp.go b/libxml2/xmlregexp.go deleted file mode 100644 index 9f18e62a..00000000 --- a/libxml2/xmlregexp.go +++ /dev/null @@ -1,62 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlRegexp struct { - Unused [8]uint8 -} -type Regexp X_xmlRegexp -type RegexpPtr *Regexp - -type X_xmlRegExecCtxt struct { - Unused [8]uint8 -} -type RegExecCtxt X_xmlRegExecCtxt -type RegExecCtxtPtr *RegExecCtxt - -/* - * The POSIX like API - */ -// llgo:link (*Char).RegexpCompile C.xmlRegexpCompile -func (recv_ *Char) RegexpCompile() RegexpPtr { - return nil -} - -//go:linkname RegFreeRegexp C.xmlRegFreeRegexp -func RegFreeRegexp(regexp RegexpPtr) - -//go:linkname RegexpExec C.xmlRegexpExec -func RegexpExec(comp RegexpPtr, value *Char) c.Int - -//go:linkname RegexpPrint C.xmlRegexpPrint -func RegexpPrint(output *c.FILE, regexp RegexpPtr) - -//go:linkname RegexpIsDeterminist C.xmlRegexpIsDeterminist -func RegexpIsDeterminist(comp RegexpPtr) c.Int - -// llgo:type C -type RegExecCallbacks func(RegExecCtxtPtr, *Char, c.Pointer, c.Pointer) - -/* - * The progressive API - */ -//go:linkname RegNewExecCtxt C.xmlRegNewExecCtxt -func RegNewExecCtxt(comp RegexpPtr, callback RegExecCallbacks, data c.Pointer) RegExecCtxtPtr - -//go:linkname RegFreeExecCtxt C.xmlRegFreeExecCtxt -func RegFreeExecCtxt(exec RegExecCtxtPtr) - -//go:linkname RegExecPushString C.xmlRegExecPushString -func RegExecPushString(exec RegExecCtxtPtr, value *Char, data c.Pointer) c.Int - -//go:linkname RegExecPushString2 C.xmlRegExecPushString2 -func RegExecPushString2(exec RegExecCtxtPtr, value *Char, value2 *Char, data c.Pointer) c.Int - -//go:linkname RegExecNextValues C.xmlRegExecNextValues -func RegExecNextValues(exec RegExecCtxtPtr, nbval *c.Int, nbneg *c.Int, values **Char, terminal *c.Int) c.Int - -//go:linkname RegExecErrInfo C.xmlRegExecErrInfo -func RegExecErrInfo(exec RegExecCtxtPtr, string **Char, nbval *c.Int, nbneg *c.Int, values **Char, terminal *c.Int) c.Int diff --git a/libxml2/xmlsave.go b/libxml2/xmlsave.go deleted file mode 100644 index 0248cbc3..00000000 --- a/libxml2/xmlsave.go +++ /dev/null @@ -1,67 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type SaveOption c.Int - -const ( - SAVE_FORMAT SaveOption = 1 - SAVE_NO_DECL SaveOption = 2 - SAVE_NO_EMPTY SaveOption = 4 - SAVE_NO_XHTML SaveOption = 8 - SAVE_XHTML SaveOption = 16 - SAVE_AS_XML SaveOption = 32 - SAVE_AS_HTML SaveOption = 64 - SAVE_WSNONSIG SaveOption = 128 -) - -type X_xmlSaveCtxt struct { - Unused [8]uint8 -} -type SaveCtxt X_xmlSaveCtxt -type SaveCtxtPtr *SaveCtxt - -//go:linkname SaveToFd C.xmlSaveToFd -func SaveToFd(fd c.Int, encoding *c.Char, options c.Int) SaveCtxtPtr - -//go:linkname SaveToFilename C.xmlSaveToFilename -func SaveToFilename(filename *c.Char, encoding *c.Char, options c.Int) SaveCtxtPtr - -//go:linkname SaveToBuffer C.xmlSaveToBuffer -func SaveToBuffer(buffer BufferPtr, encoding *c.Char, options c.Int) SaveCtxtPtr - -//go:linkname SaveToIO C.xmlSaveToIO -func SaveToIO(iowrite OutputWriteCallback, ioclose OutputCloseCallback, ioctx c.Pointer, encoding *c.Char, options c.Int) SaveCtxtPtr - -//go:linkname SaveDoc C.xmlSaveDoc -func SaveDoc(ctxt SaveCtxtPtr, doc DocPtr) c.Long - -//go:linkname SaveTree C.xmlSaveTree -func SaveTree(ctxt SaveCtxtPtr, node NodePtr) c.Long - -//go:linkname SaveFlush C.xmlSaveFlush -func SaveFlush(ctxt SaveCtxtPtr) c.Int - -//go:linkname SaveClose C.xmlSaveClose -func SaveClose(ctxt SaveCtxtPtr) c.Int - -//go:linkname SaveFinish C.xmlSaveFinish -func SaveFinish(ctxt SaveCtxtPtr) c.Int - -//go:linkname SaveSetEscape C.xmlSaveSetEscape -func SaveSetEscape(ctxt SaveCtxtPtr, escape CharEncodingOutputFunc) c.Int - -//go:linkname SaveSetAttrEscape C.xmlSaveSetAttrEscape -func SaveSetAttrEscape(ctxt SaveCtxtPtr, escape CharEncodingOutputFunc) c.Int - -//go:linkname ThrDefIndentTreeOutput C.xmlThrDefIndentTreeOutput -func ThrDefIndentTreeOutput(v c.Int) c.Int - -//go:linkname ThrDefTreeIndentString C.xmlThrDefTreeIndentString -func ThrDefTreeIndentString(v *c.Char) *c.Char - -//go:linkname ThrDefSaveNoEmptyTags C.xmlThrDefSaveNoEmptyTags -func ThrDefSaveNoEmptyTags(v c.Int) c.Int diff --git a/libxml2/xmlschemas.go b/libxml2/xmlschemas.go deleted file mode 100644 index 792a0fd1..00000000 --- a/libxml2/xmlschemas.go +++ /dev/null @@ -1,158 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type SchemaValidError c.Int - -const ( - SCHEMAS_ERR_OK SchemaValidError = 0 - SCHEMAS_ERR_NOROOT SchemaValidError = 1 - SCHEMAS_ERR_UNDECLAREDELEM SchemaValidError = 2 - SCHEMAS_ERR_NOTTOPLEVEL SchemaValidError = 3 - SCHEMAS_ERR_MISSING SchemaValidError = 4 - SCHEMAS_ERR_WRONGELEM SchemaValidError = 5 - SCHEMAS_ERR_NOTYPE SchemaValidError = 6 - SCHEMAS_ERR_NOROLLBACK SchemaValidError = 7 - SCHEMAS_ERR_ISABSTRACT SchemaValidError = 8 - SCHEMAS_ERR_NOTEMPTY SchemaValidError = 9 - SCHEMAS_ERR_ELEMCONT SchemaValidError = 10 - SCHEMAS_ERR_HAVEDEFAULT SchemaValidError = 11 - SCHEMAS_ERR_NOTNILLABLE SchemaValidError = 12 - SCHEMAS_ERR_EXTRACONTENT SchemaValidError = 13 - SCHEMAS_ERR_INVALIDATTR SchemaValidError = 14 - SCHEMAS_ERR_INVALIDELEM SchemaValidError = 15 - SCHEMAS_ERR_NOTDETERMINIST SchemaValidError = 16 - SCHEMAS_ERR_CONSTRUCT SchemaValidError = 17 - SCHEMAS_ERR_INTERNAL SchemaValidError = 18 - SCHEMAS_ERR_NOTSIMPLE SchemaValidError = 19 - SCHEMAS_ERR_ATTRUNKNOWN SchemaValidError = 20 - SCHEMAS_ERR_ATTRINVALID SchemaValidError = 21 - SCHEMAS_ERR_VALUE SchemaValidError = 22 - SCHEMAS_ERR_FACET SchemaValidError = 23 - SCHEMAS_ERR_ SchemaValidError = 24 - SCHEMAS_ERR_XXX SchemaValidError = 25 -) - -type SchemaValidOption c.Int - -const SCHEMA_VAL_VC_I_CREATE SchemaValidOption = 1 - -type Schema X_xmlSchema -type SchemaPtr *Schema - -// llgo:type C -type SchemaValidityErrorFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -// llgo:type C -type SchemaValidityWarningFunc func(__llgo_arg_0 c.Pointer, __llgo_arg_1 *c.Char, __llgo_va_list ...interface{}) - -type X_xmlSchemaParserCtxt struct { - Unused [8]uint8 -} -type SchemaParserCtxt X_xmlSchemaParserCtxt -type SchemaParserCtxtPtr *SchemaParserCtxt - -type X_xmlSchemaValidCtxt struct { - Unused [8]uint8 -} -type SchemaValidCtxt X_xmlSchemaValidCtxt -type SchemaValidCtxtPtr *SchemaValidCtxt - -// llgo:type C -type SchemaValidityLocatorFunc func(c.Pointer, **c.Char, *c.Ulong) c.Int - -/* - * Interfaces for parsing. - */ -//go:linkname SchemaNewParserCtxt C.xmlSchemaNewParserCtxt -func SchemaNewParserCtxt(URL *c.Char) SchemaParserCtxtPtr - -//go:linkname SchemaNewMemParserCtxt C.xmlSchemaNewMemParserCtxt -func SchemaNewMemParserCtxt(buffer *c.Char, size c.Int) SchemaParserCtxtPtr - -//go:linkname SchemaNewDocParserCtxt C.xmlSchemaNewDocParserCtxt -func SchemaNewDocParserCtxt(doc DocPtr) SchemaParserCtxtPtr - -//go:linkname SchemaFreeParserCtxt C.xmlSchemaFreeParserCtxt -func SchemaFreeParserCtxt(ctxt SchemaParserCtxtPtr) - -//go:linkname SchemaSetParserErrors C.xmlSchemaSetParserErrors -func SchemaSetParserErrors(ctxt SchemaParserCtxtPtr, err SchemaValidityErrorFunc, warn SchemaValidityWarningFunc, ctx c.Pointer) - -//go:linkname SchemaSetParserStructuredErrors C.xmlSchemaSetParserStructuredErrors -func SchemaSetParserStructuredErrors(ctxt SchemaParserCtxtPtr, serror StructuredErrorFunc, ctx c.Pointer) - -//go:linkname SchemaGetParserErrors C.xmlSchemaGetParserErrors -func SchemaGetParserErrors(ctxt SchemaParserCtxtPtr, err SchemaValidityErrorFunc, warn SchemaValidityWarningFunc, ctx *c.Pointer) c.Int - -//go:linkname SchemaIsValid C.xmlSchemaIsValid -func SchemaIsValid(ctxt SchemaValidCtxtPtr) c.Int - -//go:linkname SchemaParse C.xmlSchemaParse -func SchemaParse(ctxt SchemaParserCtxtPtr) SchemaPtr - -//go:linkname SchemaFree C.xmlSchemaFree -func SchemaFree(schema SchemaPtr) - -//go:linkname SchemaDump C.xmlSchemaDump -func SchemaDump(output *c.FILE, schema SchemaPtr) - -/* - * Interfaces for validating - */ -//go:linkname SchemaSetValidErrors C.xmlSchemaSetValidErrors -func SchemaSetValidErrors(ctxt SchemaValidCtxtPtr, err SchemaValidityErrorFunc, warn SchemaValidityWarningFunc, ctx c.Pointer) - -//go:linkname SchemaSetValidStructuredErrors C.xmlSchemaSetValidStructuredErrors -func SchemaSetValidStructuredErrors(ctxt SchemaValidCtxtPtr, serror StructuredErrorFunc, ctx c.Pointer) - -//go:linkname SchemaGetValidErrors C.xmlSchemaGetValidErrors -func SchemaGetValidErrors(ctxt SchemaValidCtxtPtr, err SchemaValidityErrorFunc, warn SchemaValidityWarningFunc, ctx *c.Pointer) c.Int - -//go:linkname SchemaSetValidOptions C.xmlSchemaSetValidOptions -func SchemaSetValidOptions(ctxt SchemaValidCtxtPtr, options c.Int) c.Int - -//go:linkname SchemaValidateSetFilename C.xmlSchemaValidateSetFilename -func SchemaValidateSetFilename(vctxt SchemaValidCtxtPtr, filename *c.Char) - -//go:linkname SchemaValidCtxtGetOptions C.xmlSchemaValidCtxtGetOptions -func SchemaValidCtxtGetOptions(ctxt SchemaValidCtxtPtr) c.Int - -//go:linkname SchemaNewValidCtxt C.xmlSchemaNewValidCtxt -func SchemaNewValidCtxt(schema SchemaPtr) SchemaValidCtxtPtr - -//go:linkname SchemaFreeValidCtxt C.xmlSchemaFreeValidCtxt -func SchemaFreeValidCtxt(ctxt SchemaValidCtxtPtr) - -//go:linkname SchemaValidateDoc C.xmlSchemaValidateDoc -func SchemaValidateDoc(ctxt SchemaValidCtxtPtr, instance DocPtr) c.Int - -//go:linkname SchemaValidateOneElement C.xmlSchemaValidateOneElement -func SchemaValidateOneElement(ctxt SchemaValidCtxtPtr, elem NodePtr) c.Int - -//go:linkname SchemaValidateStream C.xmlSchemaValidateStream -func SchemaValidateStream(ctxt SchemaValidCtxtPtr, input ParserInputBufferPtr, enc CharEncoding, sax SAXHandlerPtr, user_data c.Pointer) c.Int - -//go:linkname SchemaValidateFile C.xmlSchemaValidateFile -func SchemaValidateFile(ctxt SchemaValidCtxtPtr, filename *c.Char, options c.Int) c.Int - -//go:linkname SchemaValidCtxtGetParserCtxt C.xmlSchemaValidCtxtGetParserCtxt -func SchemaValidCtxtGetParserCtxt(ctxt SchemaValidCtxtPtr) ParserCtxtPtr - -type X_xmlSchemaSAXPlug struct { - Unused [8]uint8 -} -type SchemaSAXPlugStruct X_xmlSchemaSAXPlug -type SchemaSAXPlugPtr *SchemaSAXPlugStruct - -//go:linkname SchemaSAXPlug C.xmlSchemaSAXPlug -func SchemaSAXPlug(ctxt SchemaValidCtxtPtr, sax *SAXHandlerPtr, user_data *c.Pointer) SchemaSAXPlugPtr - -//go:linkname SchemaSAXUnplug C.xmlSchemaSAXUnplug -func SchemaSAXUnplug(plug SchemaSAXPlugPtr) c.Int - -//go:linkname SchemaValidateSetLocator C.xmlSchemaValidateSetLocator -func SchemaValidateSetLocator(vctxt SchemaValidCtxtPtr, f SchemaValidityLocatorFunc, ctxt c.Pointer) diff --git a/libxml2/xmlschemastypes.go b/libxml2/xmlschemastypes.go deleted file mode 100644 index 41a261a9..00000000 --- a/libxml2/xmlschemastypes.go +++ /dev/null @@ -1,131 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type SchemaWhitespaceValueType c.Int - -const ( - SCHEMA_WHITESPACE_UNKNOWN SchemaWhitespaceValueType = 0 - SCHEMA_WHITESPACE_PRESERVE SchemaWhitespaceValueType = 1 - SCHEMA_WHITESPACE_REPLACE SchemaWhitespaceValueType = 2 - SCHEMA_WHITESPACE_COLLAPSE SchemaWhitespaceValueType = 3 -) - -//go:linkname SchemaInitTypes C.xmlSchemaInitTypes -func SchemaInitTypes() c.Int - -//go:linkname SchemaCleanupTypes C.xmlSchemaCleanupTypes -func SchemaCleanupTypes() - -// llgo:link (*Char).SchemaGetPredefinedType C.xmlSchemaGetPredefinedType -func (recv_ *Char) SchemaGetPredefinedType(ns *Char) SchemaTypePtr { - return nil -} - -//go:linkname SchemaValidatePredefinedType C.xmlSchemaValidatePredefinedType -func SchemaValidatePredefinedType(type_ SchemaTypePtr, value *Char, val *SchemaValPtr) c.Int - -//go:linkname SchemaValPredefTypeNode C.xmlSchemaValPredefTypeNode -func SchemaValPredefTypeNode(type_ SchemaTypePtr, value *Char, val *SchemaValPtr, node NodePtr) c.Int - -//go:linkname SchemaValidateFacet C.xmlSchemaValidateFacet -func SchemaValidateFacet(base SchemaTypePtr, facet SchemaFacetPtr, value *Char, val SchemaValPtr) c.Int - -//go:linkname SchemaValidateFacetWhtsp C.xmlSchemaValidateFacetWhtsp -func SchemaValidateFacetWhtsp(facet SchemaFacetPtr, fws SchemaWhitespaceValueType, valType SchemaValType, value *Char, val SchemaValPtr, ws SchemaWhitespaceValueType) c.Int - -//go:linkname SchemaFreeValue C.xmlSchemaFreeValue -func SchemaFreeValue(val SchemaValPtr) - -//go:linkname SchemaNewFacet C.xmlSchemaNewFacet -func SchemaNewFacet() SchemaFacetPtr - -//go:linkname SchemaCheckFacet C.xmlSchemaCheckFacet -func SchemaCheckFacet(facet SchemaFacetPtr, typeDecl SchemaTypePtr, ctxt SchemaParserCtxtPtr, name *Char) c.Int - -//go:linkname SchemaFreeFacet C.xmlSchemaFreeFacet -func SchemaFreeFacet(facet SchemaFacetPtr) - -//go:linkname SchemaCompareValues C.xmlSchemaCompareValues -func SchemaCompareValues(x SchemaValPtr, y SchemaValPtr) c.Int - -//go:linkname SchemaGetBuiltInListSimpleTypeItemType C.xmlSchemaGetBuiltInListSimpleTypeItemType -func SchemaGetBuiltInListSimpleTypeItemType(type_ SchemaTypePtr) SchemaTypePtr - -//go:linkname SchemaValidateListSimpleTypeFacet C.xmlSchemaValidateListSimpleTypeFacet -func SchemaValidateListSimpleTypeFacet(facet SchemaFacetPtr, value *Char, actualLen c.Ulong, expectedLen *c.Ulong) c.Int - -// llgo:link SchemaValType.SchemaGetBuiltInType C.xmlSchemaGetBuiltInType -func (recv_ SchemaValType) SchemaGetBuiltInType() SchemaTypePtr { - return nil -} - -//go:linkname SchemaIsBuiltInTypeFacet C.xmlSchemaIsBuiltInTypeFacet -func SchemaIsBuiltInTypeFacet(type_ SchemaTypePtr, facetType c.Int) c.Int - -// llgo:link (*Char).SchemaCollapseString C.xmlSchemaCollapseString -func (recv_ *Char) SchemaCollapseString() *Char { - return nil -} - -// llgo:link (*Char).SchemaWhiteSpaceReplace C.xmlSchemaWhiteSpaceReplace -func (recv_ *Char) SchemaWhiteSpaceReplace() *Char { - return nil -} - -//go:linkname SchemaGetFacetValueAsULong C.xmlSchemaGetFacetValueAsULong -func SchemaGetFacetValueAsULong(facet SchemaFacetPtr) c.Ulong - -//go:linkname SchemaValidateLengthFacet C.xmlSchemaValidateLengthFacet -func SchemaValidateLengthFacet(type_ SchemaTypePtr, facet SchemaFacetPtr, value *Char, val SchemaValPtr, length *c.Ulong) c.Int - -//go:linkname SchemaValidateLengthFacetWhtsp C.xmlSchemaValidateLengthFacetWhtsp -func SchemaValidateLengthFacetWhtsp(facet SchemaFacetPtr, valType SchemaValType, value *Char, val SchemaValPtr, length *c.Ulong, ws SchemaWhitespaceValueType) c.Int - -//go:linkname SchemaValPredefTypeNodeNoNorm C.xmlSchemaValPredefTypeNodeNoNorm -func SchemaValPredefTypeNodeNoNorm(type_ SchemaTypePtr, value *Char, val *SchemaValPtr, node NodePtr) c.Int - -//go:linkname SchemaGetCanonValue C.xmlSchemaGetCanonValue -func SchemaGetCanonValue(val SchemaValPtr, retValue **Char) c.Int - -//go:linkname SchemaGetCanonValueWhtsp C.xmlSchemaGetCanonValueWhtsp -func SchemaGetCanonValueWhtsp(val SchemaValPtr, retValue **Char, ws SchemaWhitespaceValueType) c.Int - -//go:linkname SchemaValueAppend C.xmlSchemaValueAppend -func SchemaValueAppend(prev SchemaValPtr, cur SchemaValPtr) c.Int - -//go:linkname SchemaValueGetNext C.xmlSchemaValueGetNext -func SchemaValueGetNext(cur SchemaValPtr) SchemaValPtr - -//go:linkname SchemaValueGetAsString C.xmlSchemaValueGetAsString -func SchemaValueGetAsString(val SchemaValPtr) *Char - -//go:linkname SchemaValueGetAsBoolean C.xmlSchemaValueGetAsBoolean -func SchemaValueGetAsBoolean(val SchemaValPtr) c.Int - -// llgo:link SchemaValType.SchemaNewStringValue C.xmlSchemaNewStringValue -func (recv_ SchemaValType) SchemaNewStringValue(value *Char) SchemaValPtr { - return nil -} - -// llgo:link (*Char).SchemaNewNOTATIONValue C.xmlSchemaNewNOTATIONValue -func (recv_ *Char) SchemaNewNOTATIONValue(ns *Char) SchemaValPtr { - return nil -} - -// llgo:link (*Char).SchemaNewQNameValue C.xmlSchemaNewQNameValue -func (recv_ *Char) SchemaNewQNameValue(localName *Char) SchemaValPtr { - return nil -} - -//go:linkname SchemaCompareValuesWhtsp C.xmlSchemaCompareValuesWhtsp -func SchemaCompareValuesWhtsp(x SchemaValPtr, xws SchemaWhitespaceValueType, y SchemaValPtr, yws SchemaWhitespaceValueType) c.Int - -//go:linkname SchemaCopyValue C.xmlSchemaCopyValue -func SchemaCopyValue(val SchemaValPtr) SchemaValPtr - -//go:linkname SchemaGetValType C.xmlSchemaGetValType -func SchemaGetValType(val SchemaValPtr) SchemaValType diff --git a/libxml2/xmlstring.go b/libxml2/xmlstring.go deleted file mode 100644 index c24fea98..00000000 --- a/libxml2/xmlstring.go +++ /dev/null @@ -1,151 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type Char c.Char - -/* - * xmlChar handling - */ -// llgo:link (*Char).Strdup C.xmlStrdup -func (recv_ *Char) Strdup() *Char { - return nil -} - -// llgo:link (*Char).Strndup C.xmlStrndup -func (recv_ *Char) Strndup(len c.Int) *Char { - return nil -} - -//go:linkname CharStrndup C.xmlCharStrndup -func CharStrndup(cur *c.Char, len c.Int) *Char - -//go:linkname CharStrdup C.xmlCharStrdup -func CharStrdup(cur *c.Char) *Char - -// llgo:link (*Char).Strsub C.xmlStrsub -func (recv_ *Char) Strsub(start c.Int, len c.Int) *Char { - return nil -} - -// llgo:link (*Char).Strchr C.xmlStrchr -func (recv_ *Char) Strchr(val Char) *Char { - return nil -} - -// llgo:link (*Char).Strstr C.xmlStrstr -func (recv_ *Char) Strstr(val *Char) *Char { - return nil -} - -// llgo:link (*Char).Strcasestr C.xmlStrcasestr -func (recv_ *Char) Strcasestr(val *Char) *Char { - return nil -} - -// llgo:link (*Char).Strcmp C.xmlStrcmp -func (recv_ *Char) Strcmp(str2 *Char) c.Int { - return 0 -} - -// llgo:link (*Char).Strncmp C.xmlStrncmp -func (recv_ *Char) Strncmp(str2 *Char, len c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).Strcasecmp C.xmlStrcasecmp -func (recv_ *Char) Strcasecmp(str2 *Char) c.Int { - return 0 -} - -// llgo:link (*Char).Strncasecmp C.xmlStrncasecmp -func (recv_ *Char) Strncasecmp(str2 *Char, len c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).StrEqual C.xmlStrEqual -func (recv_ *Char) StrEqual(str2 *Char) c.Int { - return 0 -} - -// llgo:link (*Char).StrQEqual C.xmlStrQEqual -func (recv_ *Char) StrQEqual(name *Char, str *Char) c.Int { - return 0 -} - -// llgo:link (*Char).Strlen C.xmlStrlen -func (recv_ *Char) Strlen() c.Int { - return 0 -} - -// llgo:link (*Char).Strcat C.xmlStrcat -func (recv_ *Char) Strcat(add *Char) *Char { - return nil -} - -// llgo:link (*Char).Strncat C.xmlStrncat -func (recv_ *Char) Strncat(add *Char, len c.Int) *Char { - return nil -} - -// llgo:link (*Char).StrncatNew C.xmlStrncatNew -func (recv_ *Char) StrncatNew(str2 *Char, len c.Int) *Char { - return nil -} - -//go:linkname StrPrintf C.xmlStrPrintf -func StrPrintf(buf *Char, len c.Int, msg *c.Char, __llgo_va_list ...interface{}) c.Int - -// llgo:link (*Char).StrVPrintf C.xmlStrVPrintf -func (recv_ *Char) StrVPrintf(len c.Int, msg *c.Char, ap c.VaList) c.Int { - return 0 -} - -//go:linkname GetUTF8Char C.xmlGetUTF8Char -func GetUTF8Char(utf *c.Char, len *c.Int) c.Int - -//go:linkname CheckUTF8 C.xmlCheckUTF8 -func CheckUTF8(utf *c.Char) c.Int - -// llgo:link (*Char).UTF8Strsize C.xmlUTF8Strsize -func (recv_ *Char) UTF8Strsize(len c.Int) c.Int { - return 0 -} - -// llgo:link (*Char).UTF8Strndup C.xmlUTF8Strndup -func (recv_ *Char) UTF8Strndup(len c.Int) *Char { - return nil -} - -// llgo:link (*Char).UTF8Strpos C.xmlUTF8Strpos -func (recv_ *Char) UTF8Strpos(pos c.Int) *Char { - return nil -} - -// llgo:link (*Char).UTF8Strloc C.xmlUTF8Strloc -func (recv_ *Char) UTF8Strloc(utfchar *Char) c.Int { - return 0 -} - -// llgo:link (*Char).UTF8Strsub C.xmlUTF8Strsub -func (recv_ *Char) UTF8Strsub(start c.Int, len c.Int) *Char { - return nil -} - -// llgo:link (*Char).UTF8Strlen C.xmlUTF8Strlen -func (recv_ *Char) UTF8Strlen() c.Int { - return 0 -} - -// llgo:link (*Char).UTF8Size C.xmlUTF8Size -func (recv_ *Char) UTF8Size() c.Int { - return 0 -} - -// llgo:link (*Char).UTF8Charcmp C.xmlUTF8Charcmp -func (recv_ *Char) UTF8Charcmp(utf2 *Char) c.Int { - return 0 -} diff --git a/libxml2/xmlunicode.go b/libxml2/xmlunicode.go deleted file mode 100644 index 1545f174..00000000 --- a/libxml2/xmlunicode.go +++ /dev/null @@ -1,504 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname UCSIsAegeanNumbers C.xmlUCSIsAegeanNumbers -func UCSIsAegeanNumbers(code c.Int) c.Int - -//go:linkname UCSIsAlphabeticPresentationForms C.xmlUCSIsAlphabeticPresentationForms -func UCSIsAlphabeticPresentationForms(code c.Int) c.Int - -//go:linkname UCSIsArabic C.xmlUCSIsArabic -func UCSIsArabic(code c.Int) c.Int - -//go:linkname UCSIsArabicPresentationFormsA C.xmlUCSIsArabicPresentationFormsA -func UCSIsArabicPresentationFormsA(code c.Int) c.Int - -//go:linkname UCSIsArabicPresentationFormsB C.xmlUCSIsArabicPresentationFormsB -func UCSIsArabicPresentationFormsB(code c.Int) c.Int - -//go:linkname UCSIsArmenian C.xmlUCSIsArmenian -func UCSIsArmenian(code c.Int) c.Int - -//go:linkname UCSIsArrows C.xmlUCSIsArrows -func UCSIsArrows(code c.Int) c.Int - -//go:linkname UCSIsBasicLatin C.xmlUCSIsBasicLatin -func UCSIsBasicLatin(code c.Int) c.Int - -//go:linkname UCSIsBengali C.xmlUCSIsBengali -func UCSIsBengali(code c.Int) c.Int - -//go:linkname UCSIsBlockElements C.xmlUCSIsBlockElements -func UCSIsBlockElements(code c.Int) c.Int - -//go:linkname UCSIsBopomofo C.xmlUCSIsBopomofo -func UCSIsBopomofo(code c.Int) c.Int - -//go:linkname UCSIsBopomofoExtended C.xmlUCSIsBopomofoExtended -func UCSIsBopomofoExtended(code c.Int) c.Int - -//go:linkname UCSIsBoxDrawing C.xmlUCSIsBoxDrawing -func UCSIsBoxDrawing(code c.Int) c.Int - -//go:linkname UCSIsBraillePatterns C.xmlUCSIsBraillePatterns -func UCSIsBraillePatterns(code c.Int) c.Int - -//go:linkname UCSIsBuhid C.xmlUCSIsBuhid -func UCSIsBuhid(code c.Int) c.Int - -//go:linkname UCSIsByzantineMusicalSymbols C.xmlUCSIsByzantineMusicalSymbols -func UCSIsByzantineMusicalSymbols(code c.Int) c.Int - -//go:linkname UCSIsCJKCompatibility C.xmlUCSIsCJKCompatibility -func UCSIsCJKCompatibility(code c.Int) c.Int - -//go:linkname UCSIsCJKCompatibilityForms C.xmlUCSIsCJKCompatibilityForms -func UCSIsCJKCompatibilityForms(code c.Int) c.Int - -//go:linkname UCSIsCJKCompatibilityIdeographs C.xmlUCSIsCJKCompatibilityIdeographs -func UCSIsCJKCompatibilityIdeographs(code c.Int) c.Int - -//go:linkname UCSIsCJKCompatibilityIdeographsSupplement C.xmlUCSIsCJKCompatibilityIdeographsSupplement -func UCSIsCJKCompatibilityIdeographsSupplement(code c.Int) c.Int - -//go:linkname UCSIsCJKRadicalsSupplement C.xmlUCSIsCJKRadicalsSupplement -func UCSIsCJKRadicalsSupplement(code c.Int) c.Int - -//go:linkname UCSIsCJKSymbolsandPunctuation C.xmlUCSIsCJKSymbolsandPunctuation -func UCSIsCJKSymbolsandPunctuation(code c.Int) c.Int - -//go:linkname UCSIsCJKUnifiedIdeographs C.xmlUCSIsCJKUnifiedIdeographs -func UCSIsCJKUnifiedIdeographs(code c.Int) c.Int - -//go:linkname UCSIsCJKUnifiedIdeographsExtensionA C.xmlUCSIsCJKUnifiedIdeographsExtensionA -func UCSIsCJKUnifiedIdeographsExtensionA(code c.Int) c.Int - -//go:linkname UCSIsCJKUnifiedIdeographsExtensionB C.xmlUCSIsCJKUnifiedIdeographsExtensionB -func UCSIsCJKUnifiedIdeographsExtensionB(code c.Int) c.Int - -//go:linkname UCSIsCherokee C.xmlUCSIsCherokee -func UCSIsCherokee(code c.Int) c.Int - -//go:linkname UCSIsCombiningDiacriticalMarks C.xmlUCSIsCombiningDiacriticalMarks -func UCSIsCombiningDiacriticalMarks(code c.Int) c.Int - -//go:linkname UCSIsCombiningDiacriticalMarksforSymbols C.xmlUCSIsCombiningDiacriticalMarksforSymbols -func UCSIsCombiningDiacriticalMarksforSymbols(code c.Int) c.Int - -//go:linkname UCSIsCombiningHalfMarks C.xmlUCSIsCombiningHalfMarks -func UCSIsCombiningHalfMarks(code c.Int) c.Int - -//go:linkname UCSIsCombiningMarksforSymbols C.xmlUCSIsCombiningMarksforSymbols -func UCSIsCombiningMarksforSymbols(code c.Int) c.Int - -//go:linkname UCSIsControlPictures C.xmlUCSIsControlPictures -func UCSIsControlPictures(code c.Int) c.Int - -//go:linkname UCSIsCurrencySymbols C.xmlUCSIsCurrencySymbols -func UCSIsCurrencySymbols(code c.Int) c.Int - -//go:linkname UCSIsCypriotSyllabary C.xmlUCSIsCypriotSyllabary -func UCSIsCypriotSyllabary(code c.Int) c.Int - -//go:linkname UCSIsCyrillic C.xmlUCSIsCyrillic -func UCSIsCyrillic(code c.Int) c.Int - -//go:linkname UCSIsCyrillicSupplement C.xmlUCSIsCyrillicSupplement -func UCSIsCyrillicSupplement(code c.Int) c.Int - -//go:linkname UCSIsDeseret C.xmlUCSIsDeseret -func UCSIsDeseret(code c.Int) c.Int - -//go:linkname UCSIsDevanagari C.xmlUCSIsDevanagari -func UCSIsDevanagari(code c.Int) c.Int - -//go:linkname UCSIsDingbats C.xmlUCSIsDingbats -func UCSIsDingbats(code c.Int) c.Int - -//go:linkname UCSIsEnclosedAlphanumerics C.xmlUCSIsEnclosedAlphanumerics -func UCSIsEnclosedAlphanumerics(code c.Int) c.Int - -//go:linkname UCSIsEnclosedCJKLettersandMonths C.xmlUCSIsEnclosedCJKLettersandMonths -func UCSIsEnclosedCJKLettersandMonths(code c.Int) c.Int - -//go:linkname UCSIsEthiopic C.xmlUCSIsEthiopic -func UCSIsEthiopic(code c.Int) c.Int - -//go:linkname UCSIsGeneralPunctuation C.xmlUCSIsGeneralPunctuation -func UCSIsGeneralPunctuation(code c.Int) c.Int - -//go:linkname UCSIsGeometricShapes C.xmlUCSIsGeometricShapes -func UCSIsGeometricShapes(code c.Int) c.Int - -//go:linkname UCSIsGeorgian C.xmlUCSIsGeorgian -func UCSIsGeorgian(code c.Int) c.Int - -//go:linkname UCSIsGothic C.xmlUCSIsGothic -func UCSIsGothic(code c.Int) c.Int - -//go:linkname UCSIsGreek C.xmlUCSIsGreek -func UCSIsGreek(code c.Int) c.Int - -//go:linkname UCSIsGreekExtended C.xmlUCSIsGreekExtended -func UCSIsGreekExtended(code c.Int) c.Int - -//go:linkname UCSIsGreekandCoptic C.xmlUCSIsGreekandCoptic -func UCSIsGreekandCoptic(code c.Int) c.Int - -//go:linkname UCSIsGujarati C.xmlUCSIsGujarati -func UCSIsGujarati(code c.Int) c.Int - -//go:linkname UCSIsGurmukhi C.xmlUCSIsGurmukhi -func UCSIsGurmukhi(code c.Int) c.Int - -//go:linkname UCSIsHalfwidthandFullwidthForms C.xmlUCSIsHalfwidthandFullwidthForms -func UCSIsHalfwidthandFullwidthForms(code c.Int) c.Int - -//go:linkname UCSIsHangulCompatibilityJamo C.xmlUCSIsHangulCompatibilityJamo -func UCSIsHangulCompatibilityJamo(code c.Int) c.Int - -//go:linkname UCSIsHangulJamo C.xmlUCSIsHangulJamo -func UCSIsHangulJamo(code c.Int) c.Int - -//go:linkname UCSIsHangulSyllables C.xmlUCSIsHangulSyllables -func UCSIsHangulSyllables(code c.Int) c.Int - -//go:linkname UCSIsHanunoo C.xmlUCSIsHanunoo -func UCSIsHanunoo(code c.Int) c.Int - -//go:linkname UCSIsHebrew C.xmlUCSIsHebrew -func UCSIsHebrew(code c.Int) c.Int - -//go:linkname UCSIsHighPrivateUseSurrogates C.xmlUCSIsHighPrivateUseSurrogates -func UCSIsHighPrivateUseSurrogates(code c.Int) c.Int - -//go:linkname UCSIsHighSurrogates C.xmlUCSIsHighSurrogates -func UCSIsHighSurrogates(code c.Int) c.Int - -//go:linkname UCSIsHiragana C.xmlUCSIsHiragana -func UCSIsHiragana(code c.Int) c.Int - -//go:linkname UCSIsIPAExtensions C.xmlUCSIsIPAExtensions -func UCSIsIPAExtensions(code c.Int) c.Int - -//go:linkname UCSIsIdeographicDescriptionCharacters C.xmlUCSIsIdeographicDescriptionCharacters -func UCSIsIdeographicDescriptionCharacters(code c.Int) c.Int - -//go:linkname UCSIsKanbun C.xmlUCSIsKanbun -func UCSIsKanbun(code c.Int) c.Int - -//go:linkname UCSIsKangxiRadicals C.xmlUCSIsKangxiRadicals -func UCSIsKangxiRadicals(code c.Int) c.Int - -//go:linkname UCSIsKannada C.xmlUCSIsKannada -func UCSIsKannada(code c.Int) c.Int - -//go:linkname UCSIsKatakana C.xmlUCSIsKatakana -func UCSIsKatakana(code c.Int) c.Int - -//go:linkname UCSIsKatakanaPhoneticExtensions C.xmlUCSIsKatakanaPhoneticExtensions -func UCSIsKatakanaPhoneticExtensions(code c.Int) c.Int - -//go:linkname UCSIsKhmer C.xmlUCSIsKhmer -func UCSIsKhmer(code c.Int) c.Int - -//go:linkname UCSIsKhmerSymbols C.xmlUCSIsKhmerSymbols -func UCSIsKhmerSymbols(code c.Int) c.Int - -//go:linkname UCSIsLao C.xmlUCSIsLao -func UCSIsLao(code c.Int) c.Int - -//go:linkname UCSIsLatin1Supplement C.xmlUCSIsLatin1Supplement -func UCSIsLatin1Supplement(code c.Int) c.Int - -//go:linkname UCSIsLatinExtendedA C.xmlUCSIsLatinExtendedA -func UCSIsLatinExtendedA(code c.Int) c.Int - -//go:linkname UCSIsLatinExtendedB C.xmlUCSIsLatinExtendedB -func UCSIsLatinExtendedB(code c.Int) c.Int - -//go:linkname UCSIsLatinExtendedAdditional C.xmlUCSIsLatinExtendedAdditional -func UCSIsLatinExtendedAdditional(code c.Int) c.Int - -//go:linkname UCSIsLetterlikeSymbols C.xmlUCSIsLetterlikeSymbols -func UCSIsLetterlikeSymbols(code c.Int) c.Int - -//go:linkname UCSIsLimbu C.xmlUCSIsLimbu -func UCSIsLimbu(code c.Int) c.Int - -//go:linkname UCSIsLinearBIdeograms C.xmlUCSIsLinearBIdeograms -func UCSIsLinearBIdeograms(code c.Int) c.Int - -//go:linkname UCSIsLinearBSyllabary C.xmlUCSIsLinearBSyllabary -func UCSIsLinearBSyllabary(code c.Int) c.Int - -//go:linkname UCSIsLowSurrogates C.xmlUCSIsLowSurrogates -func UCSIsLowSurrogates(code c.Int) c.Int - -//go:linkname UCSIsMalayalam C.xmlUCSIsMalayalam -func UCSIsMalayalam(code c.Int) c.Int - -//go:linkname UCSIsMathematicalAlphanumericSymbols C.xmlUCSIsMathematicalAlphanumericSymbols -func UCSIsMathematicalAlphanumericSymbols(code c.Int) c.Int - -//go:linkname UCSIsMathematicalOperators C.xmlUCSIsMathematicalOperators -func UCSIsMathematicalOperators(code c.Int) c.Int - -//go:linkname UCSIsMiscellaneousMathematicalSymbolsA C.xmlUCSIsMiscellaneousMathematicalSymbolsA -func UCSIsMiscellaneousMathematicalSymbolsA(code c.Int) c.Int - -//go:linkname UCSIsMiscellaneousMathematicalSymbolsB C.xmlUCSIsMiscellaneousMathematicalSymbolsB -func UCSIsMiscellaneousMathematicalSymbolsB(code c.Int) c.Int - -//go:linkname UCSIsMiscellaneousSymbols C.xmlUCSIsMiscellaneousSymbols -func UCSIsMiscellaneousSymbols(code c.Int) c.Int - -//go:linkname UCSIsMiscellaneousSymbolsandArrows C.xmlUCSIsMiscellaneousSymbolsandArrows -func UCSIsMiscellaneousSymbolsandArrows(code c.Int) c.Int - -//go:linkname UCSIsMiscellaneousTechnical C.xmlUCSIsMiscellaneousTechnical -func UCSIsMiscellaneousTechnical(code c.Int) c.Int - -//go:linkname UCSIsMongolian C.xmlUCSIsMongolian -func UCSIsMongolian(code c.Int) c.Int - -//go:linkname UCSIsMusicalSymbols C.xmlUCSIsMusicalSymbols -func UCSIsMusicalSymbols(code c.Int) c.Int - -//go:linkname UCSIsMyanmar C.xmlUCSIsMyanmar -func UCSIsMyanmar(code c.Int) c.Int - -//go:linkname UCSIsNumberForms C.xmlUCSIsNumberForms -func UCSIsNumberForms(code c.Int) c.Int - -//go:linkname UCSIsOgham C.xmlUCSIsOgham -func UCSIsOgham(code c.Int) c.Int - -//go:linkname UCSIsOldItalic C.xmlUCSIsOldItalic -func UCSIsOldItalic(code c.Int) c.Int - -//go:linkname UCSIsOpticalCharacterRecognition C.xmlUCSIsOpticalCharacterRecognition -func UCSIsOpticalCharacterRecognition(code c.Int) c.Int - -//go:linkname UCSIsOriya C.xmlUCSIsOriya -func UCSIsOriya(code c.Int) c.Int - -//go:linkname UCSIsOsmanya C.xmlUCSIsOsmanya -func UCSIsOsmanya(code c.Int) c.Int - -//go:linkname UCSIsPhoneticExtensions C.xmlUCSIsPhoneticExtensions -func UCSIsPhoneticExtensions(code c.Int) c.Int - -//go:linkname UCSIsPrivateUse C.xmlUCSIsPrivateUse -func UCSIsPrivateUse(code c.Int) c.Int - -//go:linkname UCSIsPrivateUseArea C.xmlUCSIsPrivateUseArea -func UCSIsPrivateUseArea(code c.Int) c.Int - -//go:linkname UCSIsRunic C.xmlUCSIsRunic -func UCSIsRunic(code c.Int) c.Int - -//go:linkname UCSIsShavian C.xmlUCSIsShavian -func UCSIsShavian(code c.Int) c.Int - -//go:linkname UCSIsSinhala C.xmlUCSIsSinhala -func UCSIsSinhala(code c.Int) c.Int - -//go:linkname UCSIsSmallFormVariants C.xmlUCSIsSmallFormVariants -func UCSIsSmallFormVariants(code c.Int) c.Int - -//go:linkname UCSIsSpacingModifierLetters C.xmlUCSIsSpacingModifierLetters -func UCSIsSpacingModifierLetters(code c.Int) c.Int - -//go:linkname UCSIsSpecials C.xmlUCSIsSpecials -func UCSIsSpecials(code c.Int) c.Int - -//go:linkname UCSIsSuperscriptsandSubscripts C.xmlUCSIsSuperscriptsandSubscripts -func UCSIsSuperscriptsandSubscripts(code c.Int) c.Int - -//go:linkname UCSIsSupplementalArrowsA C.xmlUCSIsSupplementalArrowsA -func UCSIsSupplementalArrowsA(code c.Int) c.Int - -//go:linkname UCSIsSupplementalArrowsB C.xmlUCSIsSupplementalArrowsB -func UCSIsSupplementalArrowsB(code c.Int) c.Int - -//go:linkname UCSIsSupplementalMathematicalOperators C.xmlUCSIsSupplementalMathematicalOperators -func UCSIsSupplementalMathematicalOperators(code c.Int) c.Int - -//go:linkname UCSIsSupplementaryPrivateUseAreaA C.xmlUCSIsSupplementaryPrivateUseAreaA -func UCSIsSupplementaryPrivateUseAreaA(code c.Int) c.Int - -//go:linkname UCSIsSupplementaryPrivateUseAreaB C.xmlUCSIsSupplementaryPrivateUseAreaB -func UCSIsSupplementaryPrivateUseAreaB(code c.Int) c.Int - -//go:linkname UCSIsSyriac C.xmlUCSIsSyriac -func UCSIsSyriac(code c.Int) c.Int - -//go:linkname UCSIsTagalog C.xmlUCSIsTagalog -func UCSIsTagalog(code c.Int) c.Int - -//go:linkname UCSIsTagbanwa C.xmlUCSIsTagbanwa -func UCSIsTagbanwa(code c.Int) c.Int - -//go:linkname UCSIsTags C.xmlUCSIsTags -func UCSIsTags(code c.Int) c.Int - -//go:linkname UCSIsTaiLe C.xmlUCSIsTaiLe -func UCSIsTaiLe(code c.Int) c.Int - -//go:linkname UCSIsTaiXuanJingSymbols C.xmlUCSIsTaiXuanJingSymbols -func UCSIsTaiXuanJingSymbols(code c.Int) c.Int - -//go:linkname UCSIsTamil C.xmlUCSIsTamil -func UCSIsTamil(code c.Int) c.Int - -//go:linkname UCSIsTelugu C.xmlUCSIsTelugu -func UCSIsTelugu(code c.Int) c.Int - -//go:linkname UCSIsThaana C.xmlUCSIsThaana -func UCSIsThaana(code c.Int) c.Int - -//go:linkname UCSIsThai C.xmlUCSIsThai -func UCSIsThai(code c.Int) c.Int - -//go:linkname UCSIsTibetan C.xmlUCSIsTibetan -func UCSIsTibetan(code c.Int) c.Int - -//go:linkname UCSIsUgaritic C.xmlUCSIsUgaritic -func UCSIsUgaritic(code c.Int) c.Int - -//go:linkname UCSIsUnifiedCanadianAboriginalSyllabics C.xmlUCSIsUnifiedCanadianAboriginalSyllabics -func UCSIsUnifiedCanadianAboriginalSyllabics(code c.Int) c.Int - -//go:linkname UCSIsVariationSelectors C.xmlUCSIsVariationSelectors -func UCSIsVariationSelectors(code c.Int) c.Int - -//go:linkname UCSIsVariationSelectorsSupplement C.xmlUCSIsVariationSelectorsSupplement -func UCSIsVariationSelectorsSupplement(code c.Int) c.Int - -//go:linkname UCSIsYiRadicals C.xmlUCSIsYiRadicals -func UCSIsYiRadicals(code c.Int) c.Int - -//go:linkname UCSIsYiSyllables C.xmlUCSIsYiSyllables -func UCSIsYiSyllables(code c.Int) c.Int - -//go:linkname UCSIsYijingHexagramSymbols C.xmlUCSIsYijingHexagramSymbols -func UCSIsYijingHexagramSymbols(code c.Int) c.Int - -//go:linkname UCSIsBlock C.xmlUCSIsBlock -func UCSIsBlock(code c.Int, block *c.Char) c.Int - -//go:linkname UCSIsCatC C.xmlUCSIsCatC -func UCSIsCatC(code c.Int) c.Int - -//go:linkname UCSIsCatCc C.xmlUCSIsCatCc -func UCSIsCatCc(code c.Int) c.Int - -//go:linkname UCSIsCatCf C.xmlUCSIsCatCf -func UCSIsCatCf(code c.Int) c.Int - -//go:linkname UCSIsCatCo C.xmlUCSIsCatCo -func UCSIsCatCo(code c.Int) c.Int - -//go:linkname UCSIsCatCs C.xmlUCSIsCatCs -func UCSIsCatCs(code c.Int) c.Int - -//go:linkname UCSIsCatL C.xmlUCSIsCatL -func UCSIsCatL(code c.Int) c.Int - -//go:linkname UCSIsCatLl C.xmlUCSIsCatLl -func UCSIsCatLl(code c.Int) c.Int - -//go:linkname UCSIsCatLm C.xmlUCSIsCatLm -func UCSIsCatLm(code c.Int) c.Int - -//go:linkname UCSIsCatLo C.xmlUCSIsCatLo -func UCSIsCatLo(code c.Int) c.Int - -//go:linkname UCSIsCatLt C.xmlUCSIsCatLt -func UCSIsCatLt(code c.Int) c.Int - -//go:linkname UCSIsCatLu C.xmlUCSIsCatLu -func UCSIsCatLu(code c.Int) c.Int - -//go:linkname UCSIsCatM C.xmlUCSIsCatM -func UCSIsCatM(code c.Int) c.Int - -//go:linkname UCSIsCatMc C.xmlUCSIsCatMc -func UCSIsCatMc(code c.Int) c.Int - -//go:linkname UCSIsCatMe C.xmlUCSIsCatMe -func UCSIsCatMe(code c.Int) c.Int - -//go:linkname UCSIsCatMn C.xmlUCSIsCatMn -func UCSIsCatMn(code c.Int) c.Int - -//go:linkname UCSIsCatN C.xmlUCSIsCatN -func UCSIsCatN(code c.Int) c.Int - -//go:linkname UCSIsCatNd C.xmlUCSIsCatNd -func UCSIsCatNd(code c.Int) c.Int - -//go:linkname UCSIsCatNl C.xmlUCSIsCatNl -func UCSIsCatNl(code c.Int) c.Int - -//go:linkname UCSIsCatNo C.xmlUCSIsCatNo -func UCSIsCatNo(code c.Int) c.Int - -//go:linkname UCSIsCatP C.xmlUCSIsCatP -func UCSIsCatP(code c.Int) c.Int - -//go:linkname UCSIsCatPc C.xmlUCSIsCatPc -func UCSIsCatPc(code c.Int) c.Int - -//go:linkname UCSIsCatPd C.xmlUCSIsCatPd -func UCSIsCatPd(code c.Int) c.Int - -//go:linkname UCSIsCatPe C.xmlUCSIsCatPe -func UCSIsCatPe(code c.Int) c.Int - -//go:linkname UCSIsCatPf C.xmlUCSIsCatPf -func UCSIsCatPf(code c.Int) c.Int - -//go:linkname UCSIsCatPi C.xmlUCSIsCatPi -func UCSIsCatPi(code c.Int) c.Int - -//go:linkname UCSIsCatPo C.xmlUCSIsCatPo -func UCSIsCatPo(code c.Int) c.Int - -//go:linkname UCSIsCatPs C.xmlUCSIsCatPs -func UCSIsCatPs(code c.Int) c.Int - -//go:linkname UCSIsCatS C.xmlUCSIsCatS -func UCSIsCatS(code c.Int) c.Int - -//go:linkname UCSIsCatSc C.xmlUCSIsCatSc -func UCSIsCatSc(code c.Int) c.Int - -//go:linkname UCSIsCatSk C.xmlUCSIsCatSk -func UCSIsCatSk(code c.Int) c.Int - -//go:linkname UCSIsCatSm C.xmlUCSIsCatSm -func UCSIsCatSm(code c.Int) c.Int - -//go:linkname UCSIsCatSo C.xmlUCSIsCatSo -func UCSIsCatSo(code c.Int) c.Int - -//go:linkname UCSIsCatZ C.xmlUCSIsCatZ -func UCSIsCatZ(code c.Int) c.Int - -//go:linkname UCSIsCatZl C.xmlUCSIsCatZl -func UCSIsCatZl(code c.Int) c.Int - -//go:linkname UCSIsCatZp C.xmlUCSIsCatZp -func UCSIsCatZp(code c.Int) c.Int - -//go:linkname UCSIsCatZs C.xmlUCSIsCatZs -func UCSIsCatZs(code c.Int) c.Int - -//go:linkname UCSIsCat C.xmlUCSIsCat -func UCSIsCat(code c.Int, cat *c.Char) c.Int diff --git a/libxml2/xmlversion.go b/libxml2/xmlversion.go deleted file mode 100644 index d2b4704a..00000000 --- a/libxml2/xmlversion.go +++ /dev/null @@ -1,9 +0,0 @@ -package libxml2 - -import _ "unsafe" - -const DOTTED_VERSION = "2.13.6" -const VERSION = 21306 -const VERSION_STRING = "21306" -const VERSION_EXTRA = "" -const MODULE_EXTENSION = ".so" diff --git a/libxml2/xmlwriter.go b/libxml2/xmlwriter.go deleted file mode 100644 index b9142c92..00000000 --- a/libxml2/xmlwriter.go +++ /dev/null @@ -1,324 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type X_xmlTextWriter struct { - Unused [8]uint8 -} -type TextWriter X_xmlTextWriter -type TextWriterPtr *TextWriter - -/* - * Constructors & Destructor - */ -//go:linkname NewTextWriter C.xmlNewTextWriter -func NewTextWriter(out OutputBufferPtr) TextWriterPtr - -//go:linkname NewTextWriterFilename C.xmlNewTextWriterFilename -func NewTextWriterFilename(uri *c.Char, compression c.Int) TextWriterPtr - -//go:linkname NewTextWriterMemory C.xmlNewTextWriterMemory -func NewTextWriterMemory(buf BufferPtr, compression c.Int) TextWriterPtr - -//go:linkname NewTextWriterPushParser C.xmlNewTextWriterPushParser -func NewTextWriterPushParser(ctxt ParserCtxtPtr, compression c.Int) TextWriterPtr - -//go:linkname NewTextWriterDoc C.xmlNewTextWriterDoc -func NewTextWriterDoc(doc *DocPtr, compression c.Int) TextWriterPtr - -//go:linkname NewTextWriterTree C.xmlNewTextWriterTree -func NewTextWriterTree(doc DocPtr, node NodePtr, compression c.Int) TextWriterPtr - -//go:linkname FreeTextWriter C.xmlFreeTextWriter -func FreeTextWriter(writer TextWriterPtr) - -/* - * Document - */ -//go:linkname TextWriterStartDocument C.xmlTextWriterStartDocument -func TextWriterStartDocument(writer TextWriterPtr, version *c.Char, encoding *c.Char, standalone *c.Char) c.Int - -//go:linkname TextWriterEndDocument C.xmlTextWriterEndDocument -func TextWriterEndDocument(writer TextWriterPtr) c.Int - -/* - * Comments - */ -//go:linkname TextWriterStartComment C.xmlTextWriterStartComment -func TextWriterStartComment(writer TextWriterPtr) c.Int - -//go:linkname TextWriterEndComment C.xmlTextWriterEndComment -func TextWriterEndComment(writer TextWriterPtr) c.Int - -//go:linkname TextWriterWriteFormatComment C.xmlTextWriterWriteFormatComment -func TextWriterWriteFormatComment(writer TextWriterPtr, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatComment C.xmlTextWriterWriteVFormatComment -func TextWriterWriteVFormatComment(writer TextWriterPtr, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteComment C.xmlTextWriterWriteComment -func TextWriterWriteComment(writer TextWriterPtr, content *Char) c.Int - -/* - * Elements - */ -//go:linkname TextWriterStartElement C.xmlTextWriterStartElement -func TextWriterStartElement(writer TextWriterPtr, name *Char) c.Int - -//go:linkname TextWriterStartElementNS C.xmlTextWriterStartElementNS -func TextWriterStartElementNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char) c.Int - -//go:linkname TextWriterEndElement C.xmlTextWriterEndElement -func TextWriterEndElement(writer TextWriterPtr) c.Int - -//go:linkname TextWriterFullEndElement C.xmlTextWriterFullEndElement -func TextWriterFullEndElement(writer TextWriterPtr) c.Int - -/* - * Elements conveniency functions - */ -//go:linkname TextWriterWriteFormatElement C.xmlTextWriterWriteFormatElement -func TextWriterWriteFormatElement(writer TextWriterPtr, name *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatElement C.xmlTextWriterWriteVFormatElement -func TextWriterWriteVFormatElement(writer TextWriterPtr, name *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteElement C.xmlTextWriterWriteElement -func TextWriterWriteElement(writer TextWriterPtr, name *Char, content *Char) c.Int - -//go:linkname TextWriterWriteFormatElementNS C.xmlTextWriterWriteFormatElementNS -func TextWriterWriteFormatElementNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatElementNS C.xmlTextWriterWriteVFormatElementNS -func TextWriterWriteVFormatElementNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteElementNS C.xmlTextWriterWriteElementNS -func TextWriterWriteElementNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char, content *Char) c.Int - -/* - * Text - */ -//go:linkname TextWriterWriteFormatRaw C.xmlTextWriterWriteFormatRaw -func TextWriterWriteFormatRaw(writer TextWriterPtr, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatRaw C.xmlTextWriterWriteVFormatRaw -func TextWriterWriteVFormatRaw(writer TextWriterPtr, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteRawLen C.xmlTextWriterWriteRawLen -func TextWriterWriteRawLen(writer TextWriterPtr, content *Char, len c.Int) c.Int - -//go:linkname TextWriterWriteRaw C.xmlTextWriterWriteRaw -func TextWriterWriteRaw(writer TextWriterPtr, content *Char) c.Int - -//go:linkname TextWriterWriteFormatString C.xmlTextWriterWriteFormatString -func TextWriterWriteFormatString(writer TextWriterPtr, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatString C.xmlTextWriterWriteVFormatString -func TextWriterWriteVFormatString(writer TextWriterPtr, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteString C.xmlTextWriterWriteString -func TextWriterWriteString(writer TextWriterPtr, content *Char) c.Int - -//go:linkname TextWriterWriteBase64 C.xmlTextWriterWriteBase64 -func TextWriterWriteBase64(writer TextWriterPtr, data *c.Char, start c.Int, len c.Int) c.Int - -//go:linkname TextWriterWriteBinHex C.xmlTextWriterWriteBinHex -func TextWriterWriteBinHex(writer TextWriterPtr, data *c.Char, start c.Int, len c.Int) c.Int - -/* - * Attributes - */ -//go:linkname TextWriterStartAttribute C.xmlTextWriterStartAttribute -func TextWriterStartAttribute(writer TextWriterPtr, name *Char) c.Int - -//go:linkname TextWriterStartAttributeNS C.xmlTextWriterStartAttributeNS -func TextWriterStartAttributeNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char) c.Int - -//go:linkname TextWriterEndAttribute C.xmlTextWriterEndAttribute -func TextWriterEndAttribute(writer TextWriterPtr) c.Int - -/* - * Attributes conveniency functions - */ -//go:linkname TextWriterWriteFormatAttribute C.xmlTextWriterWriteFormatAttribute -func TextWriterWriteFormatAttribute(writer TextWriterPtr, name *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatAttribute C.xmlTextWriterWriteVFormatAttribute -func TextWriterWriteVFormatAttribute(writer TextWriterPtr, name *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteAttribute C.xmlTextWriterWriteAttribute -func TextWriterWriteAttribute(writer TextWriterPtr, name *Char, content *Char) c.Int - -//go:linkname TextWriterWriteFormatAttributeNS C.xmlTextWriterWriteFormatAttributeNS -func TextWriterWriteFormatAttributeNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatAttributeNS C.xmlTextWriterWriteVFormatAttributeNS -func TextWriterWriteVFormatAttributeNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteAttributeNS C.xmlTextWriterWriteAttributeNS -func TextWriterWriteAttributeNS(writer TextWriterPtr, prefix *Char, name *Char, namespaceURI *Char, content *Char) c.Int - -/* - * PI's - */ -//go:linkname TextWriterStartPI C.xmlTextWriterStartPI -func TextWriterStartPI(writer TextWriterPtr, target *Char) c.Int - -//go:linkname TextWriterEndPI C.xmlTextWriterEndPI -func TextWriterEndPI(writer TextWriterPtr) c.Int - -/* - * PI conveniency functions - */ -//go:linkname TextWriterWriteFormatPI C.xmlTextWriterWriteFormatPI -func TextWriterWriteFormatPI(writer TextWriterPtr, target *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatPI C.xmlTextWriterWriteVFormatPI -func TextWriterWriteVFormatPI(writer TextWriterPtr, target *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWritePI C.xmlTextWriterWritePI -func TextWriterWritePI(writer TextWriterPtr, target *Char, content *Char) c.Int - -/* - * CDATA - */ -//go:linkname TextWriterStartCDATA C.xmlTextWriterStartCDATA -func TextWriterStartCDATA(writer TextWriterPtr) c.Int - -//go:linkname TextWriterEndCDATA C.xmlTextWriterEndCDATA -func TextWriterEndCDATA(writer TextWriterPtr) c.Int - -/* - * CDATA conveniency functions - */ -//go:linkname TextWriterWriteFormatCDATA C.xmlTextWriterWriteFormatCDATA -func TextWriterWriteFormatCDATA(writer TextWriterPtr, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatCDATA C.xmlTextWriterWriteVFormatCDATA -func TextWriterWriteVFormatCDATA(writer TextWriterPtr, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteCDATA C.xmlTextWriterWriteCDATA -func TextWriterWriteCDATA(writer TextWriterPtr, content *Char) c.Int - -/* - * DTD - */ -//go:linkname TextWriterStartDTD C.xmlTextWriterStartDTD -func TextWriterStartDTD(writer TextWriterPtr, name *Char, pubid *Char, sysid *Char) c.Int - -//go:linkname TextWriterEndDTD C.xmlTextWriterEndDTD -func TextWriterEndDTD(writer TextWriterPtr) c.Int - -/* - * DTD conveniency functions - */ -//go:linkname TextWriterWriteFormatDTD C.xmlTextWriterWriteFormatDTD -func TextWriterWriteFormatDTD(writer TextWriterPtr, name *Char, pubid *Char, sysid *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatDTD C.xmlTextWriterWriteVFormatDTD -func TextWriterWriteVFormatDTD(writer TextWriterPtr, name *Char, pubid *Char, sysid *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteDTD C.xmlTextWriterWriteDTD -func TextWriterWriteDTD(writer TextWriterPtr, name *Char, pubid *Char, sysid *Char, subset *Char) c.Int - -/* - * DTD element definition - */ -//go:linkname TextWriterStartDTDElement C.xmlTextWriterStartDTDElement -func TextWriterStartDTDElement(writer TextWriterPtr, name *Char) c.Int - -//go:linkname TextWriterEndDTDElement C.xmlTextWriterEndDTDElement -func TextWriterEndDTDElement(writer TextWriterPtr) c.Int - -/* - * DTD element definition conveniency functions - */ -//go:linkname TextWriterWriteFormatDTDElement C.xmlTextWriterWriteFormatDTDElement -func TextWriterWriteFormatDTDElement(writer TextWriterPtr, name *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatDTDElement C.xmlTextWriterWriteVFormatDTDElement -func TextWriterWriteVFormatDTDElement(writer TextWriterPtr, name *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteDTDElement C.xmlTextWriterWriteDTDElement -func TextWriterWriteDTDElement(writer TextWriterPtr, name *Char, content *Char) c.Int - -/* - * DTD attribute list definition - */ -//go:linkname TextWriterStartDTDAttlist C.xmlTextWriterStartDTDAttlist -func TextWriterStartDTDAttlist(writer TextWriterPtr, name *Char) c.Int - -//go:linkname TextWriterEndDTDAttlist C.xmlTextWriterEndDTDAttlist -func TextWriterEndDTDAttlist(writer TextWriterPtr) c.Int - -/* - * DTD attribute list definition conveniency functions - */ -//go:linkname TextWriterWriteFormatDTDAttlist C.xmlTextWriterWriteFormatDTDAttlist -func TextWriterWriteFormatDTDAttlist(writer TextWriterPtr, name *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatDTDAttlist C.xmlTextWriterWriteVFormatDTDAttlist -func TextWriterWriteVFormatDTDAttlist(writer TextWriterPtr, name *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteDTDAttlist C.xmlTextWriterWriteDTDAttlist -func TextWriterWriteDTDAttlist(writer TextWriterPtr, name *Char, content *Char) c.Int - -/* - * DTD entity definition - */ -//go:linkname TextWriterStartDTDEntity C.xmlTextWriterStartDTDEntity -func TextWriterStartDTDEntity(writer TextWriterPtr, pe c.Int, name *Char) c.Int - -//go:linkname TextWriterEndDTDEntity C.xmlTextWriterEndDTDEntity -func TextWriterEndDTDEntity(writer TextWriterPtr) c.Int - -/* - * DTD entity definition conveniency functions - */ -//go:linkname TextWriterWriteFormatDTDInternalEntity C.xmlTextWriterWriteFormatDTDInternalEntity -func TextWriterWriteFormatDTDInternalEntity(writer TextWriterPtr, pe c.Int, name *Char, format *c.Char, __llgo_va_list ...interface{}) c.Int - -//go:linkname TextWriterWriteVFormatDTDInternalEntity C.xmlTextWriterWriteVFormatDTDInternalEntity -func TextWriterWriteVFormatDTDInternalEntity(writer TextWriterPtr, pe c.Int, name *Char, format *c.Char, argptr c.VaList) c.Int - -//go:linkname TextWriterWriteDTDInternalEntity C.xmlTextWriterWriteDTDInternalEntity -func TextWriterWriteDTDInternalEntity(writer TextWriterPtr, pe c.Int, name *Char, content *Char) c.Int - -//go:linkname TextWriterWriteDTDExternalEntity C.xmlTextWriterWriteDTDExternalEntity -func TextWriterWriteDTDExternalEntity(writer TextWriterPtr, pe c.Int, name *Char, pubid *Char, sysid *Char, ndataid *Char) c.Int - -//go:linkname TextWriterWriteDTDExternalEntityContents C.xmlTextWriterWriteDTDExternalEntityContents -func TextWriterWriteDTDExternalEntityContents(writer TextWriterPtr, pubid *Char, sysid *Char, ndataid *Char) c.Int - -//go:linkname TextWriterWriteDTDEntity C.xmlTextWriterWriteDTDEntity -func TextWriterWriteDTDEntity(writer TextWriterPtr, pe c.Int, name *Char, pubid *Char, sysid *Char, ndataid *Char, content *Char) c.Int - -/* - * DTD notation definition - */ -//go:linkname TextWriterWriteDTDNotation C.xmlTextWriterWriteDTDNotation -func TextWriterWriteDTDNotation(writer TextWriterPtr, name *Char, pubid *Char, sysid *Char) c.Int - -/* - * Indentation - */ -//go:linkname TextWriterSetIndent C.xmlTextWriterSetIndent -func TextWriterSetIndent(writer TextWriterPtr, indent c.Int) c.Int - -//go:linkname TextWriterSetIndentString C.xmlTextWriterSetIndentString -func TextWriterSetIndentString(writer TextWriterPtr, str *Char) c.Int - -//go:linkname TextWriterSetQuoteChar C.xmlTextWriterSetQuoteChar -func TextWriterSetQuoteChar(writer TextWriterPtr, quotechar Char) c.Int - -/* - * misc - */ -//go:linkname TextWriterFlush C.xmlTextWriterFlush -func TextWriterFlush(writer TextWriterPtr) c.Int - -//go:linkname TextWriterClose C.xmlTextWriterClose -func TextWriterClose(writer TextWriterPtr) c.Int diff --git a/libxml2/xpath.go b/libxml2/xpath.go deleted file mode 100644 index 37430ff2..00000000 --- a/libxml2/xpath.go +++ /dev/null @@ -1,335 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const XPATH_POINT = 5 -const XPATH_RANGE = 6 -const XPATH_LOCATIONSET = 7 - -type X_xmlXPathContext struct { - Doc DocPtr - Node NodePtr - NbVariablesUnused c.Int - MaxVariablesUnused c.Int - VarHash HashTablePtr - NbTypes c.Int - MaxTypes c.Int - Types XPathTypePtr - NbFuncsUnused c.Int - MaxFuncsUnused c.Int - FuncHash HashTablePtr - NbAxis c.Int - MaxAxis c.Int - Axis XPathAxisPtr - Namespaces *NsPtr - NsNr c.Int - User c.Pointer - ContextSize c.Int - ProximityPosition c.Int - Xptr c.Int - Here NodePtr - Origin NodePtr - NsHash HashTablePtr - VarLookupFunc XPathVariableLookupFunc - VarLookupData c.Pointer - Extra c.Pointer - Function *Char - FunctionURI *Char - FuncLookupFunc XPathFuncLookupFunc - FuncLookupData c.Pointer - TmpNsList *NsPtr - TmpNsNr c.Int - UserData c.Pointer - Error StructuredErrorFunc - LastError Error - DebugNode NodePtr - Dict DictPtr - Flags c.Int - Cache c.Pointer - OpLimit c.Ulong - OpCount c.Ulong - Depth c.Int -} -type XPathContext X_xmlXPathContext -type XPathContextPtr *XPathContext - -type X_xmlXPathParserContext struct { - Cur *Char - Base *Char - Error c.Int - Context XPathContextPtr - Value XPathObjectPtr - ValueNr c.Int - ValueMax c.Int - ValueTab *XPathObjectPtr - Comp XPathCompExprPtr - Xptr c.Int - Ancestor NodePtr - ValueFrame c.Int -} -type XPathParserContext X_xmlXPathParserContext -type XPathParserContextPtr *XPathParserContext -type XPathError c.Int - -const ( - XPATH_EXPRESSION_OK__1 XPathError = 0 - XPATH_NUMBER_ERROR__1 XPathError = 1 - XPATH_UNFINISHED_LITERAL_ERROR__1 XPathError = 2 - XPATH_START_LITERAL_ERROR__1 XPathError = 3 - XPATH_VARIABLE_REF_ERROR__1 XPathError = 4 - XPATH_UNDEF_VARIABLE_ERROR__1 XPathError = 5 - XPATH_INVALID_PREDICATE_ERROR__1 XPathError = 6 - XPATH_EXPR_ERROR__1 XPathError = 7 - XPATH_UNCLOSED_ERROR__1 XPathError = 8 - XPATH_UNKNOWN_FUNC_ERROR__1 XPathError = 9 - XPATH_INVALID_OPERAND__1 XPathError = 10 - XPATH_INVALID_TYPE__1 XPathError = 11 - XPATH_INVALID_ARITY__1 XPathError = 12 - XPATH_INVALID_CTXT_SIZE__1 XPathError = 13 - XPATH_INVALID_CTXT_POSITION__1 XPathError = 14 - XPATH_MEMORY_ERROR__1 XPathError = 15 - XPTR_SYNTAX_ERROR__1 XPathError = 16 - XPTR_RESOURCE_ERROR__1 XPathError = 17 - XPTR_SUB_RESOURCE_ERROR__1 XPathError = 18 - XPATH_UNDEF_PREFIX_ERROR__1 XPathError = 19 - XPATH_ENCODING_ERROR__1 XPathError = 20 - XPATH_INVALID_CHAR_ERROR__1 XPathError = 21 - XPATH_INVALID_CTXT XPathError = 22 - XPATH_STACK_ERROR XPathError = 23 - XPATH_FORBID_VARIABLE_ERROR XPathError = 24 - XPATH_OP_LIMIT_EXCEEDED XPathError = 25 - XPATH_RECURSION_LIMIT_EXCEEDED XPathError = 26 -) - -type X_xmlNodeSet struct { - NodeNr c.Int - NodeMax c.Int - NodeTab *NodePtr -} -type NodeSet X_xmlNodeSet -type NodeSetPtr *NodeSet -type XPathObjectType c.Int - -const ( - XPATH_UNDEFINED XPathObjectType = 0 - XPATH_NODESET XPathObjectType = 1 - XPATH_BOOLEAN XPathObjectType = 2 - XPATH_NUMBER XPathObjectType = 3 - XPATH_STRING XPathObjectType = 4 - XPATH_USERS XPathObjectType = 8 - XPATH_XSLT_TREE XPathObjectType = 9 -) - -type X_xmlXPathObject struct { - Type XPathObjectType - Nodesetval NodeSetPtr - Boolval c.Int - Floatval c.Double - Stringval *Char - User c.Pointer - Index c.Int - User2 c.Pointer - Index2 c.Int -} -type XPathObject X_xmlXPathObject -type XPathObjectPtr *XPathObject - -// llgo:type C -type XPathConvertFunc func(XPathObjectPtr, c.Int) c.Int - -type X_xmlXPathType struct { - Name *Char - Func XPathConvertFunc -} -type XPathType X_xmlXPathType -type XPathTypePtr *XPathType - -type X_xmlXPathVariable struct { - Name *Char - Value XPathObjectPtr -} -type XPathVariable X_xmlXPathVariable -type XPathVariablePtr *XPathVariable - -// llgo:type C -type XPathEvalFunc func(XPathParserContextPtr, c.Int) - -type X_xmlXPathFunct struct { - Name *Char - Func XPathEvalFunc -} -type XPathFunct X_xmlXPathFunct -type XPathFuncPtr *XPathFunct - -// llgo:type C -type XPathAxisFunc func(XPathParserContextPtr, XPathObjectPtr) XPathObjectPtr - -type X_xmlXPathAxis struct { - Name *Char - Func XPathAxisFunc -} -type XPathAxis X_xmlXPathAxis -type XPathAxisPtr *XPathAxis - -// llgo:type C -type XPathFunction func(XPathParserContextPtr, c.Int) - -// llgo:type C -type XPathVariableLookupFunc func(c.Pointer, *Char, *Char) XPathObjectPtr - -// llgo:type C -type XPathFuncLookupFunc func(c.Pointer, *Char, *Char) XPathFunction - -type X_xmlXPathCompExpr struct { - Unused [8]uint8 -} -type XPathCompExpr X_xmlXPathCompExpr -type XPathCompExprPtr *XPathCompExpr - -//go:linkname XPathFreeObject C.xmlXPathFreeObject -func XPathFreeObject(obj XPathObjectPtr) - -//go:linkname XPathNodeSetCreate C.xmlXPathNodeSetCreate -func XPathNodeSetCreate(val NodePtr) NodeSetPtr - -//go:linkname XPathFreeNodeSetList C.xmlXPathFreeNodeSetList -func XPathFreeNodeSetList(obj XPathObjectPtr) - -//go:linkname XPathFreeNodeSet C.xmlXPathFreeNodeSet -func XPathFreeNodeSet(obj NodeSetPtr) - -//go:linkname XPathObjectCopy C.xmlXPathObjectCopy -func XPathObjectCopy(val XPathObjectPtr) XPathObjectPtr - -//go:linkname XPathCmpNodes C.xmlXPathCmpNodes -func XPathCmpNodes(node1 NodePtr, node2 NodePtr) c.Int - -/** - * Conversion functions to basic types. - */ -//go:linkname XPathCastNumberToBoolean C.xmlXPathCastNumberToBoolean -func XPathCastNumberToBoolean(val c.Double) c.Int - -// llgo:link (*Char).XPathCastStringToBoolean C.xmlXPathCastStringToBoolean -func (recv_ *Char) XPathCastStringToBoolean() c.Int { - return 0 -} - -//go:linkname XPathCastNodeSetToBoolean C.xmlXPathCastNodeSetToBoolean -func XPathCastNodeSetToBoolean(ns NodeSetPtr) c.Int - -//go:linkname XPathCastToBoolean C.xmlXPathCastToBoolean -func XPathCastToBoolean(val XPathObjectPtr) c.Int - -//go:linkname XPathCastBooleanToNumber C.xmlXPathCastBooleanToNumber -func XPathCastBooleanToNumber(val c.Int) c.Double - -// llgo:link (*Char).XPathCastStringToNumber C.xmlXPathCastStringToNumber -func (recv_ *Char) XPathCastStringToNumber() c.Double { - return 0 -} - -//go:linkname XPathCastNodeToNumber C.xmlXPathCastNodeToNumber -func XPathCastNodeToNumber(node NodePtr) c.Double - -//go:linkname XPathCastNodeSetToNumber C.xmlXPathCastNodeSetToNumber -func XPathCastNodeSetToNumber(ns NodeSetPtr) c.Double - -//go:linkname XPathCastToNumber C.xmlXPathCastToNumber -func XPathCastToNumber(val XPathObjectPtr) c.Double - -//go:linkname XPathCastBooleanToString C.xmlXPathCastBooleanToString -func XPathCastBooleanToString(val c.Int) *Char - -//go:linkname XPathCastNumberToString C.xmlXPathCastNumberToString -func XPathCastNumberToString(val c.Double) *Char - -//go:linkname XPathCastNodeToString C.xmlXPathCastNodeToString -func XPathCastNodeToString(node NodePtr) *Char - -//go:linkname XPathCastNodeSetToString C.xmlXPathCastNodeSetToString -func XPathCastNodeSetToString(ns NodeSetPtr) *Char - -//go:linkname XPathCastToString C.xmlXPathCastToString -func XPathCastToString(val XPathObjectPtr) *Char - -//go:linkname XPathConvertBoolean C.xmlXPathConvertBoolean -func XPathConvertBoolean(val XPathObjectPtr) XPathObjectPtr - -//go:linkname XPathConvertNumber C.xmlXPathConvertNumber -func XPathConvertNumber(val XPathObjectPtr) XPathObjectPtr - -//go:linkname XPathConvertString C.xmlXPathConvertString -func XPathConvertString(val XPathObjectPtr) XPathObjectPtr - -/** - * Context handling. - */ -//go:linkname XPathNewContext C.xmlXPathNewContext -func XPathNewContext(doc DocPtr) XPathContextPtr - -//go:linkname XPathFreeContext C.xmlXPathFreeContext -func XPathFreeContext(ctxt XPathContextPtr) - -//go:linkname XPathSetErrorHandler C.xmlXPathSetErrorHandler -func XPathSetErrorHandler(ctxt XPathContextPtr, handler StructuredErrorFunc, context c.Pointer) - -//go:linkname XPathContextSetCache C.xmlXPathContextSetCache -func XPathContextSetCache(ctxt XPathContextPtr, active c.Int, value c.Int, options c.Int) c.Int - -/** - * Evaluation functions. - */ -//go:linkname XPathOrderDocElems C.xmlXPathOrderDocElems -func XPathOrderDocElems(doc DocPtr) c.Long - -//go:linkname XPathSetContextNode C.xmlXPathSetContextNode -func XPathSetContextNode(node NodePtr, ctx XPathContextPtr) c.Int - -//go:linkname XPathNodeEval C.xmlXPathNodeEval -func XPathNodeEval(node NodePtr, str *Char, ctx XPathContextPtr) XPathObjectPtr - -// llgo:link (*Char).XPathEval C.xmlXPathEval -func (recv_ *Char) XPathEval(ctx XPathContextPtr) XPathObjectPtr { - return nil -} - -// llgo:link (*Char).XPathEvalExpression C.xmlXPathEvalExpression -func (recv_ *Char) XPathEvalExpression(ctxt XPathContextPtr) XPathObjectPtr { - return nil -} - -//go:linkname XPathEvalPredicate C.xmlXPathEvalPredicate -func XPathEvalPredicate(ctxt XPathContextPtr, res XPathObjectPtr) c.Int - -/** - * Separate compilation/evaluation entry points. - */ -// llgo:link (*Char).XPathCompile C.xmlXPathCompile -func (recv_ *Char) XPathCompile() XPathCompExprPtr { - return nil -} - -//go:linkname XPathCtxtCompile C.xmlXPathCtxtCompile -func XPathCtxtCompile(ctxt XPathContextPtr, str *Char) XPathCompExprPtr - -//go:linkname XPathCompiledEval C.xmlXPathCompiledEval -func XPathCompiledEval(comp XPathCompExprPtr, ctx XPathContextPtr) XPathObjectPtr - -//go:linkname XPathCompiledEvalToBoolean C.xmlXPathCompiledEvalToBoolean -func XPathCompiledEvalToBoolean(comp XPathCompExprPtr, ctxt XPathContextPtr) c.Int - -//go:linkname XPathFreeCompExpr C.xmlXPathFreeCompExpr -func XPathFreeCompExpr(comp XPathCompExprPtr) - -//go:linkname XPathInit C.xmlXPathInit -func XPathInit() - -//go:linkname XPathIsNaN C.xmlXPathIsNaN -func XPathIsNaN(val c.Double) c.Int - -//go:linkname XPathIsInf C.xmlXPathIsInf -func XPathIsInf(val c.Double) c.Int diff --git a/libxml2/xpathInternals.go b/libxml2/xpathInternals.go deleted file mode 100644 index 618a9850..00000000 --- a/libxml2/xpathInternals.go +++ /dev/null @@ -1,398 +0,0 @@ -package libxml2 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname XPathPopBoolean C.xmlXPathPopBoolean -func XPathPopBoolean(ctxt XPathParserContextPtr) c.Int - -//go:linkname XPathPopNumber C.xmlXPathPopNumber -func XPathPopNumber(ctxt XPathParserContextPtr) c.Double - -//go:linkname XPathPopString C.xmlXPathPopString -func XPathPopString(ctxt XPathParserContextPtr) *Char - -//go:linkname XPathPopNodeSet C.xmlXPathPopNodeSet -func XPathPopNodeSet(ctxt XPathParserContextPtr) NodeSetPtr - -//go:linkname XPathPopExternal C.xmlXPathPopExternal -func XPathPopExternal(ctxt XPathParserContextPtr) c.Pointer - -/* - * Variable Lookup forwarding. - */ -//go:linkname XPathRegisterVariableLookup C.xmlXPathRegisterVariableLookup -func XPathRegisterVariableLookup(ctxt XPathContextPtr, f XPathVariableLookupFunc, data c.Pointer) - -/* - * Function Lookup forwarding. - */ -//go:linkname XPathRegisterFuncLookup C.xmlXPathRegisterFuncLookup -func XPathRegisterFuncLookup(ctxt XPathContextPtr, f XPathFuncLookupFunc, funcCtxt c.Pointer) - -/* - * Error reporting. - */ -//go:linkname XPatherror C.xmlXPatherror -func XPatherror(ctxt XPathParserContextPtr, file *c.Char, line c.Int, no c.Int) - -//go:linkname XPathErr C.xmlXPathErr -func XPathErr(ctxt XPathParserContextPtr, error c.Int) - -//go:linkname XPathDebugDumpObject C.xmlXPathDebugDumpObject -func XPathDebugDumpObject(output *c.FILE, cur XPathObjectPtr, depth c.Int) - -//go:linkname XPathDebugDumpCompExpr C.xmlXPathDebugDumpCompExpr -func XPathDebugDumpCompExpr(output *c.FILE, comp XPathCompExprPtr, depth c.Int) - -/** - * NodeSet handling. - */ -//go:linkname XPathNodeSetContains C.xmlXPathNodeSetContains -func XPathNodeSetContains(cur NodeSetPtr, val NodePtr) c.Int - -//go:linkname XPathDifference C.xmlXPathDifference -func XPathDifference(nodes1 NodeSetPtr, nodes2 NodeSetPtr) NodeSetPtr - -//go:linkname XPathIntersection C.xmlXPathIntersection -func XPathIntersection(nodes1 NodeSetPtr, nodes2 NodeSetPtr) NodeSetPtr - -//go:linkname XPathDistinctSorted C.xmlXPathDistinctSorted -func XPathDistinctSorted(nodes NodeSetPtr) NodeSetPtr - -//go:linkname XPathDistinct C.xmlXPathDistinct -func XPathDistinct(nodes NodeSetPtr) NodeSetPtr - -//go:linkname XPathHasSameNodes C.xmlXPathHasSameNodes -func XPathHasSameNodes(nodes1 NodeSetPtr, nodes2 NodeSetPtr) c.Int - -//go:linkname XPathNodeLeadingSorted C.xmlXPathNodeLeadingSorted -func XPathNodeLeadingSorted(nodes NodeSetPtr, node NodePtr) NodeSetPtr - -//go:linkname XPathLeadingSorted C.xmlXPathLeadingSorted -func XPathLeadingSorted(nodes1 NodeSetPtr, nodes2 NodeSetPtr) NodeSetPtr - -//go:linkname XPathNodeLeading C.xmlXPathNodeLeading -func XPathNodeLeading(nodes NodeSetPtr, node NodePtr) NodeSetPtr - -//go:linkname XPathLeading C.xmlXPathLeading -func XPathLeading(nodes1 NodeSetPtr, nodes2 NodeSetPtr) NodeSetPtr - -//go:linkname XPathNodeTrailingSorted C.xmlXPathNodeTrailingSorted -func XPathNodeTrailingSorted(nodes NodeSetPtr, node NodePtr) NodeSetPtr - -//go:linkname XPathTrailingSorted C.xmlXPathTrailingSorted -func XPathTrailingSorted(nodes1 NodeSetPtr, nodes2 NodeSetPtr) NodeSetPtr - -//go:linkname XPathNodeTrailing C.xmlXPathNodeTrailing -func XPathNodeTrailing(nodes NodeSetPtr, node NodePtr) NodeSetPtr - -//go:linkname XPathTrailing C.xmlXPathTrailing -func XPathTrailing(nodes1 NodeSetPtr, nodes2 NodeSetPtr) NodeSetPtr - -/** - * Extending a context. - */ -//go:linkname XPathRegisterNs C.xmlXPathRegisterNs -func XPathRegisterNs(ctxt XPathContextPtr, prefix *Char, ns_uri *Char) c.Int - -//go:linkname XPathNsLookup C.xmlXPathNsLookup -func XPathNsLookup(ctxt XPathContextPtr, prefix *Char) *Char - -//go:linkname XPathRegisteredNsCleanup C.xmlXPathRegisteredNsCleanup -func XPathRegisteredNsCleanup(ctxt XPathContextPtr) - -//go:linkname XPathRegisterFunc C.xmlXPathRegisterFunc -func XPathRegisterFunc(ctxt XPathContextPtr, name *Char, f XPathFunction) c.Int - -//go:linkname XPathRegisterFuncNS C.xmlXPathRegisterFuncNS -func XPathRegisterFuncNS(ctxt XPathContextPtr, name *Char, ns_uri *Char, f XPathFunction) c.Int - -//go:linkname XPathRegisterVariable C.xmlXPathRegisterVariable -func XPathRegisterVariable(ctxt XPathContextPtr, name *Char, value XPathObjectPtr) c.Int - -//go:linkname XPathRegisterVariableNS C.xmlXPathRegisterVariableNS -func XPathRegisterVariableNS(ctxt XPathContextPtr, name *Char, ns_uri *Char, value XPathObjectPtr) c.Int - -//go:linkname XPathFunctionLookup C.xmlXPathFunctionLookup -func XPathFunctionLookup(ctxt XPathContextPtr, name *Char) XPathFunction - -//go:linkname XPathFunctionLookupNS C.xmlXPathFunctionLookupNS -func XPathFunctionLookupNS(ctxt XPathContextPtr, name *Char, ns_uri *Char) XPathFunction - -//go:linkname XPathRegisteredFuncsCleanup C.xmlXPathRegisteredFuncsCleanup -func XPathRegisteredFuncsCleanup(ctxt XPathContextPtr) - -//go:linkname XPathVariableLookup C.xmlXPathVariableLookup -func XPathVariableLookup(ctxt XPathContextPtr, name *Char) XPathObjectPtr - -//go:linkname XPathVariableLookupNS C.xmlXPathVariableLookupNS -func XPathVariableLookupNS(ctxt XPathContextPtr, name *Char, ns_uri *Char) XPathObjectPtr - -//go:linkname XPathRegisteredVariablesCleanup C.xmlXPathRegisteredVariablesCleanup -func XPathRegisteredVariablesCleanup(ctxt XPathContextPtr) - -/** - * Utilities to extend XPath. - */ -// llgo:link (*Char).XPathNewParserContext C.xmlXPathNewParserContext -func (recv_ *Char) XPathNewParserContext(ctxt XPathContextPtr) XPathParserContextPtr { - return nil -} - -//go:linkname XPathFreeParserContext C.xmlXPathFreeParserContext -func XPathFreeParserContext(ctxt XPathParserContextPtr) - -/* TODO: remap to xmlXPathValuePop and Push. */ -//go:linkname ValuePop C.valuePop -func ValuePop(ctxt XPathParserContextPtr) XPathObjectPtr - -//go:linkname ValuePush C.valuePush -func ValuePush(ctxt XPathParserContextPtr, value XPathObjectPtr) c.Int - -// llgo:link (*Char).XPathNewString C.xmlXPathNewString -func (recv_ *Char) XPathNewString() XPathObjectPtr { - return nil -} - -//go:linkname XPathNewCString C.xmlXPathNewCString -func XPathNewCString(val *c.Char) XPathObjectPtr - -// llgo:link (*Char).XPathWrapString C.xmlXPathWrapString -func (recv_ *Char) XPathWrapString() XPathObjectPtr { - return nil -} - -//go:linkname XPathWrapCString C.xmlXPathWrapCString -func XPathWrapCString(val *c.Char) XPathObjectPtr - -//go:linkname XPathNewFloat C.xmlXPathNewFloat -func XPathNewFloat(val c.Double) XPathObjectPtr - -//go:linkname XPathNewBoolean C.xmlXPathNewBoolean -func XPathNewBoolean(val c.Int) XPathObjectPtr - -//go:linkname XPathNewNodeSet C.xmlXPathNewNodeSet -func XPathNewNodeSet(val NodePtr) XPathObjectPtr - -//go:linkname XPathNewValueTree C.xmlXPathNewValueTree -func XPathNewValueTree(val NodePtr) XPathObjectPtr - -//go:linkname XPathNodeSetAdd C.xmlXPathNodeSetAdd -func XPathNodeSetAdd(cur NodeSetPtr, val NodePtr) c.Int - -//go:linkname XPathNodeSetAddUnique C.xmlXPathNodeSetAddUnique -func XPathNodeSetAddUnique(cur NodeSetPtr, val NodePtr) c.Int - -//go:linkname XPathNodeSetAddNs C.xmlXPathNodeSetAddNs -func XPathNodeSetAddNs(cur NodeSetPtr, node NodePtr, ns NsPtr) c.Int - -//go:linkname XPathNodeSetSort C.xmlXPathNodeSetSort -func XPathNodeSetSort(set NodeSetPtr) - -//go:linkname XPathRoot C.xmlXPathRoot -func XPathRoot(ctxt XPathParserContextPtr) - -//go:linkname XPathEvalExpr C.xmlXPathEvalExpr -func XPathEvalExpr(ctxt XPathParserContextPtr) - -//go:linkname XPathParseName C.xmlXPathParseName -func XPathParseName(ctxt XPathParserContextPtr) *Char - -//go:linkname XPathParseNCName C.xmlXPathParseNCName -func XPathParseNCName(ctxt XPathParserContextPtr) *Char - -/* - * Existing functions. - */ -// llgo:link (*Char).XPathStringEvalNumber C.xmlXPathStringEvalNumber -func (recv_ *Char) XPathStringEvalNumber() c.Double { - return 0 -} - -//go:linkname XPathEvaluatePredicateResult C.xmlXPathEvaluatePredicateResult -func XPathEvaluatePredicateResult(ctxt XPathParserContextPtr, res XPathObjectPtr) c.Int - -//go:linkname XPathRegisterAllFunctions C.xmlXPathRegisterAllFunctions -func XPathRegisterAllFunctions(ctxt XPathContextPtr) - -//go:linkname XPathNodeSetMerge C.xmlXPathNodeSetMerge -func XPathNodeSetMerge(val1 NodeSetPtr, val2 NodeSetPtr) NodeSetPtr - -//go:linkname XPathNodeSetDel C.xmlXPathNodeSetDel -func XPathNodeSetDel(cur NodeSetPtr, val NodePtr) - -//go:linkname XPathNodeSetRemove C.xmlXPathNodeSetRemove -func XPathNodeSetRemove(cur NodeSetPtr, val c.Int) - -//go:linkname XPathNewNodeSetList C.xmlXPathNewNodeSetList -func XPathNewNodeSetList(val NodeSetPtr) XPathObjectPtr - -//go:linkname XPathWrapNodeSet C.xmlXPathWrapNodeSet -func XPathWrapNodeSet(val NodeSetPtr) XPathObjectPtr - -//go:linkname XPathWrapExternal C.xmlXPathWrapExternal -func XPathWrapExternal(val c.Pointer) XPathObjectPtr - -//go:linkname XPathEqualValues C.xmlXPathEqualValues -func XPathEqualValues(ctxt XPathParserContextPtr) c.Int - -//go:linkname XPathNotEqualValues C.xmlXPathNotEqualValues -func XPathNotEqualValues(ctxt XPathParserContextPtr) c.Int - -//go:linkname XPathCompareValues C.xmlXPathCompareValues -func XPathCompareValues(ctxt XPathParserContextPtr, inf c.Int, strict c.Int) c.Int - -//go:linkname XPathValueFlipSign C.xmlXPathValueFlipSign -func XPathValueFlipSign(ctxt XPathParserContextPtr) - -//go:linkname XPathAddValues C.xmlXPathAddValues -func XPathAddValues(ctxt XPathParserContextPtr) - -//go:linkname XPathSubValues C.xmlXPathSubValues -func XPathSubValues(ctxt XPathParserContextPtr) - -//go:linkname XPathMultValues C.xmlXPathMultValues -func XPathMultValues(ctxt XPathParserContextPtr) - -//go:linkname XPathDivValues C.xmlXPathDivValues -func XPathDivValues(ctxt XPathParserContextPtr) - -//go:linkname XPathModValues C.xmlXPathModValues -func XPathModValues(ctxt XPathParserContextPtr) - -// llgo:link (*Char).XPathIsNodeType C.xmlXPathIsNodeType -func (recv_ *Char) XPathIsNodeType() c.Int { - return 0 -} - -/* - * Some of the axis navigation routines. - */ -//go:linkname XPathNextSelf C.xmlXPathNextSelf -func XPathNextSelf(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextChild C.xmlXPathNextChild -func XPathNextChild(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextDescendant C.xmlXPathNextDescendant -func XPathNextDescendant(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextDescendantOrSelf C.xmlXPathNextDescendantOrSelf -func XPathNextDescendantOrSelf(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextParent C.xmlXPathNextParent -func XPathNextParent(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextAncestorOrSelf C.xmlXPathNextAncestorOrSelf -func XPathNextAncestorOrSelf(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextFollowingSibling C.xmlXPathNextFollowingSibling -func XPathNextFollowingSibling(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextFollowing C.xmlXPathNextFollowing -func XPathNextFollowing(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextNamespace C.xmlXPathNextNamespace -func XPathNextNamespace(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextAttribute C.xmlXPathNextAttribute -func XPathNextAttribute(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextPreceding C.xmlXPathNextPreceding -func XPathNextPreceding(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextAncestor C.xmlXPathNextAncestor -func XPathNextAncestor(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -//go:linkname XPathNextPrecedingSibling C.xmlXPathNextPrecedingSibling -func XPathNextPrecedingSibling(ctxt XPathParserContextPtr, cur NodePtr) NodePtr - -/* - * The official core of XPath functions. - */ -//go:linkname XPathLastFunction C.xmlXPathLastFunction -func XPathLastFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathPositionFunction C.xmlXPathPositionFunction -func XPathPositionFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathCountFunction C.xmlXPathCountFunction -func XPathCountFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathIdFunction C.xmlXPathIdFunction -func XPathIdFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathLocalNameFunction C.xmlXPathLocalNameFunction -func XPathLocalNameFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathNamespaceURIFunction C.xmlXPathNamespaceURIFunction -func XPathNamespaceURIFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathStringFunction C.xmlXPathStringFunction -func XPathStringFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathStringLengthFunction C.xmlXPathStringLengthFunction -func XPathStringLengthFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathConcatFunction C.xmlXPathConcatFunction -func XPathConcatFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathContainsFunction C.xmlXPathContainsFunction -func XPathContainsFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathStartsWithFunction C.xmlXPathStartsWithFunction -func XPathStartsWithFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathSubstringFunction C.xmlXPathSubstringFunction -func XPathSubstringFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathSubstringBeforeFunction C.xmlXPathSubstringBeforeFunction -func XPathSubstringBeforeFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathSubstringAfterFunction C.xmlXPathSubstringAfterFunction -func XPathSubstringAfterFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathNormalizeFunction C.xmlXPathNormalizeFunction -func XPathNormalizeFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathTranslateFunction C.xmlXPathTranslateFunction -func XPathTranslateFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathNotFunction C.xmlXPathNotFunction -func XPathNotFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathTrueFunction C.xmlXPathTrueFunction -func XPathTrueFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathFalseFunction C.xmlXPathFalseFunction -func XPathFalseFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathLangFunction C.xmlXPathLangFunction -func XPathLangFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathNumberFunction C.xmlXPathNumberFunction -func XPathNumberFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathSumFunction C.xmlXPathSumFunction -func XPathSumFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathFloorFunction C.xmlXPathFloorFunction -func XPathFloorFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathCeilingFunction C.xmlXPathCeilingFunction -func XPathCeilingFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathRoundFunction C.xmlXPathRoundFunction -func XPathRoundFunction(ctxt XPathParserContextPtr, nargs c.Int) - -//go:linkname XPathBooleanFunction C.xmlXPathBooleanFunction -func XPathBooleanFunction(ctxt XPathParserContextPtr, nargs c.Int) - -/** - * Really internal functions - */ -//go:linkname XPathNodeSetFreeNs C.xmlXPathNodeSetFreeNs -func XPathNodeSetFreeNs(ns NsPtr) diff --git a/libxml2/xpointer.go b/libxml2/xpointer.go deleted file mode 100644 index d58203e6..00000000 --- a/libxml2/xpointer.go +++ /dev/null @@ -1,14 +0,0 @@ -package libxml2 - -import _ "unsafe" - -/* - * Functions. - */ -//go:linkname XPtrNewContext C.xmlXPtrNewContext -func XPtrNewContext(doc DocPtr, here NodePtr, origin NodePtr) XPathContextPtr - -// llgo:link (*Char).XPtrEval C.xmlXPtrEval -func (recv_ *Char) XPtrEval(ctx XPathContextPtr) XPathObjectPtr { - return nil -} diff --git a/libxslt/_demo/withdeplibxml/demo.go b/libxslt/_demo/withdeplibxml/demo.go deleted file mode 100644 index fca0b3fb..00000000 --- a/libxslt/_demo/withdeplibxml/demo.go +++ /dev/null @@ -1,68 +0,0 @@ -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/goplus/llpkg/libxslt" - - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" -) - -func main() { - libxml2.InitParser() - - xml := - ` - - - Alice - 25 - - ` - xslt := ` - - - - -

个人信息

-

姓名:

-

年龄:

- - -
-
- ` - xmlDoc := libxml2.ReadMemory((*int8)(unsafe.Pointer(unsafe.StringData(xml))), c.Int(len(xml)), nil, nil, 0) - xsltDoc := libxml2.ReadMemory((*int8)(unsafe.Pointer(unsafe.StringData(xslt))), c.Int(len(xslt)), nil, nil, 0) - - if xmlDoc == nil || xsltDoc == nil { - panic("cant read xml or xslt") - } - - stylesheet := libxslt.ParseStylesheetDoc(xsltDoc) - if stylesheet == nil { - panic("cant parse xslt") - } - result := libxslt.ApplyStylesheet(stylesheet, xmlDoc, (**int8)(unsafe.Pointer(uintptr(0)))) - if result == nil { - panic("cant apply xslt") - } - - libxslt.SaveResultToFilename(c.Str("output.html"), result, stylesheet, 0) - - libxml2.FreeDoc(xmlDoc) - libxml2.FreeDoc(result) - libxslt.FreeStylesheet(stylesheet) - - libxslt.CleanupGlobals() - libxml2.CleanupParser() - - buf, err := os.ReadFile("./output.html") - if err != nil { - panic(err) - } - fmt.Println(string(buf)) -} diff --git a/libxslt/attributes.go b/libxslt/attributes.go deleted file mode 100644 index 6e7b7441..00000000 --- a/libxslt/attributes.go +++ /dev/null @@ -1,18 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname ParseStylesheetAttributeSet C.xsltParseStylesheetAttributeSet -func ParseStylesheetAttributeSet(style StylesheetPtr, cur libxml2.NodePtr) - -//go:linkname FreeAttributeSetsHashes C.xsltFreeAttributeSetsHashes -func FreeAttributeSetsHashes(style StylesheetPtr) - -//go:linkname ApplyAttributeSet C.xsltApplyAttributeSet -func ApplyAttributeSet(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, attributes *libxml2.Char) - -//go:linkname ResolveStylesheetAttributeSet C.xsltResolveStylesheetAttributeSet -func ResolveStylesheetAttributeSet(style StylesheetPtr) diff --git a/libxslt/documents.go b/libxslt/documents.go deleted file mode 100644 index 0134212e..00000000 --- a/libxslt/documents.go +++ /dev/null @@ -1,42 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname NewDocument C.xsltNewDocument -func NewDocument(ctxt TransformContextPtr, doc libxml2.DocPtr) DocumentPtr - -//go:linkname LoadDocument C.xsltLoadDocument -func LoadDocument(ctxt TransformContextPtr, URI *libxml2.Char) DocumentPtr - -//go:linkname FindDocument C.xsltFindDocument -func FindDocument(ctxt TransformContextPtr, doc libxml2.DocPtr) DocumentPtr - -//go:linkname FreeDocuments C.xsltFreeDocuments -func FreeDocuments(ctxt TransformContextPtr) - -//go:linkname LoadStyleDocument C.xsltLoadStyleDocument -func LoadStyleDocument(style StylesheetPtr, URI *libxml2.Char) DocumentPtr - -//go:linkname NewStyleDocument C.xsltNewStyleDocument -func NewStyleDocument(style StylesheetPtr, doc libxml2.DocPtr) DocumentPtr - -//go:linkname FreeStyleDocuments C.xsltFreeStyleDocuments -func FreeStyleDocuments(style StylesheetPtr) - -type LoadType c.Int - -const ( - LOAD_START LoadType = 0 - LOAD_STYLESHEET LoadType = 1 - LOAD_DOCUMENT LoadType = 2 -) - -// llgo:type C -type DocLoaderFunc func(*libxml2.Char, libxml2.DictPtr, c.Int, c.Pointer, LoadType) libxml2.DocPtr - -//go:linkname SetLoaderFunc C.xsltSetLoaderFunc -func SetLoaderFunc(f DocLoaderFunc) diff --git a/libxslt/exslt.go b/libxslt/exslt.go deleted file mode 100644 index f830fa57..00000000 --- a/libxslt/exslt.go +++ /dev/null @@ -1,3 +0,0 @@ -package libxslt - -import _ "unsafe" diff --git a/libxslt/exsltconfig.go b/libxslt/exsltconfig.go deleted file mode 100644 index d5718dd3..00000000 --- a/libxslt/exsltconfig.go +++ /dev/null @@ -1,8 +0,0 @@ -package libxslt - -import _ "unsafe" - -const LIBEXSLT_DOTTED_VERSION = "0.8.23" -const LIBEXSLT_VERSION = 823 -const LIBEXSLT_VERSION_STRING = "823" -const LIBEXSLT_VERSION_EXTRA = "" diff --git a/libxslt/exsltexports.go b/libxslt/exsltexports.go deleted file mode 100644 index f830fa57..00000000 --- a/libxslt/exsltexports.go +++ /dev/null @@ -1,3 +0,0 @@ -package libxslt - -import _ "unsafe" diff --git a/libxslt/extensions.go b/libxslt/extensions.go deleted file mode 100644 index 2fc5d01e..00000000 --- a/libxslt/extensions.go +++ /dev/null @@ -1,148 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -/** - * xsltInitGlobals: - * - * Initialize the global variables for extensions - * - */ -//go:linkname InitGlobals C.xsltInitGlobals -func InitGlobals() - -// llgo:type C -type StyleExtInitFunction func(StylesheetPtr, *libxml2.Char) c.Pointer - -// llgo:type C -type StyleExtShutdownFunction func(StylesheetPtr, *libxml2.Char, c.Pointer) - -// llgo:type C -type ExtInitFunction func(TransformContextPtr, *libxml2.Char) c.Pointer - -// llgo:type C -type ExtShutdownFunction func(TransformContextPtr, *libxml2.Char, c.Pointer) - -//go:linkname RegisterExtModule C.xsltRegisterExtModule -func RegisterExtModule(URI *libxml2.Char, initFunc ExtInitFunction, shutdownFunc ExtShutdownFunction) c.Int - -//go:linkname RegisterExtModuleFull C.xsltRegisterExtModuleFull -func RegisterExtModuleFull(URI *libxml2.Char, initFunc ExtInitFunction, shutdownFunc ExtShutdownFunction, styleInitFunc StyleExtInitFunction, styleShutdownFunc StyleExtShutdownFunction) c.Int - -//go:linkname UnregisterExtModule C.xsltUnregisterExtModule -func UnregisterExtModule(URI *libxml2.Char) c.Int - -//go:linkname GetExtData C.xsltGetExtData -func GetExtData(ctxt TransformContextPtr, URI *libxml2.Char) c.Pointer - -//go:linkname StyleGetExtData C.xsltStyleGetExtData -func StyleGetExtData(style StylesheetPtr, URI *libxml2.Char) c.Pointer - -//go:linkname ShutdownCtxtExts C.xsltShutdownCtxtExts -func ShutdownCtxtExts(ctxt TransformContextPtr) - -//go:linkname ShutdownExts C.xsltShutdownExts -func ShutdownExts(style StylesheetPtr) - -//go:linkname XPathGetTransformContext C.xsltXPathGetTransformContext -func XPathGetTransformContext(ctxt libxml2.XPathParserContextPtr) TransformContextPtr - -/* - * extension functions - */ -//go:linkname RegisterExtModuleFunction C.xsltRegisterExtModuleFunction -func RegisterExtModuleFunction(name *libxml2.Char, URI *libxml2.Char, function libxml2.XPathFunction) c.Int - -//go:linkname ExtModuleFunctionLookup C.xsltExtModuleFunctionLookup -func ExtModuleFunctionLookup(name *libxml2.Char, URI *libxml2.Char) libxml2.XPathFunction - -//go:linkname UnregisterExtModuleFunction C.xsltUnregisterExtModuleFunction -func UnregisterExtModuleFunction(name *libxml2.Char, URI *libxml2.Char) c.Int - -// llgo:type C -type PreComputeFunction func(StylesheetPtr, libxml2.NodePtr, TransformFunction) ElemPreCompPtr - -//go:linkname NewElemPreComp C.xsltNewElemPreComp -func NewElemPreComp(style StylesheetPtr, inst libxml2.NodePtr, function TransformFunction) ElemPreCompPtr - -//go:linkname InitElemPreComp C.xsltInitElemPreComp -func InitElemPreComp(comp ElemPreCompPtr, style StylesheetPtr, inst libxml2.NodePtr, function TransformFunction, freeFunc ElemPreCompDeallocator) - -//go:linkname RegisterExtModuleElement C.xsltRegisterExtModuleElement -func RegisterExtModuleElement(name *libxml2.Char, URI *libxml2.Char, precomp PreComputeFunction, transform TransformFunction) c.Int - -//go:linkname ExtElementLookup C.xsltExtElementLookup -func ExtElementLookup(ctxt TransformContextPtr, name *libxml2.Char, URI *libxml2.Char) TransformFunction - -//go:linkname ExtModuleElementLookup C.xsltExtModuleElementLookup -func ExtModuleElementLookup(name *libxml2.Char, URI *libxml2.Char) TransformFunction - -//go:linkname ExtModuleElementPreComputeLookup C.xsltExtModuleElementPreComputeLookup -func ExtModuleElementPreComputeLookup(name *libxml2.Char, URI *libxml2.Char) PreComputeFunction - -//go:linkname UnregisterExtModuleElement C.xsltUnregisterExtModuleElement -func UnregisterExtModuleElement(name *libxml2.Char, URI *libxml2.Char) c.Int - -// llgo:type C -type TopLevelFunction func(StylesheetPtr, libxml2.NodePtr) - -//go:linkname RegisterExtModuleTopLevel C.xsltRegisterExtModuleTopLevel -func RegisterExtModuleTopLevel(name *libxml2.Char, URI *libxml2.Char, function TopLevelFunction) c.Int - -//go:linkname ExtModuleTopLevelLookup C.xsltExtModuleTopLevelLookup -func ExtModuleTopLevelLookup(name *libxml2.Char, URI *libxml2.Char) TopLevelFunction - -//go:linkname UnregisterExtModuleTopLevel C.xsltUnregisterExtModuleTopLevel -func UnregisterExtModuleTopLevel(name *libxml2.Char, URI *libxml2.Char) c.Int - -/* These 2 functions are deprecated for use within modules. */ -//go:linkname RegisterExtFunction C.xsltRegisterExtFunction -func RegisterExtFunction(ctxt TransformContextPtr, name *libxml2.Char, URI *libxml2.Char, function libxml2.XPathFunction) c.Int - -//go:linkname RegisterExtElement C.xsltRegisterExtElement -func RegisterExtElement(ctxt TransformContextPtr, name *libxml2.Char, URI *libxml2.Char, function TransformFunction) c.Int - -/* - * Extension Prefix handling API. - * Those are used by the XSLT (pre)processor. - */ -//go:linkname RegisterExtPrefix C.xsltRegisterExtPrefix -func RegisterExtPrefix(style StylesheetPtr, prefix *libxml2.Char, URI *libxml2.Char) c.Int - -//go:linkname CheckExtPrefix C.xsltCheckExtPrefix -func CheckExtPrefix(style StylesheetPtr, URI *libxml2.Char) c.Int - -//go:linkname CheckExtURI C.xsltCheckExtURI -func CheckExtURI(style StylesheetPtr, URI *libxml2.Char) c.Int - -//go:linkname InitCtxtExts C.xsltInitCtxtExts -func InitCtxtExts(ctxt TransformContextPtr) c.Int - -//go:linkname FreeCtxtExts C.xsltFreeCtxtExts -func FreeCtxtExts(ctxt TransformContextPtr) - -//go:linkname FreeExts C.xsltFreeExts -func FreeExts(style StylesheetPtr) - -//go:linkname PreComputeExtModuleElement C.xsltPreComputeExtModuleElement -func PreComputeExtModuleElement(style StylesheetPtr, inst libxml2.NodePtr) ElemPreCompPtr - -/* - * Extension Infos access. - * Used by exslt initialisation - */ -//go:linkname GetExtInfo C.xsltGetExtInfo -func GetExtInfo(style StylesheetPtr, URI *libxml2.Char) libxml2.HashTablePtr - -/** - * Test of the extension module API - */ -//go:linkname RegisterTestModule C.xsltRegisterTestModule -func RegisterTestModule() - -//go:linkname DebugDumpExtensions C.xsltDebugDumpExtensions -func DebugDumpExtensions(output *c.FILE) diff --git a/libxslt/extra.go b/libxslt/extra.go deleted file mode 100644 index 8ee85ac3..00000000 --- a/libxslt/extra.go +++ /dev/null @@ -1,19 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname FunctionNodeSet C.xsltFunctionNodeSet -func FunctionNodeSet(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname Debug C.xsltDebug -func Debug(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname RegisterExtras C.xsltRegisterExtras -func RegisterExtras(ctxt TransformContextPtr) - -//go:linkname RegisterAllExtras C.xsltRegisterAllExtras -func RegisterAllExtras() diff --git a/libxslt/functions.go b/libxslt/functions.go deleted file mode 100644 index a3addd1a..00000000 --- a/libxslt/functions.go +++ /dev/null @@ -1,43 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname XPathFunctionLookup C.xsltXPathFunctionLookup -func XPathFunctionLookup(vctxt c.Pointer, name *libxml2.Char, ns_uri *libxml2.Char) libxml2.XPathFunction - -/* - * Interfaces for the functions implementations. - */ -//go:linkname DocumentFunction C.xsltDocumentFunction -func DocumentFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname KeyFunction C.xsltKeyFunction -func KeyFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname UnparsedEntityURIFunction C.xsltUnparsedEntityURIFunction -func UnparsedEntityURIFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname FormatNumberFunction C.xsltFormatNumberFunction -func FormatNumberFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname GenerateIdFunction C.xsltGenerateIdFunction -func GenerateIdFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname SystemPropertyFunction C.xsltSystemPropertyFunction -func SystemPropertyFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname ElementAvailableFunction C.xsltElementAvailableFunction -func ElementAvailableFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -//go:linkname FunctionAvailableFunction C.xsltFunctionAvailableFunction -func FunctionAvailableFunction(ctxt libxml2.XPathParserContextPtr, nargs c.Int) - -/* - * And the registration - */ -//go:linkname RegisterAllFunctions C.xsltRegisterAllFunctions -func RegisterAllFunctions(ctxt libxml2.XPathContextPtr) diff --git a/libxslt/go.mod b/libxslt/go.mod deleted file mode 100644 index fc1541ce..00000000 --- a/libxslt/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/goplus/llpkg/libxslt - -go 1.20 - -require ( - github.com/goplus/lib v0.2.0 - github.com/goplus/llpkg/libxml2 v1.0.3 -) diff --git a/libxslt/go.sum b/libxslt/go.sum deleted file mode 100644 index 812b4bd4..00000000 --- a/libxslt/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= -github.com/goplus/llpkg/libxml2 v1.0.3 h1:yl9wAONIH9OFXaCFcr7y0AGX9OgR5R4tCglnvhcT8bw= -github.com/goplus/llpkg/libxml2 v1.0.3/go.mod h1:5YXQ8OhzQeH+udVb1NPEryxH7hAiJ75p6+f5QBy7BpM= diff --git a/libxslt/imports.go b/libxslt/imports.go deleted file mode 100644 index 87552c21..00000000 --- a/libxslt/imports.go +++ /dev/null @@ -1,28 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -/* - * Module interfaces - */ -//go:linkname ParseStylesheetImport C.xsltParseStylesheetImport -func ParseStylesheetImport(style StylesheetPtr, cur libxml2.NodePtr) c.Int - -//go:linkname ParseStylesheetInclude C.xsltParseStylesheetInclude -func ParseStylesheetInclude(style StylesheetPtr, cur libxml2.NodePtr) c.Int - -//go:linkname NextImport C.xsltNextImport -func NextImport(style StylesheetPtr) StylesheetPtr - -//go:linkname NeedElemSpaceHandling C.xsltNeedElemSpaceHandling -func NeedElemSpaceHandling(ctxt TransformContextPtr) c.Int - -//go:linkname FindElemSpaceHandling C.xsltFindElemSpaceHandling -func FindElemSpaceHandling(ctxt TransformContextPtr, node libxml2.NodePtr) c.Int - -//go:linkname FindTemplate C.xsltFindTemplate -func FindTemplate(ctxt TransformContextPtr, name *libxml2.Char, nameURI *libxml2.Char) TemplatePtr diff --git a/libxslt/keys.go b/libxslt/keys.go deleted file mode 100644 index 9767652f..00000000 --- a/libxslt/keys.go +++ /dev/null @@ -1,22 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname AddKey C.xsltAddKey -func AddKey(style StylesheetPtr, name *libxml2.Char, nameURI *libxml2.Char, match *libxml2.Char, use *libxml2.Char, inst libxml2.NodePtr) c.Int - -//go:linkname GetKey C.xsltGetKey -func GetKey(ctxt TransformContextPtr, name *libxml2.Char, nameURI *libxml2.Char, value *libxml2.Char) libxml2.NodeSetPtr - -//go:linkname InitCtxtKeys C.xsltInitCtxtKeys -func InitCtxtKeys(ctxt TransformContextPtr, doc DocumentPtr) - -//go:linkname FreeKeys C.xsltFreeKeys -func FreeKeys(style StylesheetPtr) - -//go:linkname FreeDocumentKeys C.xsltFreeDocumentKeys -func FreeDocumentKeys(doc DocumentPtr) diff --git a/libxslt/libxslt_autogen_link.go b/libxslt/libxslt_autogen_link.go deleted file mode 100644 index ebca1c92..00000000 --- a/libxslt/libxslt_autogen_link.go +++ /dev/null @@ -1,9 +0,0 @@ -package libxslt - -import ( - _ "github.com/goplus/lib/c" - _ "github.com/goplus/lib/c/os" - _ "github.com/goplus/llpkg/libxml2" -) - -const LLGoPackage string = "link: $(pkg-config --libs libxslt);" diff --git a/libxslt/llcppg.cfg b/libxslt/llcppg.cfg deleted file mode 100644 index f77bc55b..00000000 --- a/libxslt/llcppg.cfg +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "libxslt", - "cflags": "$(pkg-config --cflags libxslt)", - "libs": "$(pkg-config --libs libxslt)", - "include": [ - "libxslt/variables.h", - "libxslt/functions.h", - "libxslt/xsltutils.h", - "libxslt/templates.h", - "libxslt/pattern.h", - "libxslt/preproc.h", - "libxslt/extra.h", - "libxslt/documents.h", - "libxslt/imports.h", - "libxslt/keys.h", - "libxslt/transform.h", - "libxslt/attributes.h", - "libxslt/security.h", - "libxslt/extensions.h", - "libxslt/xsltInternals.h", - "libexslt/exslt.h", - "libxslt/numbersInternals.h", - "libxslt/namespaces.h", - "libxslt/xslt.h", - "libxslt/xsltlocale.h", - "libexslt/exsltexports.h", - "libxslt/xsltconfig.h", - "libxslt/xsltexports.h", - "libexslt/exsltconfig.h" - ], - "trimPrefixes": ["XSLT_","xslt"], - "cplusplus": false, - "deps": ["c/os","github.com/goplus/llpkg/libxml2@v1.0.3"], - "symMap":{ - "xsltSetCtxtLocaleHandlers":"-" - } -} diff --git a/libxslt/llcppg.pub b/libxslt/llcppg.pub deleted file mode 100644 index 4dbe1807..00000000 --- a/libxslt/llcppg.pub +++ /dev/null @@ -1,58 +0,0 @@ -xsltAddCallCallback AddCallCallback -xsltCompMatch CompMatch -xsltCompMatchPtr CompMatchPtr -xsltDebugStatusCodes DebugStatusCodes -xsltDebugTraceCodes DebugTraceCodes -xsltDecimalFormat DecimalFormat -xsltDecimalFormatPtr DecimalFormatPtr -xsltDocLoaderFunc DocLoaderFunc -xsltDocument Document -xsltDocumentPtr DocumentPtr -xsltDropCallCallback DropCallCallback -xsltElemPreComp ElemPreComp -xsltElemPreCompDeallocator ElemPreCompDeallocator -xsltElemPreCompPtr ElemPreCompPtr -xsltExtInitFunction ExtInitFunction -xsltExtShutdownFunction ExtShutdownFunction -xsltFormatNumberInfo FormatNumberInfo -xsltFormatNumberInfoPtr FormatNumberInfoPtr -xsltFreeLocaleFunc FreeLocaleFunc -xsltGenSortKeyFunc GenSortKeyFunc -xsltHandleDebuggerCallback HandleDebuggerCallback -xsltKeyDef KeyDef -xsltKeyDefPtr KeyDefPtr -xsltKeyTable KeyTable -xsltKeyTablePtr KeyTablePtr -xsltLoadType LoadType -xsltLocale Locale -xsltLocaleChar LocaleChar -xsltNewLocaleFunc NewLocaleFunc -xsltNumberData NumberData -xsltNumberDataPtr NumberDataPtr -xsltOutputType OutputType -xsltPreComputeFunction PreComputeFunction -xsltRuntimeExtra RuntimeExtra -xsltRuntimeExtraPtr RuntimeExtraPtr -xsltSecurityCheck SecurityCheck -xsltSecurityOption SecurityOption -xsltSecurityPrefs SecurityPrefs -xsltSecurityPrefsPtr SecurityPrefsPtr -xsltSortFunc SortFunc -xsltStackElem StackElem -xsltStackElemPtr StackElemPtr -xsltStyleExtInitFunction StyleExtInitFunction -xsltStyleExtShutdownFunction StyleExtShutdownFunction -xsltStylePreComp StylePreComp -xsltStylePreCompPtr StylePreCompPtr -xsltStyleType StyleType -xsltStylesheet Stylesheet -xsltStylesheetPtr StylesheetPtr -xsltTemplate Template -xsltTemplatePtr TemplatePtr -xsltTopLevelFunction TopLevelFunction -xsltTransformCache TransformCache -xsltTransformCachePtr TransformCachePtr -xsltTransformContext TransformContext -xsltTransformContextPtr TransformContextPtr -xsltTransformFunction TransformFunction -xsltTransformState TransformState \ No newline at end of file diff --git a/libxslt/llpkg.cfg b/libxslt/llpkg.cfg deleted file mode 100644 index a47b88af..00000000 --- a/libxslt/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ - -{ - "upstream": { - "package": { - "name": "libxslt", - "version": "1.1.42" - }, - "installer":{ - "name": "conan", - "config" : { - "options": "libxml2/*:iconv=False" - } - } - } -} \ No newline at end of file diff --git a/libxslt/namespaces.go b/libxslt/namespaces.go deleted file mode 100644 index a8fc9911..00000000 --- a/libxslt/namespaces.go +++ /dev/null @@ -1,27 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname NamespaceAlias C.xsltNamespaceAlias -func NamespaceAlias(style StylesheetPtr, node libxml2.NodePtr) - -//go:linkname GetNamespace C.xsltGetNamespace -func GetNamespace(ctxt TransformContextPtr, cur libxml2.NodePtr, ns libxml2.NsPtr, out libxml2.NodePtr) libxml2.NsPtr - -//go:linkname GetPlainNamespace C.xsltGetPlainNamespace -func GetPlainNamespace(ctxt TransformContextPtr, cur libxml2.NodePtr, ns libxml2.NsPtr, out libxml2.NodePtr) libxml2.NsPtr - -//go:linkname GetSpecialNamespace C.xsltGetSpecialNamespace -func GetSpecialNamespace(ctxt TransformContextPtr, cur libxml2.NodePtr, URI *libxml2.Char, prefix *libxml2.Char, out libxml2.NodePtr) libxml2.NsPtr - -//go:linkname CopyNamespace C.xsltCopyNamespace -func CopyNamespace(ctxt TransformContextPtr, elem libxml2.NodePtr, ns libxml2.NsPtr) libxml2.NsPtr - -//go:linkname CopyNamespaceList C.xsltCopyNamespaceList -func CopyNamespaceList(ctxt TransformContextPtr, node libxml2.NodePtr, cur libxml2.NsPtr) libxml2.NsPtr - -//go:linkname FreeNamespaceAliasHashes C.xsltFreeNamespaceAliasHashes -func FreeNamespaceAliasHashes(style StylesheetPtr) diff --git a/libxslt/numbersInternals.go b/libxslt/numbersInternals.go deleted file mode 100644 index 228287c0..00000000 --- a/libxslt/numbersInternals.go +++ /dev/null @@ -1,43 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -type X_xsltCompMatch struct { - Unused [8]uint8 -} - -type X_xsltNumberData struct { - Level *libxml2.Char - Count *libxml2.Char - From *libxml2.Char - Value *libxml2.Char - Format *libxml2.Char - HasFormat c.Int - DigitsPerGroup c.Int - GroupingCharacter c.Int - GroupingCharacterLen c.Int - Doc libxml2.DocPtr - Node libxml2.NodePtr - CountPat *X_xsltCompMatch - FromPat *X_xsltCompMatch -} -type NumberData X_xsltNumberData -type NumberDataPtr *NumberData - -type X_xsltFormatNumberInfo struct { - IntegerHash c.Int - IntegerDigits c.Int - FracDigits c.Int - FracHash c.Int - Group c.Int - Multiplier c.Int - AddDecimal c.Char - IsMultiplierSet c.Char - IsNegativePattern c.Char -} -type FormatNumberInfo X_xsltFormatNumberInfo -type FormatNumberInfoPtr *FormatNumberInfo diff --git a/libxslt/pattern.go b/libxslt/pattern.go deleted file mode 100644 index 0c6e925d..00000000 --- a/libxslt/pattern.go +++ /dev/null @@ -1,43 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -type CompMatch X_xsltCompMatch -type CompMatchPtr *CompMatch - -/* - * Pattern related interfaces. - */ -//go:linkname CompilePattern C.xsltCompilePattern -func CompilePattern(pattern *libxml2.Char, doc libxml2.DocPtr, node libxml2.NodePtr, style StylesheetPtr, runtime TransformContextPtr) CompMatchPtr - -//go:linkname FreeCompMatchList C.xsltFreeCompMatchList -func FreeCompMatchList(comp CompMatchPtr) - -//go:linkname TestCompMatchList C.xsltTestCompMatchList -func TestCompMatchList(ctxt TransformContextPtr, node libxml2.NodePtr, comp CompMatchPtr) c.Int - -//go:linkname CompMatchClearCache C.xsltCompMatchClearCache -func CompMatchClearCache(ctxt TransformContextPtr, comp CompMatchPtr) - -//go:linkname NormalizeCompSteps C.xsltNormalizeCompSteps -func NormalizeCompSteps(payload c.Pointer, data c.Pointer, name *libxml2.Char) - -/* - * Template related interfaces. - */ -//go:linkname AddTemplate C.xsltAddTemplate -func AddTemplate(style StylesheetPtr, cur TemplatePtr, mode *libxml2.Char, modeURI *libxml2.Char) c.Int - -//go:linkname GetTemplate C.xsltGetTemplate -func GetTemplate(ctxt TransformContextPtr, node libxml2.NodePtr, style StylesheetPtr) TemplatePtr - -//go:linkname FreeTemplateHashes C.xsltFreeTemplateHashes -func FreeTemplateHashes(style StylesheetPtr) - -//go:linkname CleanupTemplates C.xsltCleanupTemplates -func CleanupTemplates(style StylesheetPtr) diff --git a/libxslt/preproc.go b/libxslt/preproc.go deleted file mode 100644 index 6c3ceb09..00000000 --- a/libxslt/preproc.go +++ /dev/null @@ -1,15 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname DocumentComp C.xsltDocumentComp -func DocumentComp(style StylesheetPtr, inst libxml2.NodePtr, function TransformFunction) ElemPreCompPtr - -//go:linkname StylePreCompute C.xsltStylePreCompute -func StylePreCompute(style StylesheetPtr, inst libxml2.NodePtr) - -//go:linkname FreeStylePreComps C.xsltFreeStylePreComps -func FreeStylePreComps(style StylesheetPtr) diff --git a/libxslt/security.go b/libxslt/security.go deleted file mode 100644 index bd1c15e0..00000000 --- a/libxslt/security.go +++ /dev/null @@ -1,64 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -type X_xsltSecurityPrefs struct { - Unused [8]uint8 -} -type SecurityPrefs X_xsltSecurityPrefs -type SecurityPrefsPtr *SecurityPrefs -type SecurityOption c.Int - -const ( - SECPREF_READ_FILE SecurityOption = 1 - SECPREF_WRITE_FILE SecurityOption = 2 - SECPREF_CREATE_DIRECTORY SecurityOption = 3 - SECPREF_READ_NETWORK SecurityOption = 4 - SECPREF_WRITE_NETWORK SecurityOption = 5 -) - -// llgo:type C -type SecurityCheck func(SecurityPrefsPtr, TransformContextPtr, *c.Char) c.Int - -/* - * Module interfaces - */ -//go:linkname NewSecurityPrefs C.xsltNewSecurityPrefs -func NewSecurityPrefs() SecurityPrefsPtr - -//go:linkname FreeSecurityPrefs C.xsltFreeSecurityPrefs -func FreeSecurityPrefs(sec SecurityPrefsPtr) - -//go:linkname SetSecurityPrefs C.xsltSetSecurityPrefs -func SetSecurityPrefs(sec SecurityPrefsPtr, option SecurityOption, func_ SecurityCheck) c.Int - -//go:linkname GetSecurityPrefs C.xsltGetSecurityPrefs -func GetSecurityPrefs(sec SecurityPrefsPtr, option SecurityOption) SecurityCheck - -//go:linkname SetDefaultSecurityPrefs C.xsltSetDefaultSecurityPrefs -func SetDefaultSecurityPrefs(sec SecurityPrefsPtr) - -//go:linkname GetDefaultSecurityPrefs C.xsltGetDefaultSecurityPrefs -func GetDefaultSecurityPrefs() SecurityPrefsPtr - -//go:linkname SetCtxtSecurityPrefs C.xsltSetCtxtSecurityPrefs -func SetCtxtSecurityPrefs(sec SecurityPrefsPtr, ctxt TransformContextPtr) c.Int - -//go:linkname SecurityAllow C.xsltSecurityAllow -func SecurityAllow(sec SecurityPrefsPtr, ctxt TransformContextPtr, value *c.Char) c.Int - -//go:linkname SecurityForbid C.xsltSecurityForbid -func SecurityForbid(sec SecurityPrefsPtr, ctxt TransformContextPtr, value *c.Char) c.Int - -/* - * internal interfaces - */ -//go:linkname CheckWrite C.xsltCheckWrite -func CheckWrite(sec SecurityPrefsPtr, ctxt TransformContextPtr, URL *libxml2.Char) c.Int - -//go:linkname CheckRead C.xsltCheckRead -func CheckRead(sec SecurityPrefsPtr, ctxt TransformContextPtr, URL *libxml2.Char) c.Int diff --git a/libxslt/templates.go b/libxslt/templates.go deleted file mode 100644 index 7f2e3d43..00000000 --- a/libxslt/templates.go +++ /dev/null @@ -1,41 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname EvalXPathPredicate C.xsltEvalXPathPredicate -func EvalXPathPredicate(ctxt TransformContextPtr, comp libxml2.XPathCompExprPtr, nsList *libxml2.NsPtr, nsNr c.Int) c.Int - -//go:linkname EvalTemplateString C.xsltEvalTemplateString -func EvalTemplateString(ctxt TransformContextPtr, contextNode libxml2.NodePtr, inst libxml2.NodePtr) *libxml2.Char - -//go:linkname EvalAttrValueTemplate C.xsltEvalAttrValueTemplate -func EvalAttrValueTemplate(ctxt TransformContextPtr, node libxml2.NodePtr, name *libxml2.Char, ns *libxml2.Char) *libxml2.Char - -//go:linkname EvalStaticAttrValueTemplate C.xsltEvalStaticAttrValueTemplate -func EvalStaticAttrValueTemplate(style StylesheetPtr, node libxml2.NodePtr, name *libxml2.Char, ns *libxml2.Char, found *c.Int) *libxml2.Char - -/* TODO: this is obviously broken ... the namespaces should be passed too ! */ -//go:linkname EvalXPathString C.xsltEvalXPathString -func EvalXPathString(ctxt TransformContextPtr, comp libxml2.XPathCompExprPtr) *libxml2.Char - -//go:linkname EvalXPathStringNs C.xsltEvalXPathStringNs -func EvalXPathStringNs(ctxt TransformContextPtr, comp libxml2.XPathCompExprPtr, nsNr c.Int, nsList *libxml2.NsPtr) *libxml2.Char - -//go:linkname TemplateProcess C.xsltTemplateProcess -func TemplateProcess(ctxt TransformContextPtr, node libxml2.NodePtr) *libxml2.NodePtr - -//go:linkname AttrListTemplateProcess C.xsltAttrListTemplateProcess -func AttrListTemplateProcess(ctxt TransformContextPtr, target libxml2.NodePtr, cur libxml2.AttrPtr) libxml2.AttrPtr - -//go:linkname AttrTemplateProcess C.xsltAttrTemplateProcess -func AttrTemplateProcess(ctxt TransformContextPtr, target libxml2.NodePtr, attr libxml2.AttrPtr) libxml2.AttrPtr - -//go:linkname AttrTemplateValueProcess C.xsltAttrTemplateValueProcess -func AttrTemplateValueProcess(ctxt TransformContextPtr, attr *libxml2.Char) *libxml2.Char - -//go:linkname AttrTemplateValueProcessNode C.xsltAttrTemplateValueProcessNode -func AttrTemplateValueProcessNode(ctxt TransformContextPtr, str *libxml2.Char, node libxml2.NodePtr) *libxml2.Char diff --git a/libxslt/transform.go b/libxslt/transform.go deleted file mode 100644 index 51538064..00000000 --- a/libxslt/transform.go +++ /dev/null @@ -1,116 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -/** - * XInclude default processing. - */ -//go:linkname SetXIncludeDefault C.xsltSetXIncludeDefault -func SetXIncludeDefault(xinclude c.Int) - -//go:linkname GetXIncludeDefault C.xsltGetXIncludeDefault -func GetXIncludeDefault() c.Int - -/** - * Export context to users. - */ -//go:linkname NewTransformContext C.xsltNewTransformContext -func NewTransformContext(style StylesheetPtr, doc libxml2.DocPtr) TransformContextPtr - -//go:linkname FreeTransformContext C.xsltFreeTransformContext -func FreeTransformContext(ctxt TransformContextPtr) - -//go:linkname ApplyStylesheetUser C.xsltApplyStylesheetUser -func ApplyStylesheetUser(style StylesheetPtr, doc libxml2.DocPtr, params **c.Char, output *c.Char, profile *c.FILE, userCtxt TransformContextPtr) libxml2.DocPtr - -//go:linkname ProcessOneNode C.xsltProcessOneNode -func ProcessOneNode(ctxt TransformContextPtr, node libxml2.NodePtr, params StackElemPtr) - -/** - * Private Interfaces. - */ -//go:linkname ApplyStripSpaces C.xsltApplyStripSpaces -func ApplyStripSpaces(ctxt TransformContextPtr, node libxml2.NodePtr) - -//go:linkname ApplyStylesheet C.xsltApplyStylesheet -func ApplyStylesheet(style StylesheetPtr, doc libxml2.DocPtr, params **c.Char) libxml2.DocPtr - -//go:linkname ProfileStylesheet C.xsltProfileStylesheet -func ProfileStylesheet(style StylesheetPtr, doc libxml2.DocPtr, params **c.Char, output *c.FILE) libxml2.DocPtr - -//go:linkname RunStylesheet C.xsltRunStylesheet -func RunStylesheet(style StylesheetPtr, doc libxml2.DocPtr, params **c.Char, output *c.Char, SAX libxml2.SAXHandlerPtr, IObuf libxml2.OutputBufferPtr) c.Int - -//go:linkname RunStylesheetUser C.xsltRunStylesheetUser -func RunStylesheetUser(style StylesheetPtr, doc libxml2.DocPtr, params **c.Char, output *c.Char, SAX libxml2.SAXHandlerPtr, IObuf libxml2.OutputBufferPtr, profile *c.FILE, userCtxt TransformContextPtr) c.Int - -//go:linkname ApplyOneTemplate C.xsltApplyOneTemplate -func ApplyOneTemplate(ctxt TransformContextPtr, node libxml2.NodePtr, list libxml2.NodePtr, templ TemplatePtr, params StackElemPtr) - -//go:linkname DocumentElem C.xsltDocumentElem -func DocumentElem(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Sort C.xsltSort -func Sort(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Copy C.xsltCopy -func Copy(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Text C.xsltText -func Text(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Element C.xsltElement -func Element(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Comment C.xsltComment -func Comment(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Attribute C.xsltAttribute -func Attribute(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname ProcessingInstruction C.xsltProcessingInstruction -func ProcessingInstruction(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname CopyOf C.xsltCopyOf -func CopyOf(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname ValueOf C.xsltValueOf -func ValueOf(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Number C.xsltNumber -func Number(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname ApplyImports C.xsltApplyImports -func ApplyImports(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname CallTemplate C.xsltCallTemplate -func CallTemplate(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname ApplyTemplates C.xsltApplyTemplates -func ApplyTemplates(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname Choose C.xsltChoose -func Choose(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname If C.xsltIf -func If(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname ForEach C.xsltForEach -func ForEach(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr, comp ElemPreCompPtr) - -//go:linkname RegisterAllElement C.xsltRegisterAllElement -func RegisterAllElement(ctxt TransformContextPtr) - -//go:linkname CopyTextString C.xsltCopyTextString -func CopyTextString(ctxt TransformContextPtr, target libxml2.NodePtr, string *libxml2.Char, noescape c.Int) libxml2.NodePtr - -/* Following 2 functions needed for libexslt/functions.c */ -//go:linkname LocalVariablePop C.xsltLocalVariablePop -func LocalVariablePop(ctxt TransformContextPtr, limitNr c.Int, level c.Int) - -//go:linkname LocalVariablePush C.xsltLocalVariablePush -func LocalVariablePush(ctxt TransformContextPtr, variable StackElemPtr, level c.Int) c.Int diff --git a/libxslt/variables.go b/libxslt/variables.go deleted file mode 100644 index 1008de2f..00000000 --- a/libxslt/variables.go +++ /dev/null @@ -1,56 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -const RVT_LOCAL = 1 -const RVT_FUNC_RESULT = 2 -const RVT_GLOBAL = 3 - -/* - * Interfaces for the variable module. - */ -//go:linkname EvalGlobalVariables C.xsltEvalGlobalVariables -func EvalGlobalVariables(ctxt TransformContextPtr) c.Int - -//go:linkname EvalUserParams C.xsltEvalUserParams -func EvalUserParams(ctxt TransformContextPtr, params **c.Char) c.Int - -//go:linkname QuoteUserParams C.xsltQuoteUserParams -func QuoteUserParams(ctxt TransformContextPtr, params **c.Char) c.Int - -//go:linkname EvalOneUserParam C.xsltEvalOneUserParam -func EvalOneUserParam(ctxt TransformContextPtr, name *libxml2.Char, value *libxml2.Char) c.Int - -//go:linkname QuoteOneUserParam C.xsltQuoteOneUserParam -func QuoteOneUserParam(ctxt TransformContextPtr, name *libxml2.Char, value *libxml2.Char) c.Int - -//go:linkname ParseGlobalVariable C.xsltParseGlobalVariable -func ParseGlobalVariable(style StylesheetPtr, cur libxml2.NodePtr) - -//go:linkname ParseGlobalParam C.xsltParseGlobalParam -func ParseGlobalParam(style StylesheetPtr, cur libxml2.NodePtr) - -//go:linkname ParseStylesheetVariable C.xsltParseStylesheetVariable -func ParseStylesheetVariable(ctxt TransformContextPtr, cur libxml2.NodePtr) - -//go:linkname ParseStylesheetParam C.xsltParseStylesheetParam -func ParseStylesheetParam(ctxt TransformContextPtr, cur libxml2.NodePtr) - -//go:linkname ParseStylesheetCallerParam C.xsltParseStylesheetCallerParam -func ParseStylesheetCallerParam(ctxt TransformContextPtr, cur libxml2.NodePtr) StackElemPtr - -//go:linkname AddStackElemList C.xsltAddStackElemList -func AddStackElemList(ctxt TransformContextPtr, elems StackElemPtr) c.Int - -//go:linkname FreeGlobalVariables C.xsltFreeGlobalVariables -func FreeGlobalVariables(ctxt TransformContextPtr) - -//go:linkname VariableLookup C.xsltVariableLookup -func VariableLookup(ctxt TransformContextPtr, name *libxml2.Char, ns_uri *libxml2.Char) libxml2.XPathObjectPtr - -//go:linkname XPathVariableLookup C.xsltXPathVariableLookup -func XPathVariableLookup(ctxt c.Pointer, name *libxml2.Char, ns_uri *libxml2.Char) libxml2.XPathObjectPtr diff --git a/libxslt/xslt.go b/libxslt/xslt.go deleted file mode 100644 index b2ca88c4..00000000 --- a/libxslt/xslt.go +++ /dev/null @@ -1,19 +0,0 @@ -package libxslt - -import _ "unsafe" - -const DEFAULT_VERSION = "1.0" -const DEFAULT_VENDOR = "libxslt" -const DEFAULT_URL = "http://xmlsoft.org/XSLT/" - -/* - * Global initialization function. - */ -//go:linkname Init C.xsltInit -func Init() - -/* - * Global cleanup function. - */ -//go:linkname CleanupGlobals C.xsltCleanupGlobals -func CleanupGlobals() diff --git a/libxslt/xsltInternals.go b/libxslt/xsltInternals.go deleted file mode 100644 index 6c9236bd..00000000 --- a/libxslt/xsltInternals.go +++ /dev/null @@ -1,490 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -const MAX_SORT = 15 - -type X_xsltRuntimeExtra struct { - Info c.Pointer - Deallocate libxml2.FreeFunc - Val struct { - Ptr c.Pointer - } -} -type RuntimeExtra X_xsltRuntimeExtra -type RuntimeExtraPtr *RuntimeExtra - -type X_xsltTemplate struct { - Next *X_xsltTemplate - Style *X_xsltStylesheet - Match *libxml2.Char - Priority c.Float - Name *libxml2.Char - NameURI *libxml2.Char - Mode *libxml2.Char - ModeURI *libxml2.Char - Content libxml2.NodePtr - Elem libxml2.NodePtr - InheritedNsNr c.Int - InheritedNs *libxml2.NsPtr - NbCalls c.Int - Time c.Ulong - Params c.Pointer - TemplNr c.Int - TemplMax c.Int - TemplCalledTab *TemplatePtr - TemplCountTab *c.Int - Position c.Int -} -type Template X_xsltTemplate -type TemplatePtr *Template - -type X_xsltStylesheet struct { - Parent *X_xsltStylesheet - Next *X_xsltStylesheet - Imports *X_xsltStylesheet - DocList DocumentPtr - Doc libxml2.DocPtr - StripSpaces libxml2.HashTablePtr - StripAll c.Int - CdataSection libxml2.HashTablePtr - Variables StackElemPtr - Templates TemplatePtr - TemplatesHash libxml2.HashTablePtr - RootMatch *X_xsltCompMatch - KeyMatch *X_xsltCompMatch - ElemMatch *X_xsltCompMatch - AttrMatch *X_xsltCompMatch - ParentMatch *X_xsltCompMatch - TextMatch *X_xsltCompMatch - PiMatch *X_xsltCompMatch - CommentMatch *X_xsltCompMatch - NsAliases libxml2.HashTablePtr - AttributeSets libxml2.HashTablePtr - NsHash libxml2.HashTablePtr - NsDefs c.Pointer - Keys c.Pointer - Method *libxml2.Char - MethodURI *libxml2.Char - Version *libxml2.Char - Encoding *libxml2.Char - OmitXmlDeclaration c.Int - DecimalFormat DecimalFormatPtr - Standalone c.Int - DoctypePublic *libxml2.Char - DoctypeSystem *libxml2.Char - Indent c.Int - MediaType *libxml2.Char - PreComps ElemPreCompPtr - Warnings c.Int - Errors c.Int - ExclPrefix *libxml2.Char - ExclPrefixTab **libxml2.Char - ExclPrefixNr c.Int - ExclPrefixMax c.Int - X_private c.Pointer - ExtInfos libxml2.HashTablePtr - ExtrasNr c.Int - Includes DocumentPtr - Dict libxml2.DictPtr - AttVTs c.Pointer - DefaultAlias *libxml2.Char - Nopreproc c.Int - Internalized c.Int - LiteralResult c.Int - Principal StylesheetPtr - ForwardsCompatible c.Int - NamedTemplates libxml2.HashTablePtr - XpathCtxt libxml2.XPathContextPtr - OpLimit c.Ulong - OpCount c.Ulong -} - -type X_xsltDecimalFormat struct { - Next *X_xsltDecimalFormat - Name *libxml2.Char - Digit *libxml2.Char - PatternSeparator *libxml2.Char - MinusSign *libxml2.Char - Infinity *libxml2.Char - NoNumber *libxml2.Char - DecimalPoint *libxml2.Char - Grouping *libxml2.Char - Percent *libxml2.Char - Permille *libxml2.Char - ZeroDigit *libxml2.Char - NsUri *libxml2.Char -} -type DecimalFormat X_xsltDecimalFormat -type DecimalFormatPtr *DecimalFormat - -type X_xsltDocument struct { - Next *X_xsltDocument - Main c.Int - Doc libxml2.DocPtr - Keys c.Pointer - Includes *X_xsltDocument - Preproc c.Int - NbKeysComputed c.Int -} -type Document X_xsltDocument -type DocumentPtr *Document - -type X_xsltKeyDef struct { - Next *X_xsltKeyDef - Inst libxml2.NodePtr - Name *libxml2.Char - NameURI *libxml2.Char - Match *libxml2.Char - Use *libxml2.Char - Comp libxml2.XPathCompExprPtr - Usecomp libxml2.XPathCompExprPtr - NsList *libxml2.NsPtr - NsNr c.Int -} -type KeyDef X_xsltKeyDef -type KeyDefPtr *KeyDef - -type X_xsltKeyTable struct { - Next *X_xsltKeyTable - Name *libxml2.Char - NameURI *libxml2.Char - Keys libxml2.HashTablePtr -} -type KeyTable X_xsltKeyTable -type KeyTablePtr *KeyTable -type Stylesheet X_xsltStylesheet -type StylesheetPtr *Stylesheet - -type X_xsltTransformContext struct { - Style StylesheetPtr - Type OutputType - Templ TemplatePtr - TemplNr c.Int - TemplMax c.Int - TemplTab *TemplatePtr - Vars StackElemPtr - VarsNr c.Int - VarsMax c.Int - VarsTab *StackElemPtr - VarsBase c.Int - ExtFunctions libxml2.HashTablePtr - ExtElements libxml2.HashTablePtr - ExtInfos libxml2.HashTablePtr - Mode *libxml2.Char - ModeURI *libxml2.Char - DocList DocumentPtr - Document DocumentPtr - Node libxml2.NodePtr - NodeList libxml2.NodeSetPtr - Output libxml2.DocPtr - Insert libxml2.NodePtr - XpathCtxt libxml2.XPathContextPtr - State TransformState - GlobalVars libxml2.HashTablePtr - Inst libxml2.NodePtr - Xinclude c.Int - OutputFile *c.Char - Profile c.Int - Prof c.Long - ProfNr c.Int - ProfMax c.Int - ProfTab *c.Long - X_private c.Pointer - ExtrasNr c.Int - ExtrasMax c.Int - Extras RuntimeExtraPtr - StyleList DocumentPtr - Sec c.Pointer - Error libxml2.GenericErrorFunc - Errctx c.Pointer - Sortfunc SortFunc - TmpRVT libxml2.DocPtr - PersistRVT libxml2.DocPtr - Ctxtflags c.Int - Lasttext *libxml2.Char - Lasttsize c.Int - Lasttuse c.Int - DebugStatus c.Int - TraceCode *c.Ulong - ParserOptions c.Int - Dict libxml2.DictPtr - TmpDoc libxml2.DocPtr - Internalized c.Int - NbKeys c.Int - HasTemplKeyPatterns c.Int - CurrentTemplateRule TemplatePtr - InitialContextNode libxml2.NodePtr - InitialContextDoc libxml2.DocPtr - Cache TransformCachePtr - ContextVariable c.Pointer - LocalRVT libxml2.DocPtr - LocalRVTBase libxml2.DocPtr - KeyInitLevel c.Int - Depth c.Int - MaxTemplateDepth c.Int - MaxTemplateVars c.Int - OpLimit c.Ulong - OpCount c.Ulong - SourceDocDirty c.Int - CurrentId c.Ulong - NewLocale NewLocaleFunc - FreeLocale FreeLocaleFunc - GenSortKey GenSortKeyFunc -} -type TransformContext X_xsltTransformContext -type TransformContextPtr *TransformContext - -type X_xsltElemPreComp struct { - Next ElemPreCompPtr - Type StyleType - Func TransformFunction - Inst libxml2.NodePtr - Free ElemPreCompDeallocator -} -type ElemPreComp X_xsltElemPreComp -type ElemPreCompPtr *ElemPreComp - -// llgo:type C -type TransformFunction func(TransformContextPtr, libxml2.NodePtr, libxml2.NodePtr, ElemPreCompPtr) - -// llgo:type C -type SortFunc func(TransformContextPtr, *libxml2.NodePtr, c.Int) -type StyleType c.Int - -const ( - FUNC_COPY StyleType = 1 - FUNC_SORT StyleType = 2 - FUNC_TEXT StyleType = 3 - FUNC_ELEMENT StyleType = 4 - FUNC_ATTRIBUTE StyleType = 5 - FUNC_COMMENT StyleType = 6 - FUNC_PI StyleType = 7 - FUNC_COPYOF StyleType = 8 - FUNC_VALUEOF StyleType = 9 - FUNC_NUMBER StyleType = 10 - FUNC_APPLYIMPORTS StyleType = 11 - FUNC_CALLTEMPLATE StyleType = 12 - FUNC_APPLYTEMPLATES StyleType = 13 - FUNC_CHOOSE StyleType = 14 - FUNC_IF StyleType = 15 - FUNC_FOREACH StyleType = 16 - FUNC_DOCUMENT StyleType = 17 - FUNC_WITHPARAM StyleType = 18 - FUNC_PARAM StyleType = 19 - FUNC_VARIABLE StyleType = 20 - FUNC_WHEN StyleType = 21 - FUNC_EXTENSION StyleType = 22 -) - -// llgo:type C -type ElemPreCompDeallocator func(ElemPreCompPtr) - -type X_xsltStylePreComp struct { - Next ElemPreCompPtr - Type StyleType - Func TransformFunction - Inst libxml2.NodePtr - Stype *libxml2.Char - HasStype c.Int - Number c.Int - Order *libxml2.Char - HasOrder c.Int - Descending c.Int - Lang *libxml2.Char - HasLang c.Int - CaseOrder *libxml2.Char - LowerFirst c.Int - Use *libxml2.Char - HasUse c.Int - Noescape c.Int - Name *libxml2.Char - HasName c.Int - Ns *libxml2.Char - HasNs c.Int - Mode *libxml2.Char - ModeURI *libxml2.Char - Test *libxml2.Char - Templ TemplatePtr - Select *libxml2.Char - Ver11 c.Int - Filename *libxml2.Char - HasFilename c.Int - Numdata NumberData - Comp libxml2.XPathCompExprPtr - NsList *libxml2.NsPtr - NsNr c.Int -} -type StylePreComp X_xsltStylePreComp -type StylePreCompPtr *StylePreComp - -type X_xsltStackElem struct { - Next *X_xsltStackElem - Comp StylePreCompPtr - Computed c.Int - Name *libxml2.Char - NameURI *libxml2.Char - Select *libxml2.Char - Tree libxml2.NodePtr - Value libxml2.XPathObjectPtr - Fragment libxml2.DocPtr - Level c.Int - Context TransformContextPtr - Flags c.Int -} -type StackElem X_xsltStackElem -type StackElemPtr *StackElem - -type X_xsltTransformCache struct { - RVT libxml2.DocPtr - NbRVT c.Int - StackItems StackElemPtr - NbStackItems c.Int -} -type TransformCache X_xsltTransformCache -type TransformCachePtr *TransformCache -type OutputType c.Int - -const ( - OUTPUT_XML OutputType = 0 - OUTPUT_HTML OutputType = 1 - OUTPUT_TEXT OutputType = 2 -) - -// llgo:type C -type NewLocaleFunc func(*libxml2.Char, c.Int) c.Pointer - -// llgo:type C -type FreeLocaleFunc func(c.Pointer) - -// llgo:type C -type GenSortKeyFunc func(c.Pointer, *libxml2.Char) *libxml2.Char -type TransformState c.Int - -const ( - STATE_OK TransformState = 0 - STATE_ERROR TransformState = 1 - STATE_STOPPED TransformState = 2 -) - -/* - * Functions associated to the internal types -xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, - xmlChar *name); -*/ -//go:linkname NewStylesheet C.xsltNewStylesheet -func NewStylesheet() StylesheetPtr - -//go:linkname ParseStylesheetFile C.xsltParseStylesheetFile -func ParseStylesheetFile(filename *libxml2.Char) StylesheetPtr - -//go:linkname FreeStylesheet C.xsltFreeStylesheet -func FreeStylesheet(style StylesheetPtr) - -//go:linkname IsBlank C.xsltIsBlank -func IsBlank(str *libxml2.Char) c.Int - -//go:linkname FreeStackElemList C.xsltFreeStackElemList -func FreeStackElemList(elem StackElemPtr) - -//go:linkname DecimalFormatGetByName C.xsltDecimalFormatGetByName -func DecimalFormatGetByName(style StylesheetPtr, name *libxml2.Char) DecimalFormatPtr - -//go:linkname DecimalFormatGetByQName C.xsltDecimalFormatGetByQName -func DecimalFormatGetByQName(style StylesheetPtr, nsUri *libxml2.Char, name *libxml2.Char) DecimalFormatPtr - -//go:linkname ParseStylesheetProcess C.xsltParseStylesheetProcess -func ParseStylesheetProcess(ret StylesheetPtr, doc libxml2.DocPtr) StylesheetPtr - -//go:linkname ParseStylesheetOutput C.xsltParseStylesheetOutput -func ParseStylesheetOutput(style StylesheetPtr, cur libxml2.NodePtr) - -//go:linkname ParseStylesheetDoc C.xsltParseStylesheetDoc -func ParseStylesheetDoc(doc libxml2.DocPtr) StylesheetPtr - -//go:linkname ParseStylesheetImportedDoc C.xsltParseStylesheetImportedDoc -func ParseStylesheetImportedDoc(doc libxml2.DocPtr, style StylesheetPtr) StylesheetPtr - -//go:linkname ParseStylesheetUser C.xsltParseStylesheetUser -func ParseStylesheetUser(style StylesheetPtr, doc libxml2.DocPtr) c.Int - -//go:linkname LoadStylesheetPI C.xsltLoadStylesheetPI -func LoadStylesheetPI(doc libxml2.DocPtr) StylesheetPtr - -//go:linkname NumberFormat C.xsltNumberFormat -func NumberFormat(ctxt TransformContextPtr, data NumberDataPtr, node libxml2.NodePtr) - -//go:linkname FormatNumberConversion C.xsltFormatNumberConversion -func FormatNumberConversion(self DecimalFormatPtr, format *libxml2.Char, number c.Double, result **libxml2.Char) libxml2.XPathError - -//go:linkname ParseTemplateContent C.xsltParseTemplateContent -func ParseTemplateContent(style StylesheetPtr, templ libxml2.NodePtr) - -//go:linkname AllocateExtra C.xsltAllocateExtra -func AllocateExtra(style StylesheetPtr) c.Int - -//go:linkname AllocateExtraCtxt C.xsltAllocateExtraCtxt -func AllocateExtraCtxt(ctxt TransformContextPtr) c.Int - -/* - * Extra functions for Result Value Trees - */ -//go:linkname CreateRVT C.xsltCreateRVT -func CreateRVT(ctxt TransformContextPtr) libxml2.DocPtr - -//go:linkname RegisterTmpRVT C.xsltRegisterTmpRVT -func RegisterTmpRVT(ctxt TransformContextPtr, RVT libxml2.DocPtr) c.Int - -//go:linkname RegisterLocalRVT C.xsltRegisterLocalRVT -func RegisterLocalRVT(ctxt TransformContextPtr, RVT libxml2.DocPtr) c.Int - -//go:linkname RegisterPersistRVT C.xsltRegisterPersistRVT -func RegisterPersistRVT(ctxt TransformContextPtr, RVT libxml2.DocPtr) c.Int - -//go:linkname ExtensionInstructionResultRegister C.xsltExtensionInstructionResultRegister -func ExtensionInstructionResultRegister(ctxt TransformContextPtr, obj libxml2.XPathObjectPtr) c.Int - -//go:linkname ExtensionInstructionResultFinalize C.xsltExtensionInstructionResultFinalize -func ExtensionInstructionResultFinalize(ctxt TransformContextPtr) c.Int - -//go:linkname FlagRVTs C.xsltFlagRVTs -func FlagRVTs(ctxt TransformContextPtr, obj libxml2.XPathObjectPtr, val c.Int) c.Int - -//go:linkname FreeRVTs C.xsltFreeRVTs -func FreeRVTs(ctxt TransformContextPtr) - -//go:linkname ReleaseRVT C.xsltReleaseRVT -func ReleaseRVT(ctxt TransformContextPtr, RVT libxml2.DocPtr) - -/* - * Extra functions for Attribute Value Templates - */ -//go:linkname CompileAttr C.xsltCompileAttr -func CompileAttr(style StylesheetPtr, attr libxml2.AttrPtr) - -//go:linkname EvalAVT C.xsltEvalAVT -func EvalAVT(ctxt TransformContextPtr, avt c.Pointer, node libxml2.NodePtr) *libxml2.Char - -//go:linkname FreeAVTList C.xsltFreeAVTList -func FreeAVTList(avt c.Pointer) - -/* - * Extra function for successful xsltCleanupGlobals / xsltInit sequence. - */ -//go:linkname Uninit C.xsltUninit -func Uninit() - -/************************************************************************ - * * - * Transformation-time functions for *internal* use only * - * * - ************************************************************************/ -//go:linkname InitCtxtKey C.xsltInitCtxtKey -func InitCtxtKey(ctxt TransformContextPtr, doc DocumentPtr, keyd KeyDefPtr) c.Int - -//go:linkname InitAllDocKeys C.xsltInitAllDocKeys -func InitAllDocKeys(ctxt TransformContextPtr) c.Int diff --git a/libxslt/xsltconfig.go b/libxslt/xsltconfig.go deleted file mode 100644 index c617d020..00000000 --- a/libxslt/xsltconfig.go +++ /dev/null @@ -1,8 +0,0 @@ -package libxslt - -import _ "unsafe" - -const LIBXSLT_DOTTED_VERSION = "1.1.42" -const LIBXSLT_VERSION = 10142 -const LIBXSLT_VERSION_STRING = "10142" -const LIBXSLT_VERSION_EXTRA = "" diff --git a/libxslt/xsltexports.go b/libxslt/xsltexports.go deleted file mode 100644 index f830fa57..00000000 --- a/libxslt/xsltexports.go +++ /dev/null @@ -1,3 +0,0 @@ -package libxslt - -import _ "unsafe" diff --git a/libxslt/xsltlocale.go b/libxslt/xsltlocale.go deleted file mode 100644 index 22186200..00000000 --- a/libxslt/xsltlocale.go +++ /dev/null @@ -1,25 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -//go:linkname NewLocale C.xsltNewLocale -func NewLocale(langName *libxml2.Char, lowerFirst c.Int) c.Pointer - -//go:linkname FreeLocale C.xsltFreeLocale -func FreeLocale(locale c.Pointer) - -//go:linkname Strxfrm C.xsltStrxfrm -func Strxfrm(locale c.Pointer, string *libxml2.Char) *libxml2.Char - -//go:linkname FreeLocales C.xsltFreeLocales -func FreeLocales() - -type Locale c.Pointer -type LocaleChar libxml2.Char - -//go:linkname LocaleStrcmp C.xsltLocaleStrcmp -func LocaleStrcmp(locale c.Pointer, str1 *libxml2.Char, str2 *libxml2.Char) c.Int diff --git a/libxslt/xsltutils.go b/libxslt/xsltutils.go deleted file mode 100644 index b51f1528..00000000 --- a/libxslt/xsltutils.go +++ /dev/null @@ -1,158 +0,0 @@ -package libxslt - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/llpkg/libxml2" - _ "unsafe" -) - -/* - * Our own version of namespaced attributes lookup. - */ -//go:linkname GetNsProp C.xsltGetNsProp -func GetNsProp(node libxml2.NodePtr, name *libxml2.Char, nameSpace *libxml2.Char) *libxml2.Char - -//go:linkname GetCNsProp C.xsltGetCNsProp -func GetCNsProp(style StylesheetPtr, node libxml2.NodePtr, name *libxml2.Char, nameSpace *libxml2.Char) *libxml2.Char - -//go:linkname GetUTF8Char C.xsltGetUTF8Char -func GetUTF8Char(utf *c.Char, len *c.Int) c.Int - -type DebugTraceCodes c.Int - -const ( - TRACE_ALL DebugTraceCodes = -1 - TRACE_NONE DebugTraceCodes = 0 - TRACE_COPY_TEXT DebugTraceCodes = 1 - TRACE_PROCESS_NODE DebugTraceCodes = 2 - TRACE_APPLY_TEMPLATE DebugTraceCodes = 4 - TRACE_COPY DebugTraceCodes = 8 - TRACE_COMMENT DebugTraceCodes = 16 - TRACE_PI DebugTraceCodes = 32 - TRACE_COPY_OF DebugTraceCodes = 64 - TRACE_VALUE_OF DebugTraceCodes = 128 - TRACE_CALL_TEMPLATE DebugTraceCodes = 256 - TRACE_APPLY_TEMPLATES DebugTraceCodes = 512 - TRACE_CHOOSE DebugTraceCodes = 1024 - TRACE_IF DebugTraceCodes = 2048 - TRACE_FOR_EACH DebugTraceCodes = 4096 - TRACE_STRIP_SPACES DebugTraceCodes = 8192 - TRACE_TEMPLATES DebugTraceCodes = 16384 - TRACE_KEYS DebugTraceCodes = 32768 - TRACE_VARIABLES DebugTraceCodes = 65536 -) - -// llgo:link DebugTraceCodes.DebugSetDefaultTrace C.xsltDebugSetDefaultTrace -func (recv_ DebugTraceCodes) DebugSetDefaultTrace() { -} - -//go:linkname DebugGetDefaultTrace C.xsltDebugGetDefaultTrace -func DebugGetDefaultTrace() DebugTraceCodes - -//go:linkname PrintErrorContext C.xsltPrintErrorContext -func PrintErrorContext(ctxt TransformContextPtr, style StylesheetPtr, node libxml2.NodePtr) - -//go:linkname Message C.xsltMessage -func Message(ctxt TransformContextPtr, node libxml2.NodePtr, inst libxml2.NodePtr) - -//go:linkname SetGenericErrorFunc C.xsltSetGenericErrorFunc -func SetGenericErrorFunc(ctx c.Pointer, handler libxml2.GenericErrorFunc) - -//go:linkname SetGenericDebugFunc C.xsltSetGenericDebugFunc -func SetGenericDebugFunc(ctx c.Pointer, handler libxml2.GenericErrorFunc) - -//go:linkname SetTransformErrorFunc C.xsltSetTransformErrorFunc -func SetTransformErrorFunc(ctxt TransformContextPtr, ctx c.Pointer, handler libxml2.GenericErrorFunc) - -//go:linkname TransformError C.xsltTransformError -func TransformError(ctxt TransformContextPtr, style StylesheetPtr, node libxml2.NodePtr, msg *c.Char, __llgo_va_list ...interface{}) - -//go:linkname SetCtxtParseOptions C.xsltSetCtxtParseOptions -func SetCtxtParseOptions(ctxt TransformContextPtr, options c.Int) c.Int - -/* - * Sorting. - */ -//go:linkname DocumentSortFunction C.xsltDocumentSortFunction -func DocumentSortFunction(list libxml2.NodeSetPtr) - -//go:linkname SetSortFunc C.xsltSetSortFunc -func SetSortFunc(handler SortFunc) - -//go:linkname SetCtxtSortFunc C.xsltSetCtxtSortFunc -func SetCtxtSortFunc(ctxt TransformContextPtr, handler SortFunc) - -//go:linkname DefaultSortFunction C.xsltDefaultSortFunction -func DefaultSortFunction(ctxt TransformContextPtr, sorts *libxml2.NodePtr, nbsorts c.Int) - -//go:linkname DoSortFunction C.xsltDoSortFunction -func DoSortFunction(ctxt TransformContextPtr, sorts *libxml2.NodePtr, nbsorts c.Int) - -//go:linkname ComputeSortResult C.xsltComputeSortResult -func ComputeSortResult(ctxt TransformContextPtr, sort libxml2.NodePtr) *libxml2.XPathObjectPtr - -/* - * QNames handling. - */ -//go:linkname SplitQName C.xsltSplitQName -func SplitQName(dict libxml2.DictPtr, name *libxml2.Char, prefix **libxml2.Char) *libxml2.Char - -//go:linkname GetQNameURI C.xsltGetQNameURI -func GetQNameURI(node libxml2.NodePtr, name **libxml2.Char) *libxml2.Char - -//go:linkname GetQNameURI2 C.xsltGetQNameURI2 -func GetQNameURI2(style StylesheetPtr, node libxml2.NodePtr, name **libxml2.Char) *libxml2.Char - -/* - * Output, reuse libxml I/O buffers. - */ -//go:linkname SaveResultTo C.xsltSaveResultTo -func SaveResultTo(buf libxml2.OutputBufferPtr, result libxml2.DocPtr, style StylesheetPtr) c.Int - -//go:linkname SaveResultToFilename C.xsltSaveResultToFilename -func SaveResultToFilename(URI *c.Char, result libxml2.DocPtr, style StylesheetPtr, compression c.Int) c.Int - -//go:linkname SaveResultToFile C.xsltSaveResultToFile -func SaveResultToFile(file *c.FILE, result libxml2.DocPtr, style StylesheetPtr) c.Int - -//go:linkname SaveResultToFd C.xsltSaveResultToFd -func SaveResultToFd(fd c.Int, result libxml2.DocPtr, style StylesheetPtr) c.Int - -//go:linkname SaveResultToString C.xsltSaveResultToString -func SaveResultToString(doc_txt_ptr **libxml2.Char, doc_txt_len *c.Int, result libxml2.DocPtr, style StylesheetPtr) c.Int - -/* - * XPath interface - */ -//go:linkname XPathCompile C.xsltXPathCompile -func XPathCompile(style StylesheetPtr, str *libxml2.Char) libxml2.XPathCompExprPtr - -//go:linkname XPathCompileFlags C.xsltXPathCompileFlags -func XPathCompileFlags(style StylesheetPtr, str *libxml2.Char, flags c.Int) libxml2.XPathCompExprPtr - -type DebugStatusCodes c.Int - -const ( - DEBUG_NONE DebugStatusCodes = 0 - DEBUG_INIT DebugStatusCodes = 1 - DEBUG_STEP DebugStatusCodes = 2 - DEBUG_STEPOUT DebugStatusCodes = 3 - DEBUG_NEXT DebugStatusCodes = 4 - DEBUG_STOP DebugStatusCodes = 5 - DEBUG_CONT DebugStatusCodes = 6 - DEBUG_RUN DebugStatusCodes = 7 - DEBUG_RUN_RESTART DebugStatusCodes = 8 - DEBUG_QUIT DebugStatusCodes = 9 -) - -// llgo:type C -type HandleDebuggerCallback func(libxml2.NodePtr, libxml2.NodePtr, TemplatePtr, TransformContextPtr) - -// llgo:type C -type AddCallCallback func(TemplatePtr, libxml2.NodePtr) c.Int - -// llgo:type C -type DropCallCallback func() - -//go:linkname GetDebuggerStatus C.xsltGetDebuggerStatus -func GetDebuggerStatus() c.Int diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index c3e8b3d3..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/Bigdata-shiyang/test/numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 096a39c3..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "libVersion": "1.26.4", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index 303742a9..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27200 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// -// Gives a new shape to an array without changing its data. -// -// Parameters -// ---------- -// a : array_like -// Array to be reshaped. -// newshape : int or tuple of ints -// The new shape should be compatible with the original shape. If -// an integer, then the result will be a 1-D array of that length. -// One shape dimension can be -1. In this case, the value is -// inferred from the length of the array and remaining dimensions. -// order : {'C', 'F', 'A'}, optional -// Read the elements of `a` using this index order, and place the -// elements into the reshaped array using this index order. 'C' -// means to read / write the elements using C-like index order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to read / write the -// elements using Fortran-like index order, with the first index -// changing fastest, and the last index changing slowest. Note that -// the 'C' and 'F' options take no account of the memory layout of -// the underlying array, and only refer to the order of indexing. -// 'A' means to read / write the elements in Fortran-like index -// order if `a` is Fortran *contiguous* in memory, C-like order -// otherwise. -// -// Returns -// ------- -// reshaped_array : ndarray -// This will be a new view object if possible; otherwise, it will -// be a copy. Note there is no guarantee of the *memory layout* (C- or -// Fortran- contiguous) of the returned array. -// -// See Also -// -------- -// ndarray.reshape : Equivalent method. -// -// Notes -// ----- -// It is not always possible to change the shape of an array without copying -// the data. -// -// The `order` keyword gives the index ordering both for *fetching* the values -// from `a`, and then *placing* the values into the output array. -// For example, let's say you have an array: -// -// >>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// Compute tensor dot product along specified axes. -// -// Given two tensors, `a` and `b`, and an array_like object containing -// two array_like objects, ``(a_axes, b_axes)``, sum the products of -// `a`'s and `b`'s elements (components) over the axes specified by -// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative -// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions -// of `a` and the first ``N`` dimensions of `b` are summed over. -// -// Parameters -// ---------- -// a, b : array_like -// Tensors to "dot". -// -// axes : int or (2,) array_like -// * integer_like -// If an int N, sum over the last N axes of `a` and the first N axes -// of `b` in order. The sizes of the corresponding axes must match. -// * (2,) array_like -// Or, a list of axes to be summed over, first sequence applying to `a`, -// second to `b`. Both elements array_like must be of the same length. -// -// Returns -// ------- -// output : ndarray -// The tensor dot product of the input. -// -// See Also -// -------- -// dot, einsum -// -// Notes -// ----- -// Three common use cases are: -// * ``axes = 0`` : tensor product :math:`a\otimes b` -// * ``axes = 1`` : tensor dot product :math:`a\cdot b` -// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` -// -// When `axes` is integer_like, the sequence for evaluation will be: first -// the -Nth axis in `a` and 0th axis in `b`, and the -1th axis in `a` and -// Nth axis in `b` last. -// -// When there is more than one axis to sum over - and they are not the last -// (first) axes of `a` (`b`) - the argument `axes` should consist of -// two sequences of the same length, with the first axis to sum over given -// first in both sequences, the second axis second, and so forth. -// -// The shape of the result consists of the non-contracted axes of the -// first tensor, followed by the non-contracted axes of the second. -// -// Examples -// -------- -// A "traditional" example: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, default_ *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 >= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : bool or ndarray of bool -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, less_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) -// array([ True, True, False]) -// -// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` -// on ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a >= b -// array([ True, True, False]) -// -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -//go:linkname Sign py.sign -func Sign(__llgo_va_list ...interface{}) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 > x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// -// See Also -// -------- -// greater_equal, less, less_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.greater([4,2],[2,2]) -// array([ True, False]) -// -// The ``>`` operator can be used as a shorthand for ``np.greater`` on -// ndarrays. -// -// >>> a = np.array([4, 2]) -// >>> b = np.array([2, 2]) -// >>> a > b -// array([ True, False]) -// -//go:linkname Greater py.greater -func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '`. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(__llgo_va_list ...interface{}) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Returns an array with axes transposed. -// -// For a 1-D array, this returns an unchanged view of the original array, as a -// transposed vector is simply the same vector. -// To convert a 1-D array into a 2-D column vector, an additional dimension -// must be added, e.g., ``np.atleast2d(a).T`` achieves this, as does -// ``a[:, np.newaxis]``. -// For a 2-D array, this is the standard matrix transpose. -// For an n-D array, if axes are given, their order indicates how the -// axes are permuted (see Examples). If axes are not provided, then -// ``transpose(a).shape == a.shape[::-1]``. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axes : tuple or list of ints, optional -// If specified, it must be a tuple or list which contains a permutation -// of [0,1,...,N-1] where N is the number of axes of `a`. The `i`'th axis -// of the returned array will correspond to the axis numbered ``axes[i]`` -// of the input. If not specified, defaults to ``range(a.ndim)[::-1]``, -// which reverses the order of the axes. -// -// Returns -// ------- -// p : ndarray -// `a` with its axes permuted. A view is returned whenever possible. -// -// See Also -// -------- -// ndarray.transpose : Equivalent method. -// moveaxis : Move axes of an array to new positions. -// argsort : Return the indices that would sort an array. -// -// Notes -// ----- -// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors -// when using the `axes` keyword argument. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(__llgo_va_list ...interface{}) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '`. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(x *py.Object, out *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object diff --git a/sqlite3/_demo/hello/hello.go b/sqlite3/_demo/hello/hello.go deleted file mode 100644 index ce551a65..00000000 --- a/sqlite3/_demo/hello/hello.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "github.com/goplus/llpkg/sqlite3" - - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/os" -) - -func main() { - os.Remove(c.Str("test.db")) - - var db *sqlite3.Sqlite3 - err := sqlite3.DoOpen(c.Str("test.db"), &db) - check(err, db, "sqlite: Open") - - err = db.Exec(c.Str("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)"), nil, nil, nil) - check(err, db, "sqlite: Exec CREATE TABLE") - - var stmt *sqlite3.Stmt - sql := "INSERT INTO users (id, name) VALUES (?, ?)" - err = db.DoPrepareV3(c.GoStringData(sql), c.Int(len(sql)), 0, &stmt, nil) - check(err, db, "sqlite: PrepareV3 INSERT") - - stmt.BindInt(1, 100) - stmt.BindText(2, c.Str("Hello World"), -1, nil) - - err = stmt.Step() - checkDone(err, db, "sqlite: Step INSERT 1") - - stmt.Reset() - stmt.BindInt(1, 200) - stmt.BindText(2, c.Str("This is llgo"), -1, nil) - - err = stmt.Step() - checkDone(err, db, "sqlite: Step INSERT 2") - - stmt.Close() - - sql = "SELECT * FROM users" - err = db.DoPrepareV3(c.GoStringData(sql), c.Int(len(sql)), 0, &stmt, nil) - check(err, db, "sqlite: PrepareV3 SELECT") - - for { - if err = stmt.Step(); err != sqlite3.ROW { - break - } - c.Printf(c.Str("==> id=%d, name=%s\n"), stmt.ColumnInt(0), stmt.ColumnText(1)) - } - checkDone(err, db, "sqlite: Step done") - - stmt.Close() - db.Close() -} - -func check(err c.Int, db *sqlite3.Sqlite3, at string) { - if err != sqlite3.OK { - c.Printf(c.Str("==> %s Error: (%d) %s\n"), c.AllocaCStr(at), err, db.Errmsg()) - c.Exit(1) - } -} - -func checkDone(err c.Int, db *sqlite3.Sqlite3, at string) { - if err != sqlite3.DONE { - check(err, db, at) - } -} diff --git a/sqlite3/go.mod b/sqlite3/go.mod deleted file mode 100644 index 0e3cdfa3..00000000 --- a/sqlite3/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/sqlite3 - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/sqlite3/go.sum b/sqlite3/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/sqlite3/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/sqlite3/llcppg.cfg b/sqlite3/llcppg.cfg deleted file mode 100644 index 1bc7beb3..00000000 --- a/sqlite3/llcppg.cfg +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "sqlite3", - "cflags": "$(pkg-config --cflags sqlite3)", - "libs": "$(pkg-config --libs sqlite3)", - "include": [ - "sqlite3ext.h", - "sqlite3.h" - ], - "trimPrefixes": ["sqlite3_","SQLITE_"], - "cplusplus": false, - "symMap":{ - "sqlite3_finalize":".Close", - "sqlite3_open":"DoOpen", - "sqlite3_open16":"DoOpen16", - "sqlite3_open_v2":"DoOpenV2", - "sqlite3_prepare":".DoPrepare", - "sqlite3_prepare16":".DoPrepare16", - "sqlite3_prepare16_v3":".DoPrepare16V3", - "sqlite3_prepare_v2":".DoPrepareV2", - "sqlite3_prepare_v3":".DoPrepareV3", - "sqlite3_prepare16_v2":".DoPrepare16V2" - } -} \ No newline at end of file diff --git a/sqlite3/llcppg.pub b/sqlite3/llcppg.pub deleted file mode 100644 index b34755ea..00000000 --- a/sqlite3/llcppg.pub +++ /dev/null @@ -1,46 +0,0 @@ -Fts5Context -Fts5ExtensionApi -Fts5PhraseIter -Fts5Tokenizer -fts5_api Fts5Api -fts5_extension_function Fts5ExtensionFunction -fts5_tokenizer Fts5Tokenizer__1 -fts5_tokenizer_v2 Fts5TokenizerV2 -sqlite3 Sqlite3 -sqlite3_api_routines ApiRoutines -sqlite3_backup Backup -sqlite3_blob Blob -sqlite3_callback Callback -sqlite3_context Context -sqlite3_destructor_type DestructorType -sqlite3_file File -sqlite3_filename Filename -sqlite3_index_constraint IndexConstraint -sqlite3_index_constraint_usage IndexConstraintUsage -sqlite3_index_info IndexInfo -sqlite3_index_orderby IndexOrderby -sqlite3_int64 Int64 -sqlite3_io_methods IoMethods -sqlite3_loadext_entry LoadextEntry -sqlite3_mem_methods MemMethods -sqlite3_module Module -sqlite3_mutex Mutex -sqlite3_mutex_methods MutexMethods -sqlite3_pcache Pcache -sqlite3_pcache_methods PcacheMethods -sqlite3_pcache_methods2 PcacheMethods2 -sqlite3_pcache_page PcachePage -sqlite3_rtree_dbl RtreeDbl -sqlite3_rtree_geometry RtreeGeometry -sqlite3_rtree_query_info RtreeQueryInfo -sqlite3_snapshot Snapshot -sqlite3_stmt Stmt -sqlite3_str Str -sqlite3_syscall_ptr SyscallPtr -sqlite3_uint64 Uint64 -sqlite3_value Value -sqlite3_vfs Vfs -sqlite3_vtab Vtab -sqlite3_vtab_cursor VtabCursor -sqlite_int64 SqliteInt64 -sqlite_uint64 SqliteUint64 \ No newline at end of file diff --git a/sqlite3/llpkg.cfg b/sqlite3/llpkg.cfg deleted file mode 100644 index 2c86d7f6..00000000 --- a/sqlite3/llpkg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "upstream": { - "package": { - "name": "sqlite3", - "version": "3.49.1" - } - } -} \ No newline at end of file diff --git a/sqlite3/sqlite3.go b/sqlite3/sqlite3.go deleted file mode 100644 index 59c9717d..00000000 --- a/sqlite3/sqlite3.go +++ /dev/null @@ -1,7935 +0,0 @@ -package sqlite3 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const VERSION = "3.49.1" -const VERSION_NUMBER = 3049001 -const SOURCE_ID = "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70" -const OK = 0 -const ERROR = 1 -const INTERNAL = 2 -const PERM = 3 -const ABORT = 4 -const BUSY = 5 -const LOCKED = 6 -const NOMEM = 7 -const READONLY = 8 -const INTERRUPT = 9 -const IOERR = 10 -const CORRUPT = 11 -const NOTFOUND = 12 -const FULL = 13 -const CANTOPEN = 14 -const PROTOCOL = 15 -const EMPTY = 16 -const SCHEMA = 17 -const TOOBIG = 18 -const CONSTRAINT = 19 -const MISMATCH = 20 -const MISUSE = 21 -const NOLFS = 22 -const AUTH = 23 -const FORMAT = 24 -const RANGE = 25 -const NOTADB = 26 -const NOTICE = 27 -const WARNING = 28 -const ROW = 100 -const DONE = 101 -const OPEN_READONLY = 0x00000001 -const OPEN_READWRITE = 0x00000002 -const OPEN_CREATE = 0x00000004 -const OPEN_DELETEONCLOSE = 0x00000008 -const OPEN_EXCLUSIVE = 0x00000010 -const OPEN_AUTOPROXY = 0x00000020 -const OPEN_URI = 0x00000040 -const OPEN_MEMORY = 0x00000080 -const OPEN_MAIN_DB = 0x00000100 -const OPEN_TEMP_DB = 0x00000200 -const OPEN_TRANSIENT_DB = 0x00000400 -const OPEN_MAIN_JOURNAL = 0x00000800 -const OPEN_TEMP_JOURNAL = 0x00001000 -const OPEN_SUBJOURNAL = 0x00002000 -const OPEN_SUPER_JOURNAL = 0x00004000 -const OPEN_NOMUTEX = 0x00008000 -const OPEN_FULLMUTEX = 0x00010000 -const OPEN_SHAREDCACHE = 0x00020000 -const OPEN_PRIVATECACHE = 0x00040000 -const OPEN_WAL = 0x00080000 -const OPEN_NOFOLLOW = 0x01000000 -const OPEN_EXRESCODE = 0x02000000 -const OPEN_MASTER_JOURNAL = 0x00004000 -const IOCAP_ATOMIC = 0x00000001 -const IOCAP_ATOMIC512 = 0x00000002 -const IOCAP_ATOMIC1K = 0x00000004 -const IOCAP_ATOMIC2K = 0x00000008 -const IOCAP_ATOMIC4K = 0x00000010 -const IOCAP_ATOMIC8K = 0x00000020 -const IOCAP_ATOMIC16K = 0x00000040 -const IOCAP_ATOMIC32K = 0x00000080 -const IOCAP_ATOMIC64K = 0x00000100 -const IOCAP_SAFE_APPEND = 0x00000200 -const IOCAP_SEQUENTIAL = 0x00000400 -const IOCAP_UNDELETABLE_WHEN_OPEN = 0x00000800 -const IOCAP_POWERSAFE_OVERWRITE = 0x00001000 -const IOCAP_IMMUTABLE = 0x00002000 -const IOCAP_BATCH_ATOMIC = 0x00004000 -const IOCAP_SUBPAGE_READ = 0x00008000 -const LOCK_NONE = 0 -const LOCK_SHARED = 1 -const LOCK_RESERVED = 2 -const LOCK_PENDING = 3 -const LOCK_EXCLUSIVE = 4 -const SYNC_NORMAL = 0x00002 -const SYNC_FULL = 0x00003 -const SYNC_DATAONLY = 0x00010 -const FCNTL_LOCKSTATE = 1 -const FCNTL_GET_LOCKPROXYFILE = 2 -const FCNTL_SET_LOCKPROXYFILE = 3 -const FCNTL_LAST_ERRNO = 4 -const FCNTL_SIZE_HINT = 5 -const FCNTL_CHUNK_SIZE = 6 -const FCNTL_FILE_POINTER = 7 -const FCNTL_SYNC_OMITTED = 8 -const FCNTL_WIN32_AV_RETRY = 9 -const FCNTL_PERSIST_WAL = 10 -const FCNTL_OVERWRITE = 11 -const FCNTL_VFSNAME = 12 -const FCNTL_POWERSAFE_OVERWRITE = 13 -const FCNTL_PRAGMA = 14 -const FCNTL_BUSYHANDLER = 15 -const FCNTL_TEMPFILENAME = 16 -const FCNTL_MMAP_SIZE = 18 -const FCNTL_TRACE = 19 -const FCNTL_HAS_MOVED = 20 -const FCNTL_SYNC = 21 -const FCNTL_COMMIT_PHASETWO = 22 -const FCNTL_WIN32_SET_HANDLE = 23 -const FCNTL_WAL_BLOCK = 24 -const FCNTL_ZIPVFS = 25 -const FCNTL_RBU = 26 -const FCNTL_VFS_POINTER = 27 -const FCNTL_JOURNAL_POINTER = 28 -const FCNTL_WIN32_GET_HANDLE = 29 -const FCNTL_PDB = 30 -const FCNTL_BEGIN_ATOMIC_WRITE = 31 -const FCNTL_COMMIT_ATOMIC_WRITE = 32 -const FCNTL_ROLLBACK_ATOMIC_WRITE = 33 -const FCNTL_LOCK_TIMEOUT = 34 -const FCNTL_DATA_VERSION = 35 -const FCNTL_SIZE_LIMIT = 36 -const FCNTL_CKPT_DONE = 37 -const FCNTL_RESERVE_BYTES = 38 -const FCNTL_CKPT_START = 39 -const FCNTL_EXTERNAL_READER = 40 -const FCNTL_CKSM_FILE = 41 -const FCNTL_RESET_CACHE = 42 -const FCNTL_NULL_IO = 43 -const ACCESS_EXISTS = 0 -const ACCESS_READWRITE = 1 -const ACCESS_READ = 2 -const SHM_UNLOCK = 1 -const SHM_LOCK = 2 -const SHM_SHARED = 4 -const SHM_EXCLUSIVE = 8 -const SHM_NLOCK = 8 -const CONFIG_SINGLETHREAD = 1 -const CONFIG_MULTITHREAD = 2 -const CONFIG_SERIALIZED = 3 -const CONFIG_MALLOC = 4 -const CONFIG_GETMALLOC = 5 -const CONFIG_SCRATCH = 6 -const CONFIG_PAGECACHE = 7 -const CONFIG_HEAP = 8 -const CONFIG_MEMSTATUS = 9 -const CONFIG_MUTEX = 10 -const CONFIG_GETMUTEX = 11 -const CONFIG_LOOKASIDE = 13 -const CONFIG_PCACHE = 14 -const CONFIG_GETPCACHE = 15 -const CONFIG_LOG = 16 -const CONFIG_URI = 17 -const CONFIG_PCACHE2 = 18 -const CONFIG_GETPCACHE2 = 19 -const CONFIG_COVERING_INDEX_SCAN = 20 -const CONFIG_SQLLOG = 21 -const CONFIG_MMAP_SIZE = 22 -const CONFIG_WIN32_HEAPSIZE = 23 -const CONFIG_PCACHE_HDRSZ = 24 -const CONFIG_PMASZ = 25 -const CONFIG_STMTJRNL_SPILL = 26 -const CONFIG_SMALL_MALLOC = 27 -const CONFIG_SORTERREF_SIZE = 28 -const CONFIG_MEMDB_MAXSIZE = 29 -const CONFIG_ROWID_IN_VIEW = 30 -const DBCONFIG_MAINDBNAME = 1000 -const DBCONFIG_LOOKASIDE = 1001 -const DBCONFIG_ENABLE_FKEY = 1002 -const DBCONFIG_ENABLE_TRIGGER = 1003 -const DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004 -const DBCONFIG_ENABLE_LOAD_EXTENSION = 1005 -const DBCONFIG_NO_CKPT_ON_CLOSE = 1006 -const DBCONFIG_ENABLE_QPSG = 1007 -const DBCONFIG_TRIGGER_EQP = 1008 -const DBCONFIG_RESET_DATABASE = 1009 -const DBCONFIG_DEFENSIVE = 1010 -const DBCONFIG_WRITABLE_SCHEMA = 1011 -const DBCONFIG_LEGACY_ALTER_TABLE = 1012 -const DBCONFIG_DQS_DML = 1013 -const DBCONFIG_DQS_DDL = 1014 -const DBCONFIG_ENABLE_VIEW = 1015 -const DBCONFIG_LEGACY_FILE_FORMAT = 1016 -const DBCONFIG_TRUSTED_SCHEMA = 1017 -const DBCONFIG_STMT_SCANSTATUS = 1018 -const DBCONFIG_REVERSE_SCANORDER = 1019 -const DBCONFIG_ENABLE_ATTACH_CREATE = 1020 -const DBCONFIG_ENABLE_ATTACH_WRITE = 1021 -const DBCONFIG_ENABLE_COMMENTS = 1022 -const DBCONFIG_MAX = 1022 -const DENY = 1 -const IGNORE = 2 -const CREATE_INDEX = 1 -const CREATE_TABLE = 2 -const CREATE_TEMP_INDEX = 3 -const CREATE_TEMP_TABLE = 4 -const CREATE_TEMP_TRIGGER = 5 -const CREATE_TEMP_VIEW = 6 -const CREATE_TRIGGER = 7 -const CREATE_VIEW = 8 -const DELETE = 9 -const DROP_INDEX = 10 -const DROP_TABLE = 11 -const DROP_TEMP_INDEX = 12 -const DROP_TEMP_TABLE = 13 -const DROP_TEMP_TRIGGER = 14 -const DROP_TEMP_VIEW = 15 -const DROP_TRIGGER = 16 -const DROP_VIEW = 17 -const INSERT = 18 -const PRAGMA = 19 -const READ = 20 -const SELECT = 21 -const TRANSACTION = 22 -const UPDATE = 23 -const ATTACH = 24 -const DETACH = 25 -const ALTER_TABLE = 26 -const REINDEX = 27 -const ANALYZE = 28 -const CREATE_VTABLE = 29 -const DROP_VTABLE = 30 -const FUNCTION = 31 -const SAVEPOINT = 32 -const COPY = 0 -const RECURSIVE = 33 -const TRACE_STMT = 0x01 -const TRACE_PROFILE = 0x02 -const TRACE_ROW = 0x04 -const TRACE_CLOSE = 0x08 -const LIMIT_LENGTH = 0 -const LIMIT_SQL_LENGTH = 1 -const LIMIT_COLUMN = 2 -const LIMIT_EXPR_DEPTH = 3 -const LIMIT_COMPOUND_SELECT = 4 -const LIMIT_VDBE_OP = 5 -const LIMIT_FUNCTION_ARG = 6 -const LIMIT_ATTACHED = 7 -const LIMIT_LIKE_PATTERN_LENGTH = 8 -const LIMIT_VARIABLE_NUMBER = 9 -const LIMIT_TRIGGER_DEPTH = 10 -const LIMIT_WORKER_THREADS = 11 -const PREPARE_PERSISTENT = 0x01 -const PREPARE_NORMALIZE = 0x02 -const PREPARE_NO_VTAB = 0x04 -const PREPARE_DONT_LOG = 0x10 -const INTEGER = 1 -const FLOAT = 2 -const BLOB = 4 -const NULL = 5 -const TEXT = 3 -const SQLITE3_TEXT = 3 -const UTF8 = 1 -const UTF16LE = 2 -const UTF16BE = 3 -const UTF16 = 4 -const ANY = 5 -const UTF16_ALIGNED = 8 -const DETERMINISTIC = 0x000000800 -const DIRECTONLY = 0x000080000 -const SUBTYPE = 0x000100000 -const INNOCUOUS = 0x000200000 -const RESULT_SUBTYPE = 0x001000000 -const SELFORDER1 = 0x002000000 -const WIN32_DATA_DIRECTORY_TYPE = 1 -const WIN32_TEMP_DIRECTORY_TYPE = 2 -const TXN_NONE = 0 -const TXN_READ = 1 -const TXN_WRITE = 2 -const INDEX_SCAN_UNIQUE = 0x00000001 -const INDEX_SCAN_HEX = 0x00000002 -const INDEX_CONSTRAINT_EQ = 2 -const INDEX_CONSTRAINT_GT = 4 -const INDEX_CONSTRAINT_LE = 8 -const INDEX_CONSTRAINT_LT = 16 -const INDEX_CONSTRAINT_GE = 32 -const INDEX_CONSTRAINT_MATCH = 64 -const INDEX_CONSTRAINT_LIKE = 65 -const INDEX_CONSTRAINT_GLOB = 66 -const INDEX_CONSTRAINT_REGEXP = 67 -const INDEX_CONSTRAINT_NE = 68 -const INDEX_CONSTRAINT_ISNOT = 69 -const INDEX_CONSTRAINT_ISNOTNULL = 70 -const INDEX_CONSTRAINT_ISNULL = 71 -const INDEX_CONSTRAINT_IS = 72 -const INDEX_CONSTRAINT_LIMIT = 73 -const INDEX_CONSTRAINT_OFFSET = 74 -const INDEX_CONSTRAINT_FUNCTION = 150 -const MUTEX_FAST = 0 -const MUTEX_RECURSIVE = 1 -const MUTEX_STATIC_MAIN = 2 -const MUTEX_STATIC_MEM = 3 -const MUTEX_STATIC_MEM2 = 4 -const MUTEX_STATIC_OPEN = 4 -const MUTEX_STATIC_PRNG = 5 -const MUTEX_STATIC_LRU = 6 -const MUTEX_STATIC_LRU2 = 7 -const MUTEX_STATIC_PMEM = 7 -const MUTEX_STATIC_APP1 = 8 -const MUTEX_STATIC_APP2 = 9 -const MUTEX_STATIC_APP3 = 10 -const MUTEX_STATIC_VFS1 = 11 -const MUTEX_STATIC_VFS2 = 12 -const MUTEX_STATIC_VFS3 = 13 -const MUTEX_STATIC_MASTER = 2 -const TESTCTRL_FIRST = 5 -const TESTCTRL_PRNG_SAVE = 5 -const TESTCTRL_PRNG_RESTORE = 6 -const TESTCTRL_PRNG_RESET = 7 -const TESTCTRL_FK_NO_ACTION = 7 -const TESTCTRL_BITVEC_TEST = 8 -const TESTCTRL_FAULT_INSTALL = 9 -const TESTCTRL_BENIGN_MALLOC_HOOKS = 10 -const TESTCTRL_PENDING_BYTE = 11 -const TESTCTRL_ASSERT = 12 -const TESTCTRL_ALWAYS = 13 -const TESTCTRL_RESERVE = 14 -const TESTCTRL_JSON_SELFCHECK = 14 -const TESTCTRL_OPTIMIZATIONS = 15 -const TESTCTRL_ISKEYWORD = 16 -const TESTCTRL_GETOPT = 16 -const TESTCTRL_SCRATCHMALLOC = 17 -const TESTCTRL_INTERNAL_FUNCTIONS = 17 -const TESTCTRL_LOCALTIME_FAULT = 18 -const TESTCTRL_EXPLAIN_STMT = 19 -const TESTCTRL_ONCE_RESET_THRESHOLD = 19 -const TESTCTRL_NEVER_CORRUPT = 20 -const TESTCTRL_VDBE_COVERAGE = 21 -const TESTCTRL_BYTEORDER = 22 -const TESTCTRL_ISINIT = 23 -const TESTCTRL_SORTER_MMAP = 24 -const TESTCTRL_IMPOSTER = 25 -const TESTCTRL_PARSER_COVERAGE = 26 -const TESTCTRL_RESULT_INTREAL = 27 -const TESTCTRL_PRNG_SEED = 28 -const TESTCTRL_EXTRA_SCHEMA_CHECKS = 29 -const TESTCTRL_SEEK_COUNT = 30 -const TESTCTRL_TRACEFLAGS = 31 -const TESTCTRL_TUNE = 32 -const TESTCTRL_LOGEST = 33 -const TESTCTRL_USELONGDOUBLE = 34 -const TESTCTRL_LAST = 34 -const STATUS_MEMORY_USED = 0 -const STATUS_PAGECACHE_USED = 1 -const STATUS_PAGECACHE_OVERFLOW = 2 -const STATUS_SCRATCH_USED = 3 -const STATUS_SCRATCH_OVERFLOW = 4 -const STATUS_MALLOC_SIZE = 5 -const STATUS_PARSER_STACK = 6 -const STATUS_PAGECACHE_SIZE = 7 -const STATUS_SCRATCH_SIZE = 8 -const STATUS_MALLOC_COUNT = 9 -const DBSTATUS_LOOKASIDE_USED = 0 -const DBSTATUS_CACHE_USED = 1 -const DBSTATUS_SCHEMA_USED = 2 -const DBSTATUS_STMT_USED = 3 -const DBSTATUS_LOOKASIDE_HIT = 4 -const DBSTATUS_LOOKASIDE_MISS_SIZE = 5 -const DBSTATUS_LOOKASIDE_MISS_FULL = 6 -const DBSTATUS_CACHE_HIT = 7 -const DBSTATUS_CACHE_MISS = 8 -const DBSTATUS_CACHE_WRITE = 9 -const DBSTATUS_DEFERRED_FKS = 10 -const DBSTATUS_CACHE_USED_SHARED = 11 -const DBSTATUS_CACHE_SPILL = 12 -const DBSTATUS_MAX = 12 -const STMTSTATUS_FULLSCAN_STEP = 1 -const STMTSTATUS_SORT = 2 -const STMTSTATUS_AUTOINDEX = 3 -const STMTSTATUS_VM_STEP = 4 -const STMTSTATUS_REPREPARE = 5 -const STMTSTATUS_RUN = 6 -const STMTSTATUS_FILTER_MISS = 7 -const STMTSTATUS_FILTER_HIT = 8 -const STMTSTATUS_MEMUSED = 99 -const CHECKPOINT_PASSIVE = 0 -const CHECKPOINT_FULL = 1 -const CHECKPOINT_RESTART = 2 -const CHECKPOINT_TRUNCATE = 3 -const VTAB_CONSTRAINT_SUPPORT = 1 -const VTAB_INNOCUOUS = 2 -const VTAB_DIRECTONLY = 3 -const VTAB_USES_ALL_SCHEMAS = 4 -const ROLLBACK = 1 -const FAIL = 3 -const REPLACE = 5 -const SCANSTAT_NLOOP = 0 -const SCANSTAT_NVISIT = 1 -const SCANSTAT_EST = 2 -const SCANSTAT_NAME = 3 -const SCANSTAT_EXPLAIN = 4 -const SCANSTAT_SELECTID = 5 -const SCANSTAT_PARENTID = 6 -const SCANSTAT_NCYCLE = 7 -const SCANSTAT_COMPLEX = 0x0001 -const SERIALIZE_NOCOPY = 0x001 -const DESERIALIZE_FREEONCLOSE = 1 -const DESERIALIZE_RESIZEABLE = 2 -const DESERIALIZE_READONLY = 4 -const NOT_WITHIN = 0 -const PARTLY_WITHIN = 1 -const FULLY_WITHIN = 2 -const FTS5_TOKENIZE_QUERY = 0x0001 -const FTS5_TOKENIZE_PREFIX = 0x0002 -const FTS5_TOKENIZE_DOCUMENT = 0x0004 -const FTS5_TOKENIZE_AUX = 0x0008 -const FTS5_TOKEN_COLOCATED = 0x0001 - -//go:linkname Libversion C.sqlite3_libversion -func Libversion() *c.Char - -//go:linkname Sourceid C.sqlite3_sourceid -func Sourceid() *c.Char - -//go:linkname LibversionNumber C.sqlite3_libversion_number -func LibversionNumber() c.Int - -/* -** CAPI3REF: Run-Time Library Compilation Options Diagnostics -** -** ^The sqlite3_compileoption_used() function returns 0 or 1 -** indicating whether the specified option was defined at -** compile time. ^The SQLITE_ prefix may be omitted from the -** option name passed to sqlite3_compileoption_used(). -** -** ^The sqlite3_compileoption_get() function allows iterating -** over the list of options that were defined at compile time by -** returning the N-th compile time option string. ^If N is out of range, -** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ -** prefix is omitted from any strings returned by -** sqlite3_compileoption_get(). -** -** ^Support for the diagnostic functions sqlite3_compileoption_used() -** and sqlite3_compileoption_get() may be omitted by specifying the -** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. -** -** See also: SQL functions [sqlite_compileoption_used()] and -** [sqlite_compileoption_get()] and the [compile_options pragma]. - */ -//go:linkname CompileoptionUsed C.sqlite3_compileoption_used -func CompileoptionUsed(zOptName *c.Char) c.Int - -//go:linkname CompileoptionGet C.sqlite3_compileoption_get -func CompileoptionGet(N c.Int) *c.Char - -/* -** CAPI3REF: Test To See If The Library Is Threadsafe -** -** ^The sqlite3_threadsafe() function returns zero if and only if -** SQLite was compiled with mutexing code omitted due to the -** [SQLITE_THREADSAFE] compile-time option being set to 0. -** -** SQLite can be compiled with or without mutexes. When -** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes -** are enabled and SQLite is threadsafe. When the -** [SQLITE_THREADSAFE] macro is 0, -** the mutexes are omitted. Without the mutexes, it is not safe -** to use SQLite concurrently from more than one thread. -** -** Enabling mutexes incurs a measurable performance penalty. -** So if speed is of utmost importance, it makes sense to disable -** the mutexes. But for maximum safety, mutexes should be enabled. -** ^The default behavior is for mutexes to be enabled. -** -** This interface can be used by an application to make sure that the -** version of SQLite that it is linking against was compiled with -** the desired setting of the [SQLITE_THREADSAFE] macro. -** -** This interface only reports on the compile-time mutex setting -** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with -** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but -** can be fully or partially disabled using a call to [sqlite3_config()] -** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], -** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the -** sqlite3_threadsafe() function shows only the compile-time setting of -** thread safety, not any run-time changes to that setting made by -** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() -** is unchanged by calls to sqlite3_config().)^ -** -** See the [threading mode] documentation for additional information. - */ -//go:linkname Threadsafe C.sqlite3_threadsafe -func Threadsafe() c.Int - -type Sqlite3 struct { - Unused [8]uint8 -} -type SqliteInt64 c.LongLong -type SqliteUint64 c.UlongLong -type Int64 SqliteInt64 -type Uint64 SqliteUint64 - -/* -** CAPI3REF: Closing A Database Connection -** DESTRUCTOR: sqlite3 -** -** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors -** for the [sqlite3] object. -** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if -** the [sqlite3] object is successfully destroyed and all associated -** resources are deallocated. -** -** Ideally, applications should [sqlite3_finalize | finalize] all -** [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and -** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated -** with the [sqlite3] object prior to attempting to close the object. -** ^If the database connection is associated with unfinalized prepared -** statements, BLOB handlers, and/or unfinished sqlite3_backup objects then -** sqlite3_close() will leave the database connection open and return -** [SQLITE_BUSY]. ^If sqlite3_close_v2() is called with unfinalized prepared -** statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups, -** it returns [SQLITE_OK] regardless, but instead of deallocating the database -** connection immediately, it marks the database connection as an unusable -** "zombie" and makes arrangements to automatically deallocate the database -** connection after all prepared statements are finalized, all BLOB handles -** are closed, and all backups have finished. The sqlite3_close_v2() interface -** is intended for use with host languages that are garbage collected, and -** where the order in which destructors are called is arbitrary. -** -** ^If an [sqlite3] object is destroyed while a transaction is open, -** the transaction is automatically rolled back. -** -** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] -** must be either a NULL -** pointer or an [sqlite3] object pointer obtained -** from [sqlite3_open()], [sqlite3_open16()], or -** [sqlite3_open_v2()], and not previously closed. -** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer -** argument is a harmless no-op. - */ -// llgo:link (*Sqlite3).Close C.sqlite3_close -func (recv_ *Sqlite3) Close() c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CloseV2 C.sqlite3_close_v2 -func (recv_ *Sqlite3) CloseV2() c.Int { - return 0 -} - -// llgo:type C -type Callback func(c.Pointer, c.Int, **c.Char, **c.Char) c.Int - -/* -** CAPI3REF: One-Step Query Execution Interface -** METHOD: sqlite3 -** -** The sqlite3_exec() interface is a convenience wrapper around -** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], -** that allows an application to run multiple statements of SQL -** without having to use a lot of C code. -** -** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, -** semicolon-separate SQL statements passed into its 2nd argument, -** in the context of the [database connection] passed in as its 1st -** argument. ^If the callback function of the 3rd argument to -** sqlite3_exec() is not NULL, then it is invoked for each result row -** coming out of the evaluated SQL statements. ^The 4th argument to -** sqlite3_exec() is relayed through to the 1st argument of each -** callback invocation. ^If the callback pointer to sqlite3_exec() -** is NULL, then no callback is ever invoked and result rows are -** ignored. -** -** ^If an error occurs while evaluating the SQL statements passed into -** sqlite3_exec(), then execution of the current statement stops and -** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() -** is not NULL then any error message is written into memory obtained -** from [sqlite3_malloc()] and passed back through the 5th parameter. -** To avoid memory leaks, the application should invoke [sqlite3_free()] -** on error message strings returned through the 5th parameter of -** sqlite3_exec() after the error message string is no longer needed. -** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors -** occur, then sqlite3_exec() sets the pointer in its 5th parameter to -** NULL before returning. -** -** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() -** routine returns SQLITE_ABORT without invoking the callback again and -** without running any subsequent SQL statements. -** -** ^The 2nd argument to the sqlite3_exec() callback function is the -** number of columns in the result. ^The 3rd argument to the sqlite3_exec() -** callback is an array of pointers to strings obtained as if from -** [sqlite3_column_text()], one for each column. ^If an element of a -** result row is NULL then the corresponding string pointer for the -** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the -** sqlite3_exec() callback is an array of pointers to strings where each -** entry represents the name of corresponding result column as obtained -** from [sqlite3_column_name()]. -** -** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer -** to an empty string, or a pointer that contains only whitespace and/or -** SQL comments, then no SQL statements are evaluated and the database -** is not changed. -** -** Restrictions: -** -**
    -**
  • The application must ensure that the 1st parameter to sqlite3_exec() -** is a valid and open [database connection]. -**
  • The application must not close the [database connection] specified by -** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. -**
  • The application must not modify the SQL statement text passed into -** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. -**
  • The application must not dereference the arrays or string pointers -** passed as the 3rd and 4th callback parameters after it returns. -**
- */ -// llgo:link (*Sqlite3).Exec C.sqlite3_exec -func (recv_ *Sqlite3) Exec(sql *c.Char, callback func(c.Pointer, c.Int, **c.Char, **c.Char) c.Int, __llgo_arg_2 c.Pointer, errmsg **c.Char) c.Int { - return 0 -} - -type File struct { - PMethods *IoMethods -} - -type IoMethods struct { - IVersion c.Int - XClose c.Pointer - XRead c.Pointer - XWrite c.Pointer - XTruncate c.Pointer - XSync c.Pointer - XFileSize c.Pointer - XLock c.Pointer - XUnlock c.Pointer - XCheckReservedLock c.Pointer - XFileControl c.Pointer - XSectorSize c.Pointer - XDeviceCharacteristics c.Pointer - XShmMap c.Pointer - XShmLock c.Pointer - XShmBarrier c.Pointer - XShmUnmap c.Pointer - XFetch c.Pointer - XUnfetch c.Pointer -} - -type Mutex struct { - Unused [8]uint8 -} - -type ApiRoutines struct { - AggregateContext c.Pointer - AggregateCount c.Pointer - BindBlob c.Pointer - BindDouble c.Pointer - BindInt c.Pointer - BindInt64 c.Pointer - BindNull c.Pointer - BindParameterCount c.Pointer - BindParameterIndex c.Pointer - BindParameterName c.Pointer - BindText c.Pointer - BindText16 c.Pointer - BindValue c.Pointer - BusyHandler c.Pointer - BusyTimeout c.Pointer - Changes c.Pointer - Close c.Pointer - CollationNeeded c.Pointer - CollationNeeded16 c.Pointer - ColumnBlob c.Pointer - ColumnBytes c.Pointer - ColumnBytes16 c.Pointer - ColumnCount c.Pointer - ColumnDatabaseName c.Pointer - ColumnDatabaseName16 c.Pointer - ColumnDecltype c.Pointer - ColumnDecltype16 c.Pointer - ColumnDouble c.Pointer - ColumnInt c.Pointer - ColumnInt64 c.Pointer - ColumnName c.Pointer - ColumnName16 c.Pointer - ColumnOriginName c.Pointer - ColumnOriginName16 c.Pointer - ColumnTableName c.Pointer - ColumnTableName16 c.Pointer - ColumnText c.Pointer - ColumnText16 c.Pointer - ColumnType c.Pointer - ColumnValue c.Pointer - CommitHook c.Pointer - Complete c.Pointer - Complete16 c.Pointer - CreateCollation c.Pointer - CreateCollation16 c.Pointer - CreateFunction c.Pointer - CreateFunction16 c.Pointer - CreateModule c.Pointer - DataCount c.Pointer - DbHandle c.Pointer - DeclareVtab c.Pointer - EnableSharedCache c.Pointer - Errcode c.Pointer - Errmsg c.Pointer - Errmsg16 c.Pointer - Exec c.Pointer - Expired c.Pointer - Finalize c.Pointer - Free c.Pointer - FreeTable c.Pointer - GetAutocommit c.Pointer - GetAuxdata c.Pointer - GetTable c.Pointer - GlobalRecover c.Pointer - Interruptx c.Pointer - LastInsertRowid c.Pointer - Libversion c.Pointer - LibversionNumber c.Pointer - Malloc c.Pointer - Mprintf c.Pointer - Open c.Pointer - Open16 c.Pointer - Prepare c.Pointer - Prepare16 c.Pointer - Profile c.Pointer - ProgressHandler c.Pointer - Realloc c.Pointer - Reset c.Pointer - ResultBlob c.Pointer - ResultDouble c.Pointer - ResultError c.Pointer - ResultError16 c.Pointer - ResultInt c.Pointer - ResultInt64 c.Pointer - ResultNull c.Pointer - ResultText c.Pointer - ResultText16 c.Pointer - ResultText16be c.Pointer - ResultText16le c.Pointer - ResultValue c.Pointer - RollbackHook c.Pointer - SetAuthorizer c.Pointer - SetAuxdata c.Pointer - Xsnprintf c.Pointer - Step c.Pointer - TableColumnMetadata c.Pointer - ThreadCleanup c.Pointer - TotalChanges c.Pointer - Trace c.Pointer - TransferBindings c.Pointer - UpdateHook c.Pointer - UserData c.Pointer - ValueBlob c.Pointer - ValueBytes c.Pointer - ValueBytes16 c.Pointer - ValueDouble c.Pointer - ValueInt c.Pointer - ValueInt64 c.Pointer - ValueNumericType c.Pointer - ValueText c.Pointer - ValueText16 c.Pointer - ValueText16be c.Pointer - ValueText16le c.Pointer - ValueType c.Pointer - Vmprintf c.Pointer - OverloadFunction c.Pointer - PrepareV2 c.Pointer - Prepare16V2 c.Pointer - ClearBindings c.Pointer - CreateModuleV2 c.Pointer - BindZeroblob c.Pointer - BlobBytes c.Pointer - BlobClose c.Pointer - BlobOpen c.Pointer - BlobRead c.Pointer - BlobWrite c.Pointer - CreateCollationV2 c.Pointer - FileControl c.Pointer - MemoryHighwater c.Pointer - MemoryUsed c.Pointer - MutexAlloc c.Pointer - MutexEnter c.Pointer - MutexFree c.Pointer - MutexLeave c.Pointer - MutexTry c.Pointer - OpenV2 c.Pointer - ReleaseMemory c.Pointer - ResultErrorNomem c.Pointer - ResultErrorToobig c.Pointer - Sleep c.Pointer - SoftHeapLimit c.Pointer - VfsFind c.Pointer - VfsRegister c.Pointer - VfsUnregister c.Pointer - Xthreadsafe c.Pointer - ResultZeroblob c.Pointer - ResultErrorCode c.Pointer - TestControl c.Pointer - Randomness c.Pointer - ContextDbHandle c.Pointer - ExtendedResultCodes c.Pointer - Limit c.Pointer - NextStmt c.Pointer - Sql c.Pointer - Status c.Pointer - BackupFinish c.Pointer - BackupInit c.Pointer - BackupPagecount c.Pointer - BackupRemaining c.Pointer - BackupStep c.Pointer - CompileoptionGet c.Pointer - CompileoptionUsed c.Pointer - CreateFunctionV2 c.Pointer - DbConfig c.Pointer - DbMutex c.Pointer - DbStatus c.Pointer - ExtendedErrcode c.Pointer - Log c.Pointer - SoftHeapLimit64 c.Pointer - Sourceid c.Pointer - StmtStatus c.Pointer - Strnicmp c.Pointer - UnlockNotify c.Pointer - WalAutocheckpoint c.Pointer - WalCheckpoint c.Pointer - WalHook c.Pointer - BlobReopen c.Pointer - VtabConfig c.Pointer - VtabOnConflict c.Pointer - CloseV2 c.Pointer - DbFilename c.Pointer - DbReadonly c.Pointer - DbReleaseMemory c.Pointer - Errstr c.Pointer - StmtBusy c.Pointer - StmtReadonly c.Pointer - Stricmp c.Pointer - UriBoolean c.Pointer - UriInt64 c.Pointer - UriParameter c.Pointer - Xvsnprintf c.Pointer - WalCheckpointV2 c.Pointer - AutoExtension c.Pointer - BindBlob64 c.Pointer - BindText64 c.Pointer - CancelAutoExtension c.Pointer - LoadExtension c.Pointer - Malloc64 c.Pointer - Msize c.Pointer - Realloc64 c.Pointer - ResetAutoExtension c.Pointer - ResultBlob64 c.Pointer - ResultText64 c.Pointer - Strglob c.Pointer - ValueDup c.Pointer - ValueFree c.Pointer - ResultZeroblob64 c.Pointer - BindZeroblob64 c.Pointer - ValueSubtype c.Pointer - ResultSubtype c.Pointer - Status64 c.Pointer - Strlike c.Pointer - DbCacheflush c.Pointer - SystemErrno c.Pointer - TraceV2 c.Pointer - ExpandedSql c.Pointer - SetLastInsertRowid c.Pointer - PrepareV3 c.Pointer - Prepare16V3 c.Pointer - BindPointer c.Pointer - ResultPointer c.Pointer - ValuePointer c.Pointer - VtabNochange c.Pointer - ValueNochange c.Pointer - VtabCollation c.Pointer - KeywordCount c.Pointer - KeywordName c.Pointer - KeywordCheck c.Pointer - StrNew c.Pointer - StrFinish c.Pointer - StrAppendf c.Pointer - StrVappendf c.Pointer - StrAppend c.Pointer - StrAppendall c.Pointer - StrAppendchar c.Pointer - StrReset c.Pointer - StrErrcode c.Pointer - StrLength c.Pointer - StrValue c.Pointer - CreateWindowFunction c.Pointer - NormalizedSql c.Pointer - StmtIsexplain c.Pointer - ValueFrombind c.Pointer - DropModules c.Pointer - HardHeapLimit64 c.Pointer - UriKey c.Pointer - FilenameDatabase c.Pointer - FilenameJournal c.Pointer - FilenameWal c.Pointer - CreateFilename c.Pointer - FreeFilename c.Pointer - DatabaseFileObject c.Pointer - TxnState c.Pointer - Changes64 c.Pointer - TotalChanges64 c.Pointer - AutovacuumPages c.Pointer - ErrorOffset c.Pointer - VtabRhsValue c.Pointer - VtabDistinct c.Pointer - VtabIn c.Pointer - VtabInFirst c.Pointer - VtabInNext c.Pointer - Deserialize c.Pointer - Serialize c.Pointer - DbName c.Pointer - ValueEncoding c.Pointer - IsInterrupted c.Pointer - StmtExplain c.Pointer - GetClientdata c.Pointer - SetClientdata c.Pointer -} -type Filename *c.Char - -type Vfs struct { - IVersion c.Int - SzOsFile c.Int - MxPathname c.Int - PNext *Vfs - ZName *c.Char - PAppData c.Pointer - XOpen c.Pointer - XDelete c.Pointer - XAccess c.Pointer - XFullPathname c.Pointer - XDlOpen c.Pointer - XDlError c.Pointer - XDlSym c.Pointer - XDlClose c.Pointer - XRandomness c.Pointer - XSleep c.Pointer - XCurrentTime c.Pointer - XGetLastError c.Pointer - XCurrentTimeInt64 c.Pointer - XSetSystemCall c.Pointer - XGetSystemCall c.Pointer - XNextSystemCall c.Pointer -} - -// llgo:type C -type SyscallPtr func() - -/* -** CAPI3REF: Initialize The SQLite Library -** -** ^The sqlite3_initialize() routine initializes the -** SQLite library. ^The sqlite3_shutdown() routine -** deallocates any resources that were allocated by sqlite3_initialize(). -** These routines are designed to aid in process initialization and -** shutdown on embedded systems. Workstation applications using -** SQLite normally do not need to invoke either of these routines. -** -** A call to sqlite3_initialize() is an "effective" call if it is -** the first time sqlite3_initialize() is invoked during the lifetime of -** the process, or if it is the first time sqlite3_initialize() is invoked -** following a call to sqlite3_shutdown(). ^(Only an effective call -** of sqlite3_initialize() does any initialization. All other calls -** are harmless no-ops.)^ -** -** A call to sqlite3_shutdown() is an "effective" call if it is the first -** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only -** an effective call to sqlite3_shutdown() does any deinitialization. -** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ -** -** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() -** is not. The sqlite3_shutdown() interface must only be called from a -** single thread. All open [database connections] must be closed and all -** other SQLite resources must be deallocated prior to invoking -** sqlite3_shutdown(). -** -** Among other things, ^sqlite3_initialize() will invoke -** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() -** will invoke sqlite3_os_end(). -** -** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. -** ^If for some reason, sqlite3_initialize() is unable to initialize -** the library (perhaps it is unable to allocate a needed resource such -** as a mutex) it returns an [error code] other than [SQLITE_OK]. -** -** ^The sqlite3_initialize() routine is called internally by many other -** SQLite interfaces so that an application usually does not need to -** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] -** calls sqlite3_initialize() so the SQLite library will be automatically -** initialized when [sqlite3_open()] is called if it has not be initialized -** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] -** compile-time option, then the automatic calls to sqlite3_initialize() -** are omitted and the application must call sqlite3_initialize() directly -** prior to using any other SQLite interface. For maximum portability, -** it is recommended that applications always invoke sqlite3_initialize() -** directly prior to using any other SQLite interface. Future releases -** of SQLite may require this. In other words, the behavior exhibited -** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the -** default behavior in some future release of SQLite. -** -** The sqlite3_os_init() routine does operating-system specific -** initialization of the SQLite library. The sqlite3_os_end() -** routine undoes the effect of sqlite3_os_init(). Typical tasks -** performed by these routines include allocation or deallocation -** of static resources, initialization of global variables, -** setting up a default [sqlite3_vfs] module, or setting up -** a default configuration using [sqlite3_config()]. -** -** The application should never invoke either sqlite3_os_init() -** or sqlite3_os_end() directly. The application should only invoke -** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() -** interface is called automatically by sqlite3_initialize() and -** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate -** implementations for sqlite3_os_init() and sqlite3_os_end() -** are built into SQLite when it is compiled for Unix, Windows, or OS/2. -** When [custom builds | built for other platforms] -** (using the [SQLITE_OS_OTHER=1] compile-time -** option) the application must supply a suitable implementation for -** sqlite3_os_init() and sqlite3_os_end(). An application-supplied -** implementation of sqlite3_os_init() or sqlite3_os_end() -** must return [SQLITE_OK] on success and some other [error code] upon -** failure. - */ -//go:linkname Initialize C.sqlite3_initialize -func Initialize() c.Int - -//go:linkname Shutdown C.sqlite3_shutdown -func Shutdown() c.Int - -//go:linkname OsInit C.sqlite3_os_init -func OsInit() c.Int - -//go:linkname OsEnd C.sqlite3_os_end -func OsEnd() c.Int - -/* -** CAPI3REF: Configuring The SQLite Library -** -** The sqlite3_config() interface is used to make global configuration -** changes to SQLite in order to tune SQLite to the specific needs of -** the application. The default configuration is recommended for most -** applications and so this routine is usually not necessary. It is -** provided to support rare applications with unusual needs. -** -** The sqlite3_config() interface is not threadsafe. The application -** must ensure that no other SQLite interfaces are invoked by other -** threads while sqlite3_config() is running. -** -** The first argument to sqlite3_config() is an integer -** [configuration option] that determines -** what property of SQLite is to be configured. Subsequent arguments -** vary depending on the [configuration option] -** in the first argument. -** -** For most configuration options, the sqlite3_config() interface -** may only be invoked prior to library initialization using -** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. -** The exceptional configuration options that may be invoked at any time -** are called "anytime configuration options". -** ^If sqlite3_config() is called after [sqlite3_initialize()] and before -** [sqlite3_shutdown()] with a first argument that is not an anytime -** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE. -** Note, however, that ^sqlite3_config() can be called as part of the -** implementation of an application-defined [sqlite3_os_init()]. -** -** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. -** ^If the option is unknown or SQLite is unable to set the option -** then this routine returns a non-zero [error code]. - */ -//go:linkname Config C.sqlite3_config -func Config(__llgo_arg_0 c.Int, __llgo_va_list ...interface{}) c.Int - -/* -** CAPI3REF: Configure database connections -** METHOD: sqlite3 -** -** The sqlite3_db_config() interface is used to make configuration -** changes to a [database connection]. The interface is similar to -** [sqlite3_config()] except that the changes apply to a single -** [database connection] (specified in the first argument). -** -** The second argument to sqlite3_db_config(D,V,...) is the -** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code -** that indicates what aspect of the [database connection] is being configured. -** Subsequent arguments vary depending on the configuration verb. -** -** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if -** the call is considered successful. - */ -//go:linkname DbConfig C.sqlite3_db_config -func DbConfig(__llgo_arg_0 *Sqlite3, op c.Int, __llgo_va_list ...interface{}) c.Int - -type MemMethods struct { - XMalloc c.Pointer - XFree c.Pointer - XRealloc c.Pointer - XSize c.Pointer - XRoundup c.Pointer - XInit c.Pointer - XShutdown c.Pointer - PAppData c.Pointer -} - -/* -** CAPI3REF: Enable Or Disable Extended Result Codes -** METHOD: sqlite3 -** -** ^The sqlite3_extended_result_codes() routine enables or disables the -** [extended result codes] feature of SQLite. ^The extended result -** codes are disabled by default for historical compatibility. - */ -// llgo:link (*Sqlite3).ExtendedResultCodes C.sqlite3_extended_result_codes -func (recv_ *Sqlite3) ExtendedResultCodes(onoff c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Last Insert Rowid -** METHOD: sqlite3 -** -** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) -** has a unique 64-bit signed -** integer key called the [ROWID | "rowid"]. ^The rowid is always available -** as an undeclared column named ROWID, OID, or _ROWID_ as long as those -** names are not also used by explicitly declared columns. ^If -** the table has a column of type [INTEGER PRIMARY KEY] then that column -** is another alias for the rowid. -** -** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of -** the most recent successful [INSERT] into a rowid table or [virtual table] -** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not -** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred -** on the database connection D, then sqlite3_last_insert_rowid(D) returns -** zero. -** -** As well as being set automatically as rows are inserted into database -** tables, the value returned by this function may be set explicitly by -** [sqlite3_set_last_insert_rowid()] -** -** Some virtual table implementations may INSERT rows into rowid tables as -** part of committing a transaction (e.g. to flush data accumulated in memory -** to disk). In this case subsequent calls to this function return the rowid -** associated with these internal INSERT operations, which leads to -** unintuitive results. Virtual table implementations that do write to rowid -** tables in this way can avoid this problem by restoring the original -** rowid value using [sqlite3_set_last_insert_rowid()] before returning -** control to the user. -** -** ^(If an [INSERT] occurs within a trigger then this routine will -** return the [rowid] of the inserted row as long as the trigger is -** running. Once the trigger program ends, the value returned -** by this routine reverts to what it was before the trigger was fired.)^ -** -** ^An [INSERT] that fails due to a constraint violation is not a -** successful [INSERT] and does not change the value returned by this -** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, -** and INSERT OR ABORT make no changes to the return value of this -** routine when their insertion fails. ^(When INSERT OR REPLACE -** encounters a constraint violation, it does not fail. The -** INSERT continues to completion after deleting rows that caused -** the constraint problem so INSERT OR REPLACE will always change -** the return value of this interface.)^ -** -** ^For the purposes of this routine, an [INSERT] is considered to -** be successful even if it is subsequently rolled back. -** -** This function is accessible to SQL statements via the -** [last_insert_rowid() SQL function]. -** -** If a separate thread performs a new [INSERT] on the same -** database connection while the [sqlite3_last_insert_rowid()] -** function is running and thus changes the last insert [rowid], -** then the value returned by [sqlite3_last_insert_rowid()] is -** unpredictable and might not equal either the old or the new -** last insert [rowid]. - */ -// llgo:link (*Sqlite3).LastInsertRowid C.sqlite3_last_insert_rowid -func (recv_ *Sqlite3) LastInsertRowid() Int64 { - return 0 -} - -/* -** CAPI3REF: Set the Last Insert Rowid value. -** METHOD: sqlite3 -** -** The sqlite3_set_last_insert_rowid(D, R) method allows the application to -** set the value returned by calling sqlite3_last_insert_rowid(D) to R -** without inserting a row into the database. - */ -// llgo:link (*Sqlite3).SetLastInsertRowid C.sqlite3_set_last_insert_rowid -func (recv_ *Sqlite3) SetLastInsertRowid(Int64) { -} - -/* -** CAPI3REF: Count The Number Of Rows Modified -** METHOD: sqlite3 -** -** ^These functions return the number of rows modified, inserted or -** deleted by the most recently completed INSERT, UPDATE or DELETE -** statement on the database connection specified by the only parameter. -** The two functions are identical except for the type of the return value -** and that if the number of rows modified by the most recent INSERT, UPDATE, -** or DELETE is greater than the maximum value supported by type "int", then -** the return value of sqlite3_changes() is undefined. ^Executing any other -** type of SQL statement does not modify the value returned by these functions. -** For the purposes of this interface, a CREATE TABLE AS SELECT statement -** does not count as an INSERT, UPDATE or DELETE statement and hence the rows -** added to the new table by the CREATE TABLE AS SELECT statement are not -** counted. -** -** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are -** considered - auxiliary changes caused by [CREATE TRIGGER | triggers], -** [foreign key actions] or [REPLACE] constraint resolution are not counted. -** -** Changes to a view that are intercepted by -** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value -** returned by sqlite3_changes() immediately after an INSERT, UPDATE or -** DELETE statement run on a view is always zero. Only changes made to real -** tables are counted. -** -** Things are more complicated if the sqlite3_changes() function is -** executed while a trigger program is running. This may happen if the -** program uses the [changes() SQL function], or if some other callback -** function invokes sqlite3_changes() directly. Essentially: -** -**
    -**
  • ^(Before entering a trigger program the value returned by -** sqlite3_changes() function is saved. After the trigger program -** has finished, the original value is restored.)^ -** -**
  • ^(Within a trigger program each INSERT, UPDATE and DELETE -** statement sets the value returned by sqlite3_changes() -** upon completion as normal. Of course, this value will not include -** any changes performed by sub-triggers, as the sqlite3_changes() -** value will be saved and restored after each sub-trigger has run.)^ -**
-** -** ^This means that if the changes() SQL function (or similar) is used -** by the first INSERT, UPDATE or DELETE statement within a trigger, it -** returns the value as set when the calling statement began executing. -** ^If it is used by the second or subsequent such statement within a trigger -** program, the value returned reflects the number of rows modified by the -** previous INSERT, UPDATE or DELETE statement within the same trigger. -** -** If a separate thread makes changes on the same database connection -** while [sqlite3_changes()] is running then the value returned -** is unpredictable and not meaningful. -** -** See also: -**
    -**
  • the [sqlite3_total_changes()] interface -**
  • the [count_changes pragma] -**
  • the [changes() SQL function] -**
  • the [data_version pragma] -**
- */ -// llgo:link (*Sqlite3).Changes C.sqlite3_changes -func (recv_ *Sqlite3) Changes() c.Int { - return 0 -} - -// llgo:link (*Sqlite3).Changes64 C.sqlite3_changes64 -func (recv_ *Sqlite3) Changes64() Int64 { - return 0 -} - -/* -** CAPI3REF: Total Number Of Rows Modified -** METHOD: sqlite3 -** -** ^These functions return the total number of rows inserted, modified or -** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed -** since the database connection was opened, including those executed as -** part of trigger programs. The two functions are identical except for the -** type of the return value and that if the number of rows modified by the -** connection exceeds the maximum value supported by type "int", then -** the return value of sqlite3_total_changes() is undefined. ^Executing -** any other type of SQL statement does not affect the value returned by -** sqlite3_total_changes(). -** -** ^Changes made as part of [foreign key actions] are included in the -** count, but those made as part of REPLACE constraint resolution are -** not. ^Changes to a view that are intercepted by INSTEAD OF triggers -** are not counted. -** -** The [sqlite3_total_changes(D)] interface only reports the number -** of rows that changed due to SQL statement run against database -** connection D. Any changes by other database connections are ignored. -** To detect changes against a database file from other database -** connections use the [PRAGMA data_version] command or the -** [SQLITE_FCNTL_DATA_VERSION] [file control]. -** -** If a separate thread makes changes on the same database connection -** while [sqlite3_total_changes()] is running then the value -** returned is unpredictable and not meaningful. -** -** See also: -**
    -**
  • the [sqlite3_changes()] interface -**
  • the [count_changes pragma] -**
  • the [changes() SQL function] -**
  • the [data_version pragma] -**
  • the [SQLITE_FCNTL_DATA_VERSION] [file control] -**
- */ -// llgo:link (*Sqlite3).TotalChanges C.sqlite3_total_changes -func (recv_ *Sqlite3) TotalChanges() c.Int { - return 0 -} - -// llgo:link (*Sqlite3).TotalChanges64 C.sqlite3_total_changes64 -func (recv_ *Sqlite3) TotalChanges64() Int64 { - return 0 -} - -/* -** CAPI3REF: Interrupt A Long-Running Query -** METHOD: sqlite3 -** -** ^This function causes any pending database operation to abort and -** return at its earliest opportunity. This routine is typically -** called in response to a user action such as pressing "Cancel" -** or Ctrl-C where the user wants a long query operation to halt -** immediately. -** -** ^It is safe to call this routine from a thread different from the -** thread that is currently running the database operation. But it -** is not safe to call this routine with a [database connection] that -** is closed or might close before sqlite3_interrupt() returns. -** -** ^If an SQL operation is very nearly finished at the time when -** sqlite3_interrupt() is called, then it might not have an opportunity -** to be interrupted and might continue to completion. -** -** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. -** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE -** that is inside an explicit transaction, then the entire transaction -** will be rolled back automatically. -** -** ^The sqlite3_interrupt(D) call is in effect until all currently running -** SQL statements on [database connection] D complete. ^Any new SQL statements -** that are started after the sqlite3_interrupt() call and before the -** running statement count reaches zero are interrupted as if they had been -** running prior to the sqlite3_interrupt() call. ^New SQL statements -** that are started after the running statement count reaches zero are -** not effected by the sqlite3_interrupt(). -** ^A call to sqlite3_interrupt(D) that occurs when there are no running -** SQL statements is a no-op and has no effect on SQL statements -** that are started after the sqlite3_interrupt() call returns. -** -** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether -** or not an interrupt is currently in effect for [database connection] D. -** It returns 1 if an interrupt is currently in effect, or 0 otherwise. - */ -// llgo:link (*Sqlite3).Interrupt C.sqlite3_interrupt -func (recv_ *Sqlite3) Interrupt() { -} - -// llgo:link (*Sqlite3).IsInterrupted C.sqlite3_is_interrupted -func (recv_ *Sqlite3) IsInterrupted() c.Int { - return 0 -} - -/* -** CAPI3REF: Determine If An SQL Statement Is Complete -** -** These routines are useful during command-line input to determine if the -** currently entered text seems to form a complete SQL statement or -** if additional input is needed before sending the text into -** SQLite for parsing. ^These routines return 1 if the input string -** appears to be a complete SQL statement. ^A statement is judged to be -** complete if it ends with a semicolon token and is not a prefix of a -** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within -** string literals or quoted identifier names or comments are not -** independent tokens (they are part of the token in which they are -** embedded) and thus do not count as a statement terminator. ^Whitespace -** and comments that follow the final semicolon are ignored. -** -** ^These routines return 0 if the statement is incomplete. ^If a -** memory allocation fails, then SQLITE_NOMEM is returned. -** -** ^These routines do not parse the SQL statements thus -** will not detect syntactically incorrect SQL. -** -** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior -** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked -** automatically by sqlite3_complete16(). If that initialization fails, -** then the return value from sqlite3_complete16() will be non-zero -** regardless of whether or not the input SQL is complete.)^ -** -** The input to [sqlite3_complete()] must be a zero-terminated -** UTF-8 string. -** -** The input to [sqlite3_complete16()] must be a zero-terminated -** UTF-16 string in native byte order. - */ -//go:linkname Complete C.sqlite3_complete -func Complete(sql *c.Char) c.Int - -//go:linkname Complete16 C.sqlite3_complete16 -func Complete16(sql c.Pointer) c.Int - -/* -** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors -** KEYWORDS: {busy-handler callback} {busy handler} -** METHOD: sqlite3 -** -** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X -** that might be invoked with argument P whenever -** an attempt is made to access a database table associated with -** [database connection] D when another thread -** or process has the table locked. -** The sqlite3_busy_handler() interface is used to implement -** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout]. -** -** ^If the busy callback is NULL, then [SQLITE_BUSY] -** is returned immediately upon encountering the lock. ^If the busy callback -** is not NULL, then the callback might be invoked with two arguments. -** -** ^The first argument to the busy handler is a copy of the void* pointer which -** is the third argument to sqlite3_busy_handler(). ^The second argument to -** the busy handler callback is the number of times that the busy handler has -** been invoked previously for the same locking event. ^If the -** busy callback returns 0, then no additional attempts are made to -** access the database and [SQLITE_BUSY] is returned -** to the application. -** ^If the callback returns non-zero, then another attempt -** is made to access the database and the cycle repeats. -** -** The presence of a busy handler does not guarantee that it will be invoked -** when there is lock contention. ^If SQLite determines that invoking the busy -** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] -** to the application instead of invoking the -** busy handler. -** Consider a scenario where one process is holding a read lock that -** it is trying to promote to a reserved lock and -** a second process is holding a reserved lock that it is trying -** to promote to an exclusive lock. The first process cannot proceed -** because it is blocked by the second and the second process cannot -** proceed because it is blocked by the first. If both processes -** invoke the busy handlers, neither will make any progress. Therefore, -** SQLite returns [SQLITE_BUSY] for the first process, hoping that this -** will induce the first process to release its read lock and allow -** the second process to proceed. -** -** ^The default busy callback is NULL. -** -** ^(There can only be a single busy handler defined for each -** [database connection]. Setting a new busy handler clears any -** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] -** or evaluating [PRAGMA busy_timeout=N] will change the -** busy handler and thus clear any previously set busy handler. -** -** The busy callback should not take any actions which modify the -** database connection that invoked the busy handler. In other words, -** the busy handler is not reentrant. Any such actions -** result in undefined behavior. -** -** A busy handler must not close the database connection -** or [prepared statement] that invoked the busy handler. - */ -// llgo:link (*Sqlite3).BusyHandler C.sqlite3_busy_handler -func (recv_ *Sqlite3) BusyHandler(func(c.Pointer, c.Int) c.Int, c.Pointer) c.Int { - return 0 -} - -/* -** CAPI3REF: Set A Busy Timeout -** METHOD: sqlite3 -** -** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps -** for a specified amount of time when a table is locked. ^The handler -** will sleep multiple times until at least "ms" milliseconds of sleeping -** have accumulated. ^After at least "ms" milliseconds of sleeping, -** the handler returns 0 which causes [sqlite3_step()] to return -** [SQLITE_BUSY]. -** -** ^Calling this routine with an argument less than or equal to zero -** turns off all busy handlers. -** -** ^(There can only be a single busy handler for a particular -** [database connection] at any given moment. If another busy handler -** was defined (using [sqlite3_busy_handler()]) prior to calling -** this routine, that other busy handler is cleared.)^ -** -** See also: [PRAGMA busy_timeout] - */ -// llgo:link (*Sqlite3).BusyTimeout C.sqlite3_busy_timeout -func (recv_ *Sqlite3) BusyTimeout(ms c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Convenience Routines For Running Queries -** METHOD: sqlite3 -** -** This is a legacy interface that is preserved for backwards compatibility. -** Use of this interface is not recommended. -** -** Definition: A result table is memory data structure created by the -** [sqlite3_get_table()] interface. A result table records the -** complete query results from one or more queries. -** -** The table conceptually has a number of rows and columns. But -** these numbers are not part of the result table itself. These -** numbers are obtained separately. Let N be the number of rows -** and M be the number of columns. -** -** A result table is an array of pointers to zero-terminated UTF-8 strings. -** There are (N+1)*M elements in the array. The first M pointers point -** to zero-terminated strings that contain the names of the columns. -** The remaining entries all point to query results. NULL values result -** in NULL pointers. All other values are in their UTF-8 zero-terminated -** string representation as returned by [sqlite3_column_text()]. -** -** A result table might consist of one or more memory allocations. -** It is not safe to pass a result table directly to [sqlite3_free()]. -** A result table should be deallocated using [sqlite3_free_table()]. -** -** ^(As an example of the result table format, suppose a query result -** is as follows: -** -**
-**        Name        | Age
-**        -----------------------
-**        Alice       | 43
-**        Bob         | 28
-**        Cindy       | 21
-** 
-** -** There are two columns (M==2) and three rows (N==3). Thus the -** result table has 8 entries. Suppose the result table is stored -** in an array named azResult. Then azResult holds this content: -** -**
-**        azResult[0] = "Name";
-**        azResult[1] = "Age";
-**        azResult[2] = "Alice";
-**        azResult[3] = "43";
-**        azResult[4] = "Bob";
-**        azResult[5] = "28";
-**        azResult[6] = "Cindy";
-**        azResult[7] = "21";
-** 
)^ -** -** ^The sqlite3_get_table() function evaluates one or more -** semicolon-separated SQL statements in the zero-terminated UTF-8 -** string of its 2nd parameter and returns a result table to the -** pointer given in its 3rd parameter. -** -** After the application has finished with the result from sqlite3_get_table(), -** it must pass the result table pointer to sqlite3_free_table() in order to -** release the memory that was malloced. Because of the way the -** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling -** function must not try to call [sqlite3_free()] directly. Only -** [sqlite3_free_table()] is able to release the memory properly and safely. -** -** The sqlite3_get_table() interface is implemented as a wrapper around -** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access -** to any internal data structures of SQLite. It uses only the public -** interface defined here. As a consequence, errors that occur in the -** wrapper layer outside of the internal [sqlite3_exec()] call are not -** reflected in subsequent calls to [sqlite3_errcode()] or -** [sqlite3_errmsg()]. - */ -// llgo:link (*Sqlite3).GetTable C.sqlite3_get_table -func (recv_ *Sqlite3) GetTable(zSql *c.Char, pazResult ***c.Char, pnRow *c.Int, pnColumn *c.Int, pzErrmsg **c.Char) c.Int { - return 0 -} - -//go:linkname FreeTable C.sqlite3_free_table -func FreeTable(result **c.Char) - -/* -** CAPI3REF: Formatted String Printing Functions -** -** These routines are work-alikes of the "printf()" family of functions -** from the standard C library. -** These routines understand most of the common formatting options from -** the standard library printf() -** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]). -** See the [built-in printf()] documentation for details. -** -** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their -** results into memory obtained from [sqlite3_malloc64()]. -** The strings returned by these two routines should be -** released by [sqlite3_free()]. ^Both routines return a -** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough -** memory to hold the resulting string. -** -** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from -** the standard C library. The result is written into the -** buffer supplied as the second parameter whose size is given by -** the first parameter. Note that the order of the -** first two parameters is reversed from snprintf().)^ This is an -** historical accident that cannot be fixed without breaking -** backwards compatibility. ^(Note also that sqlite3_snprintf() -** returns a pointer to its buffer instead of the number of -** characters actually written into the buffer.)^ We admit that -** the number of characters written would be a more useful return -** value but we cannot change the implementation of sqlite3_snprintf() -** now without breaking compatibility. -** -** ^As long as the buffer size is greater than zero, sqlite3_snprintf() -** guarantees that the buffer is always zero-terminated. ^The first -** parameter "n" is the total size of the buffer, including space for -** the zero terminator. So the longest string that can be completely -** written will be n-1 characters. -** -** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). -** -** See also: [built-in printf()], [printf() SQL function] - */ -//go:linkname Mprintf C.sqlite3_mprintf -func Mprintf(__llgo_arg_0 *c.Char, __llgo_va_list ...interface{}) *c.Char - -//go:linkname Vmprintf C.sqlite3_vmprintf -func Vmprintf(*c.Char, c.VaList) *c.Char - -//go:linkname Snprintf C.sqlite3_snprintf -func Snprintf(__llgo_arg_0 c.Int, __llgo_arg_1 *c.Char, __llgo_arg_2 *c.Char, __llgo_va_list ...interface{}) *c.Char - -//go:linkname Vsnprintf C.sqlite3_vsnprintf -func Vsnprintf(c.Int, *c.Char, *c.Char, c.VaList) *c.Char - -/* -** CAPI3REF: Memory Allocation Subsystem -** -** The SQLite core uses these three routines for all of its own -** internal memory allocation needs. "Core" in the previous sentence -** does not include operating-system specific [VFS] implementation. The -** Windows VFS uses native malloc() and free() for some operations. -** -** ^The sqlite3_malloc() routine returns a pointer to a block -** of memory at least N bytes in length, where N is the parameter. -** ^If sqlite3_malloc() is unable to obtain sufficient free -** memory, it returns a NULL pointer. ^If the parameter N to -** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns -** a NULL pointer. -** -** ^The sqlite3_malloc64(N) routine works just like -** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead -** of a signed 32-bit integer. -** -** ^Calling sqlite3_free() with a pointer previously returned -** by sqlite3_malloc() or sqlite3_realloc() releases that memory so -** that it might be reused. ^The sqlite3_free() routine is -** a no-op if is called with a NULL pointer. Passing a NULL pointer -** to sqlite3_free() is harmless. After being freed, memory -** should neither be read nor written. Even reading previously freed -** memory might result in a segmentation fault or other severe error. -** Memory corruption, a segmentation fault, or other severe error -** might result if sqlite3_free() is called with a non-NULL pointer that -** was not obtained from sqlite3_malloc() or sqlite3_realloc(). -** -** ^The sqlite3_realloc(X,N) interface attempts to resize a -** prior memory allocation X to be at least N bytes. -** ^If the X parameter to sqlite3_realloc(X,N) -** is a NULL pointer then its behavior is identical to calling -** sqlite3_malloc(N). -** ^If the N parameter to sqlite3_realloc(X,N) is zero or -** negative then the behavior is exactly the same as calling -** sqlite3_free(X). -** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation -** of at least N bytes in size or NULL if insufficient memory is available. -** ^If M is the size of the prior allocation, then min(N,M) bytes -** of the prior allocation are copied into the beginning of buffer returned -** by sqlite3_realloc(X,N) and the prior allocation is freed. -** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the -** prior allocation is not freed. -** -** ^The sqlite3_realloc64(X,N) interfaces works the same as -** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead -** of a 32-bit signed integer. -** -** ^If X is a memory allocation previously obtained from sqlite3_malloc(), -** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then -** sqlite3_msize(X) returns the size of that memory allocation in bytes. -** ^The value returned by sqlite3_msize(X) might be larger than the number -** of bytes requested when X was allocated. ^If X is a NULL pointer then -** sqlite3_msize(X) returns zero. If X points to something that is not -** the beginning of memory allocation, or if it points to a formerly -** valid memory allocation that has now been freed, then the behavior -** of sqlite3_msize(X) is undefined and possibly harmful. -** -** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(), -** sqlite3_malloc64(), and sqlite3_realloc64() -** is always aligned to at least an 8 byte boundary, or to a -** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time -** option is used. -** -** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] -** must be either NULL or else pointers obtained from a prior -** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have -** not yet been released. -** -** The application must not read or write any part of -** a block of memory after it has been released using -** [sqlite3_free()] or [sqlite3_realloc()]. - */ -//go:linkname Malloc C.sqlite3_malloc -func Malloc(c.Int) c.Pointer - -// llgo:link Uint64.Malloc64 C.sqlite3_malloc64 -func (recv_ Uint64) Malloc64() c.Pointer { - return nil -} - -//go:linkname Realloc C.sqlite3_realloc -func Realloc(c.Pointer, c.Int) c.Pointer - -//go:linkname Realloc64 C.sqlite3_realloc64 -func Realloc64(c.Pointer, Uint64) c.Pointer - -//go:linkname Free C.sqlite3_free -func Free(c.Pointer) - -//go:linkname Msize C.sqlite3_msize -func Msize(c.Pointer) Uint64 - -/* -** CAPI3REF: Memory Allocator Statistics -** -** SQLite provides these two interfaces for reporting on the status -** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] -** routines, which form the built-in memory allocation subsystem. -** -** ^The [sqlite3_memory_used()] routine returns the number of bytes -** of memory currently outstanding (malloced but not freed). -** ^The [sqlite3_memory_highwater()] routine returns the maximum -** value of [sqlite3_memory_used()] since the high-water mark -** was last reset. ^The values returned by [sqlite3_memory_used()] and -** [sqlite3_memory_highwater()] include any overhead -** added by SQLite in its implementation of [sqlite3_malloc()], -** but not overhead added by the any underlying system library -** routines that [sqlite3_malloc()] may call. -** -** ^The memory high-water mark is reset to the current value of -** [sqlite3_memory_used()] if and only if the parameter to -** [sqlite3_memory_highwater()] is true. ^The value returned -** by [sqlite3_memory_highwater(1)] is the high-water mark -** prior to the reset. - */ -//go:linkname MemoryUsed C.sqlite3_memory_used -func MemoryUsed() Int64 - -//go:linkname MemoryHighwater C.sqlite3_memory_highwater -func MemoryHighwater(resetFlag c.Int) Int64 - -/* -** CAPI3REF: Pseudo-Random Number Generator -** -** SQLite contains a high-quality pseudo-random number generator (PRNG) used to -** select random [ROWID | ROWIDs] when inserting new records into a table that -** already uses the largest possible [ROWID]. The PRNG is also used for -** the built-in random() and randomblob() SQL functions. This interface allows -** applications to access the same PRNG for other purposes. -** -** ^A call to this routine stores N bytes of randomness into buffer P. -** ^The P parameter can be a NULL pointer. -** -** ^If this routine has not been previously called or if the previous -** call had N less than one or a NULL pointer for P, then the PRNG is -** seeded using randomness obtained from the xRandomness method of -** the default [sqlite3_vfs] object. -** ^If the previous call to this routine had an N of 1 or more and a -** non-NULL P then the pseudo-randomness is generated -** internally and without recourse to the [sqlite3_vfs] xRandomness -** method. - */ -//go:linkname Randomness C.sqlite3_randomness -func Randomness(N c.Int, P c.Pointer) - -/* -** CAPI3REF: Compile-Time Authorization Callbacks -** METHOD: sqlite3 -** KEYWORDS: {authorizer callback} -** -** ^This routine registers an authorizer callback with a particular -** [database connection], supplied in the first argument. -** ^The authorizer callback is invoked as SQL statements are being compiled -** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], -** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], -** and [sqlite3_prepare16_v3()]. ^At various -** points during the compilation process, as logic is being created -** to perform various actions, the authorizer callback is invoked to -** see if those actions are allowed. ^The authorizer callback should -** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the -** specific action but allow the SQL statement to continue to be -** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be -** rejected with an error. ^If the authorizer callback returns -** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] -** then the [sqlite3_prepare_v2()] or equivalent call that triggered -** the authorizer will fail with an error message. -** -** When the callback returns [SQLITE_OK], that means the operation -** requested is ok. ^When the callback returns [SQLITE_DENY], the -** [sqlite3_prepare_v2()] or equivalent call that triggered the -** authorizer will fail with an error message explaining that -** access is denied. -** -** ^The first parameter to the authorizer callback is a copy of the third -** parameter to the sqlite3_set_authorizer() interface. ^The second parameter -** to the callback is an integer [SQLITE_COPY | action code] that specifies -** the particular action to be authorized. ^The third through sixth parameters -** to the callback are either NULL pointers or zero-terminated strings -** that contain additional details about the action to be authorized. -** Applications must always be prepared to encounter a NULL pointer in any -** of the third through the sixth parameters of the authorization callback. -** -** ^If the action code is [SQLITE_READ] -** and the callback returns [SQLITE_IGNORE] then the -** [prepared statement] statement is constructed to substitute -** a NULL value in place of the table column that would have -** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] -** return can be used to deny an untrusted user access to individual -** columns of a table. -** ^When a table is referenced by a [SELECT] but no column values are -** extracted from that table (for example in a query like -** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback -** is invoked once for that table with a column name that is an empty string. -** ^If the action code is [SQLITE_DELETE] and the callback returns -** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the -** [truncate optimization] is disabled and all rows are deleted individually. -** -** An authorizer is used when [sqlite3_prepare | preparing] -** SQL statements from an untrusted source, to ensure that the SQL statements -** do not try to access data they are not allowed to see, or that they do not -** try to execute malicious statements that damage the database. For -** example, an application may allow a user to enter arbitrary -** SQL queries for evaluation by a database. But the application does -** not want the user to be able to make arbitrary changes to the -** database. An authorizer could then be put in place while the -** user-entered SQL is being [sqlite3_prepare | prepared] that -** disallows everything except [SELECT] statements. -** -** Applications that need to process SQL from untrusted sources -** might also consider lowering resource limits using [sqlite3_limit()] -** and limiting database size using the [max_page_count] [PRAGMA] -** in addition to using an authorizer. -** -** ^(Only a single authorizer can be in place on a database connection -** at a time. Each call to sqlite3_set_authorizer overrides the -** previous call.)^ ^Disable the authorizer by installing a NULL callback. -** The authorizer is disabled by default. -** -** The authorizer callback must not do anything that will modify -** the database connection that invoked the authorizer callback. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the -** statement might be re-prepared during [sqlite3_step()] due to a -** schema change. Hence, the application should ensure that the -** correct authorizer callback remains in place during the [sqlite3_step()]. -** -** ^Note that the authorizer callback is invoked only during -** [sqlite3_prepare()] or its variants. Authorization is not -** performed during statement evaluation in [sqlite3_step()], unless -** as stated in the previous paragraph, sqlite3_step() invokes -** sqlite3_prepare_v2() to reprepare a statement after a schema change. - */ -// llgo:link (*Sqlite3).SetAuthorizer C.sqlite3_set_authorizer -func (recv_ *Sqlite3) SetAuthorizer(xAuth func(c.Pointer, c.Int, *c.Char, *c.Char, *c.Char, *c.Char) c.Int, pUserData c.Pointer) c.Int { - return 0 -} - -/* -** CAPI3REF: Deprecated Tracing And Profiling Functions -** DEPRECATED -** -** These routines are deprecated. Use the [sqlite3_trace_v2()] interface -** instead of the routines described here. -** -** These routines register callback functions that can be used for -** tracing and profiling the execution of SQL statements. -** -** ^The callback function registered by sqlite3_trace() is invoked at -** various times when an SQL statement is being run by [sqlite3_step()]. -** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the -** SQL statement text as the statement first begins executing. -** ^(Additional sqlite3_trace() callbacks might occur -** as each triggered subprogram is entered. The callbacks for triggers -** contain a UTF-8 SQL comment that identifies the trigger.)^ -** -** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit -** the length of [bound parameter] expansion in the output of sqlite3_trace(). -** -** ^The callback function registered by sqlite3_profile() is invoked -** as each SQL statement finishes. ^The profile callback contains -** the original statement text and an estimate of wall-clock time -** of how long that statement took to run. ^The profile callback -** time is in units of nanoseconds, however the current implementation -** is only capable of millisecond resolution so the six least significant -** digits in the time are meaningless. Future versions of SQLite -** might provide greater resolution on the profiler callback. Invoking -** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the -** profile callback. - */ -// llgo:link (*Sqlite3).Trace C.sqlite3_trace -func (recv_ *Sqlite3) Trace(xTrace func(c.Pointer, *c.Char), __llgo_arg_1 c.Pointer) c.Pointer { - return nil -} - -// llgo:link (*Sqlite3).Profile C.sqlite3_profile -func (recv_ *Sqlite3) Profile(xProfile func(c.Pointer, *c.Char, Uint64), __llgo_arg_1 c.Pointer) c.Pointer { - return nil -} - -/* -** CAPI3REF: SQL Trace Hook -** METHOD: sqlite3 -** -** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback -** function X against [database connection] D, using property mask M -** and context pointer P. ^If the X callback is -** NULL or if the M mask is zero, then tracing is disabled. The -** M argument should be the bitwise OR-ed combination of -** zero or more [SQLITE_TRACE] constants. -** -** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P) -** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or -** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each -** database connection may have at most one trace callback. -** -** ^The X callback is invoked whenever any of the events identified by -** mask M occur. ^The integer return value from the callback is currently -** ignored, though this may change in future releases. Callback -** implementations should return zero to ensure future compatibility. -** -** ^A trace callback is invoked with four arguments: callback(T,C,P,X). -** ^The T argument is one of the [SQLITE_TRACE] -** constants to indicate why the callback was invoked. -** ^The C argument is a copy of the context pointer. -** The P and X arguments are pointers whose meanings depend on T. -** -** The sqlite3_trace_v2() interface is intended to replace the legacy -** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which -** are deprecated. - */ -// llgo:link (*Sqlite3).TraceV2 C.sqlite3_trace_v2 -func (recv_ *Sqlite3) TraceV2(uMask c.Uint, xCallback func(c.Uint, c.Pointer, c.Pointer, c.Pointer) c.Int, pCtx c.Pointer) c.Int { - return 0 -} - -/* -** CAPI3REF: Query Progress Callbacks -** METHOD: sqlite3 -** -** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback -** function X to be invoked periodically during long running calls to -** [sqlite3_step()] and [sqlite3_prepare()] and similar for -** database connection D. An example use for this -** interface is to keep a GUI updated during a large query. -** -** ^The parameter P is passed through as the only parameter to the -** callback function X. ^The parameter N is the approximate number of -** [virtual machine instructions] that are evaluated between successive -** invocations of the callback X. ^If N is less than one then the progress -** handler is disabled. -** -** ^Only a single progress handler may be defined at one time per -** [database connection]; setting a new progress handler cancels the -** old one. ^Setting parameter X to NULL disables the progress handler. -** ^The progress handler is also disabled by setting N to a value less -** than 1. -** -** ^If the progress callback returns non-zero, the operation is -** interrupted. This feature can be used to implement a -** "Cancel" button on a GUI progress dialog box. -** -** The progress handler callback must not do anything that will modify -** the database connection that invoked the progress handler. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** The progress handler callback would originally only be invoked from the -** bytecode engine. It still might be invoked during [sqlite3_prepare()] -** and similar because those routines might force a reparse of the schema -** which involves running the bytecode engine. However, beginning with -** SQLite version 3.41.0, the progress handler callback might also be -** invoked directly from [sqlite3_prepare()] while analyzing and generating -** code for complex queries. - */ -// llgo:link (*Sqlite3).ProgressHandler C.sqlite3_progress_handler -func (recv_ *Sqlite3) ProgressHandler(c.Int, func(c.Pointer) c.Int, c.Pointer) { -} - -/* -** CAPI3REF: Opening A New Database Connection -** CONSTRUCTOR: sqlite3 -** -** ^These routines open an SQLite database file as specified by the -** filename argument. ^The filename argument is interpreted as UTF-8 for -** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte -** order for sqlite3_open16(). ^(A [database connection] handle is usually -** returned in *ppDb, even if an error occurs. The only exception is that -** if SQLite is unable to allocate memory to hold the [sqlite3] object, -** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] -** object.)^ ^(If the database is opened (and/or created) successfully, then -** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The -** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain -** an English language description of the error following a failure of any -** of the sqlite3_open() routines. -** -** ^The default encoding will be UTF-8 for databases created using -** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases -** created using sqlite3_open16() will be UTF-16 in the native byte order. -** -** Whether or not an error occurs when it is opened, resources -** associated with the [database connection] handle should be released by -** passing it to [sqlite3_close()] when it is no longer required. -** -** The sqlite3_open_v2() interface works like sqlite3_open() -** except that it accepts two additional parameters for additional control -** over the new database connection. ^(The flags parameter to -** sqlite3_open_v2() must include, at a minimum, one of the following -** three flag combinations:)^ -** -**
-** ^(
[SQLITE_OPEN_READONLY]
-**
The database is opened in read-only mode. If the database does -** not already exist, an error is returned.
)^ -** -** ^(
[SQLITE_OPEN_READWRITE]
-**
The database is opened for reading and writing if possible, or -** reading only if the file is write protected by the operating -** system. In either case the database must already exist, otherwise -** an error is returned. For historical reasons, if opening in -** read-write mode fails due to OS-level permissions, an attempt is -** made to open it in read-only mode. [sqlite3_db_readonly()] can be -** used to determine whether the database is actually -** read-write.
)^ -** -** ^(
[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
-**
The database is opened for reading and writing, and is created if -** it does not already exist. This is the behavior that is always used for -** sqlite3_open() and sqlite3_open16().
)^ -**
-** -** In addition to the required flags, the following optional flags are -** also supported: -** -**
-** ^(
[SQLITE_OPEN_URI]
-**
The filename can be interpreted as a URI if this flag is set.
)^ -** -** ^(
[SQLITE_OPEN_MEMORY]
-**
The database will be opened as an in-memory database. The database -** is named by the "filename" argument for the purposes of cache-sharing, -** if shared cache mode is enabled, but the "filename" is otherwise ignored. -**
)^ -** -** ^(
[SQLITE_OPEN_NOMUTEX]
-**
The new database connection will use the "multi-thread" -** [threading mode].)^ This means that separate threads are allowed -** to use SQLite at the same time, as long as each thread is using -** a different [database connection]. -** -** ^(
[SQLITE_OPEN_FULLMUTEX]
-**
The new database connection will use the "serialized" -** [threading mode].)^ This means the multiple threads can safely -** attempt to use the same database connection at the same time. -** (Mutexes will block any actual concurrency, but in this mode -** there is no harm in trying.) -** -** ^(
[SQLITE_OPEN_SHAREDCACHE]
-**
The database is opened [shared cache] enabled, overriding -** the default shared cache setting provided by -** [sqlite3_enable_shared_cache()].)^ -** The [use of shared cache mode is discouraged] and hence shared cache -** capabilities may be omitted from many builds of SQLite. In such cases, -** this option is a no-op. -** -** ^(
[SQLITE_OPEN_PRIVATECACHE]
-**
The database is opened [shared cache] disabled, overriding -** the default shared cache setting provided by -** [sqlite3_enable_shared_cache()].)^ -** -** [[OPEN_EXRESCODE]] ^(
[SQLITE_OPEN_EXRESCODE]
-**
The database connection comes up in "extended result code mode". -** In other words, the database behaves as if -** [sqlite3_extended_result_codes(db,1)] were called on the database -** connection as soon as the connection is created. In addition to setting -** the extended result code mode, this flag also causes [sqlite3_open_v2()] -** to return an extended result code.
-** -** [[OPEN_NOFOLLOW]] ^(
[SQLITE_OPEN_NOFOLLOW]
-**
The database filename is not allowed to contain a symbolic link
-**
)^ -** -** If the 3rd parameter to sqlite3_open_v2() is not one of the -** required combinations shown above optionally combined with other -** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] -** then the behavior is undefined. Historic versions of SQLite -** have silently ignored surplus bits in the flags parameter to -** sqlite3_open_v2(), however that behavior might not be carried through -** into future versions of SQLite and so applications should not rely -** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op -** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause -** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE -** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not -** by sqlite3_open_v2(). -** -** ^The fourth parameter to sqlite3_open_v2() is the name of the -** [sqlite3_vfs] object that defines the operating system interface that -** the new database connection should use. ^If the fourth parameter is -** a NULL pointer then the default [sqlite3_vfs] object is used. -** -** ^If the filename is ":memory:", then a private, temporary in-memory database -** is created for the connection. ^This in-memory database will vanish when -** the database connection is closed. Future versions of SQLite might -** make use of additional special filenames that begin with the ":" character. -** It is recommended that when a database filename actually does begin with -** a ":" character you should prefix the filename with a pathname such as -** "./" to avoid ambiguity. -** -** ^If the filename is an empty string, then a private, temporary -** on-disk database will be created. ^This private database will be -** automatically deleted as soon as the database connection is closed. -** -** [[URI filenames in sqlite3_open()]]

URI Filenames

-** -** ^If [URI filename] interpretation is enabled, and the filename argument -** begins with "file:", then the filename is interpreted as a URI. ^URI -** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is -** set in the third argument to sqlite3_open_v2(), or if it has -** been enabled globally using the [SQLITE_CONFIG_URI] option with the -** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. -** URI filename interpretation is turned off -** by default, but future releases of SQLite might enable URI filename -** interpretation by default. See "[URI filenames]" for additional -** information. -** -** URI filenames are parsed according to RFC 3986. ^If the URI contains an -** authority, then it must be either an empty string or the string -** "localhost". ^If the authority is not an empty string or "localhost", an -** error is returned to the caller. ^The fragment component of a URI, if -** present, is ignored. -** -** ^SQLite uses the path component of the URI as the name of the disk file -** which contains the database. ^If the path begins with a '/' character, -** then it is interpreted as an absolute path. ^If the path does not begin -** with a '/' (meaning that the authority section is omitted from the URI) -** then the path is interpreted as a relative path. -** ^(On windows, the first component of an absolute path -** is a drive specification (e.g. "C:").)^ -** -** [[core URI query parameters]] -** The query component of a URI may contain parameters that are interpreted -** either by SQLite itself, or by a [VFS | custom VFS implementation]. -** SQLite and its built-in [VFSes] interpret the -** following query parameters: -** -**
    -**
  • vfs: ^The "vfs" parameter may be used to specify the name of -** a VFS object that provides the operating system interface that should -** be used to access the database file on disk. ^If this option is set to -** an empty string the default VFS object is used. ^Specifying an unknown -** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is -** present, then the VFS specified by the option takes precedence over -** the value passed as the fourth parameter to sqlite3_open_v2(). -** -**
  • mode: ^(The mode parameter may be set to either "ro", "rw", -** "rwc", or "memory". Attempting to set it to any other value is -** an error)^. -** ^If "ro" is specified, then the database is opened for read-only -** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the -** third argument to sqlite3_open_v2(). ^If the mode option is set to -** "rw", then the database is opened for read-write (but not create) -** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had -** been set. ^Value "rwc" is equivalent to setting both -** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is -** set to "memory" then a pure [in-memory database] that never reads -** or writes from disk is used. ^It is an error to specify a value for -** the mode parameter that is less restrictive than that specified by -** the flags passed in the third parameter to sqlite3_open_v2(). -** -**
  • cache: ^The cache parameter may be set to either "shared" or -** "private". ^Setting it to "shared" is equivalent to setting the -** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to -** sqlite3_open_v2(). ^Setting the cache parameter to "private" is -** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. -** ^If sqlite3_open_v2() is used and the "cache" parameter is present in -** a URI filename, its value overrides any behavior requested by setting -** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. -** -**
  • psow: ^The psow parameter indicates whether or not the -** [powersafe overwrite] property does or does not apply to the -** storage media on which the database file resides. -** -**
  • nolock: ^The nolock parameter is a boolean query parameter -** which if set disables file locking in rollback journal modes. This -** is useful for accessing a database on a filesystem that does not -** support locking. Caution: Database corruption might result if two -** or more processes write to the same database and any one of those -** processes uses nolock=1. -** -**
  • immutable: ^The immutable parameter is a boolean query -** parameter that indicates that the database file is stored on -** read-only media. ^When immutable is set, SQLite assumes that the -** database file cannot be changed, even by a process with higher -** privilege, and so the database is opened read-only and all locking -** and change detection is disabled. Caution: Setting the immutable -** property on a database file that does in fact change can result -** in incorrect query results and/or [SQLITE_CORRUPT] errors. -** See also: [SQLITE_IOCAP_IMMUTABLE]. -** -**
-** -** ^Specifying an unknown parameter in the query component of a URI is not an -** error. Future versions of SQLite might understand additional query -** parameters. See "[query parameters with special meaning to SQLite]" for -** additional information. -** -** [[URI filename examples]]

URI filename examples

-** -** -**
URI filenames Results -**
file:data.db -** Open the file "data.db" in the current directory. -**
file:/home/fred/data.db
-** file:///home/fred/data.db
-** file://localhost/home/fred/data.db
-** Open the database file "/home/fred/data.db". -**
file://darkstar/home/fred/data.db -** An error. "darkstar" is not a recognized authority. -**
-** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db -** Windows only: Open the file "data.db" on fred's desktop on drive -** C:. Note that the %20 escaping in this example is not strictly -** necessary - space characters can be used literally -** in URI filenames. -**
file:data.db?mode=ro&cache=private -** Open file "data.db" in the current directory for read-only access. -** Regardless of whether or not shared-cache mode is enabled by -** default, use a private cache. -**
file:/home/fred/data.db?vfs=unix-dotfile -** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile" -** that uses dot-files in place of posix advisory locking. -**
file:data.db?mode=readonly -** An error. "readonly" is not a valid option for the "mode" parameter. -** Use "ro" instead: "file:data.db?mode=ro". -**
-** -** ^URI hexadecimal escape sequences (%HH) are supported within the path and -** query components of a URI. A hexadecimal escape sequence consists of a -** percent sign - "%" - followed by exactly two hexadecimal digits -** specifying an octet value. ^Before the path or query components of a -** URI filename are interpreted, they are encoded using UTF-8 and all -** hexadecimal escape sequences replaced by a single byte containing the -** corresponding octet. If this process generates an invalid UTF-8 encoding, -** the results are undefined. -** -** Note to Windows users: The encoding used for the filename argument -** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever -** codepage is currently defined. Filenames containing international -** characters must be converted to UTF-8 prior to passing them into -** sqlite3_open() or sqlite3_open_v2(). -** -** Note to Windows Runtime users: The temporary directory must be set -** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various -** features that require the use of temporary files may fail. -** -** See also: [sqlite3_temp_directory] - */ -//go:linkname DoOpen C.sqlite3_open -func DoOpen(filename *c.Char, ppDb **Sqlite3) c.Int - -//go:linkname DoOpen16 C.sqlite3_open16 -func DoOpen16(filename c.Pointer, ppDb **Sqlite3) c.Int - -//go:linkname DoOpenV2 C.sqlite3_open_v2 -func DoOpenV2(filename *c.Char, ppDb **Sqlite3, flags c.Int, zVfs *c.Char) c.Int - -/* -** CAPI3REF: Obtain Values For URI Parameters -** -** These are utility routines, useful to [VFS|custom VFS implementations], -** that check if a database file was a URI that contained a specific query -** parameter, and if so obtains the value of that query parameter. -** -** The first parameter to these interfaces (hereafter referred to -** as F) must be one of: -**
    -**
  • A database filename pointer created by the SQLite core and -** passed into the xOpen() method of a VFS implementation, or -**
  • A filename obtained from [sqlite3_db_filename()], or -**
  • A new filename constructed using [sqlite3_create_filename()]. -**
-** If the F parameter is not one of the above, then the behavior is -** undefined and probably undesirable. Older versions of SQLite were -** more tolerant of invalid F parameters than newer versions. -** -** If F is a suitable filename (as described in the previous paragraph) -** and if P is the name of the query parameter, then -** sqlite3_uri_parameter(F,P) returns the value of the P -** parameter if it exists or a NULL pointer if P does not appear as a -** query parameter on F. If P is a query parameter of F and it -** has no explicit value, then sqlite3_uri_parameter(F,P) returns -** a pointer to an empty string. -** -** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean -** parameter and returns true (1) or false (0) according to the value -** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the -** value of query parameter P is one of "yes", "true", or "on" in any -** case or if the value begins with a non-zero number. The -** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of -** query parameter P is one of "no", "false", or "off" in any case or -** if the value begins with a numeric zero. If P is not a query -** parameter on F or if the value of P does not match any of the -** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). -** -** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a -** 64-bit signed integer and returns that integer, or D if P does not -** exist. If the value of P is something other than an integer, then -** zero is returned. -** -** The sqlite3_uri_key(F,N) returns a pointer to the name (not -** the value) of the N-th query parameter for filename F, or a NULL -** pointer if N is less than zero or greater than the number of query -** parameters minus 1. The N value is zero-based so N should be 0 to obtain -** the name of the first query parameter, 1 for the second parameter, and -** so forth. -** -** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and -** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and -** is not a database file pathname pointer that the SQLite core passed -** into the xOpen VFS method, then the behavior of this routine is undefined -** and probably undesirable. -** -** Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F -** parameter can also be the name of a rollback journal file or WAL file -** in addition to the main database file. Prior to version 3.31.0, these -** routines would only work if F was the name of the main database file. -** When the F parameter is the name of the rollback journal or WAL file, -** it has access to all the same query parameters as were found on the -** main database file. -** -** See the [URI filename] documentation for additional information. - */ -//go:linkname UriParameter C.sqlite3_uri_parameter -func UriParameter(z Filename, zParam *c.Char) *c.Char - -//go:linkname UriBoolean C.sqlite3_uri_boolean -func UriBoolean(z Filename, zParam *c.Char, bDefault c.Int) c.Int - -//go:linkname UriInt64 C.sqlite3_uri_int64 -func UriInt64(Filename, *c.Char, Int64) Int64 - -//go:linkname UriKey C.sqlite3_uri_key -func UriKey(z Filename, N c.Int) *c.Char - -/* -** CAPI3REF: Translate filenames -** -** These routines are available to [VFS|custom VFS implementations] for -** translating filenames between the main database file, the journal file, -** and the WAL file. -** -** If F is the name of an sqlite database file, journal file, or WAL file -** passed by the SQLite core into the VFS, then sqlite3_filename_database(F) -** returns the name of the corresponding database file. -** -** If F is the name of an sqlite database file, journal file, or WAL file -** passed by the SQLite core into the VFS, or if F is a database filename -** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F) -** returns the name of the corresponding rollback journal file. -** -** If F is the name of an sqlite database file, journal file, or WAL file -** that was passed by the SQLite core into the VFS, or if F is a database -** filename obtained from [sqlite3_db_filename()], then -** sqlite3_filename_wal(F) returns the name of the corresponding -** WAL file. -** -** In all of the above, if F is not the name of a database, journal or WAL -** filename passed into the VFS from the SQLite core and F is not the -** return value from [sqlite3_db_filename()], then the result is -** undefined and is likely a memory access violation. - */ -//go:linkname FilenameDatabase C.sqlite3_filename_database -func FilenameDatabase(Filename) *c.Char - -//go:linkname FilenameJournal C.sqlite3_filename_journal -func FilenameJournal(Filename) *c.Char - -//go:linkname FilenameWal C.sqlite3_filename_wal -func FilenameWal(Filename) *c.Char - -/* -** CAPI3REF: Database File Corresponding To A Journal -** -** ^If X is the name of a rollback or WAL-mode journal file that is -** passed into the xOpen method of [sqlite3_vfs], then -** sqlite3_database_file_object(X) returns a pointer to the [sqlite3_file] -** object that represents the main database file. -** -** This routine is intended for use in custom [VFS] implementations -** only. It is not a general-purpose interface. -** The argument sqlite3_file_object(X) must be a filename pointer that -** has been passed into [sqlite3_vfs].xOpen method where the -** flags parameter to xOpen contains one of the bits -** [SQLITE_OPEN_MAIN_JOURNAL] or [SQLITE_OPEN_WAL]. Any other use -** of this routine results in undefined and probably undesirable -** behavior. - */ -//go:linkname DatabaseFileObject C.sqlite3_database_file_object -func DatabaseFileObject(*c.Char) *File - -/* -** CAPI3REF: Create and Destroy VFS Filenames -** -** These interfaces are provided for use by [VFS shim] implementations and -** are not useful outside of that context. -** -** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of -** database filename D with corresponding journal file J and WAL file W and -** with N URI parameters key/values pairs in the array P. The result from -** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that -** is safe to pass to routines like: -**
    -**
  • [sqlite3_uri_parameter()], -**
  • [sqlite3_uri_boolean()], -**
  • [sqlite3_uri_int64()], -**
  • [sqlite3_uri_key()], -**
  • [sqlite3_filename_database()], -**
  • [sqlite3_filename_journal()], or -**
  • [sqlite3_filename_wal()]. -**
-** If a memory allocation error occurs, sqlite3_create_filename() might -** return a NULL pointer. The memory obtained from sqlite3_create_filename(X) -** must be released by a corresponding call to sqlite3_free_filename(Y). -** -** The P parameter in sqlite3_create_filename(D,J,W,N,P) should be an array -** of 2*N pointers to strings. Each pair of pointers in this array corresponds -** to a key and value for a query parameter. The P parameter may be a NULL -** pointer if N is zero. None of the 2*N pointers in the P array may be -** NULL pointers and key pointers should not be empty strings. -** None of the D, J, or W parameters to sqlite3_create_filename(D,J,W,N,P) may -** be NULL pointers, though they can be empty strings. -** -** The sqlite3_free_filename(Y) routine releases a memory allocation -** previously obtained from sqlite3_create_filename(). Invoking -** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op. -** -** If the Y parameter to sqlite3_free_filename(Y) is anything other -** than a NULL pointer or a pointer previously acquired from -** sqlite3_create_filename(), then bad things such as heap -** corruption or segfaults may occur. The value Y should not be -** used again after sqlite3_free_filename(Y) has been called. This means -** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y, -** then the corresponding [sqlite3_module.xClose() method should also be -** invoked prior to calling sqlite3_free_filename(Y). - */ -//go:linkname CreateFilename C.sqlite3_create_filename -func CreateFilename(zDatabase *c.Char, zJournal *c.Char, zWal *c.Char, nParam c.Int, azParam **c.Char) Filename - -//go:linkname FreeFilename C.sqlite3_free_filename -func FreeFilename(Filename) - -/* -** CAPI3REF: Error Codes And Messages -** METHOD: sqlite3 -** -** ^If the most recent sqlite3_* API call associated with -** [database connection] D failed, then the sqlite3_errcode(D) interface -** returns the numeric [result code] or [extended result code] for that -** API call. -** ^The sqlite3_extended_errcode() -** interface is the same except that it always returns the -** [extended result code] even when extended result codes are -** disabled. -** -** The values returned by sqlite3_errcode() and/or -** sqlite3_extended_errcode() might change with each API call. -** Except, there are some interfaces that are guaranteed to never -** change the value of the error code. The error-code preserving -** interfaces include the following: -** -**
    -**
  • sqlite3_errcode() -**
  • sqlite3_extended_errcode() -**
  • sqlite3_errmsg() -**
  • sqlite3_errmsg16() -**
  • sqlite3_error_offset() -**
-** -** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language -** text that describes the error, as either UTF-8 or UTF-16 respectively, -** or NULL if no error message is available. -** (See how SQLite handles [invalid UTF] for exceptions to this rule.) -** ^(Memory to hold the error message string is managed internally. -** The application does not need to worry about freeing the result. -** However, the error string might be overwritten or deallocated by -** subsequent calls to other SQLite interface functions.)^ -** -** ^The sqlite3_errstr(E) interface returns the English-language text -** that describes the [result code] E, as UTF-8, or NULL if E is not an -** result code for which a text error message is available. -** ^(Memory to hold the error message string is managed internally -** and must not be freed by the application)^. -** -** ^If the most recent error references a specific token in the input -** SQL, the sqlite3_error_offset() interface returns the byte offset -** of the start of that token. ^The byte offset returned by -** sqlite3_error_offset() assumes that the input SQL is UTF8. -** ^If the most recent error does not reference a specific token in the input -** SQL, then the sqlite3_error_offset() function returns -1. -** -** When the serialized [threading mode] is in use, it might be the -** case that a second error occurs on a separate thread in between -** the time of the first error and the call to these interfaces. -** When that happens, the second error will be reported since these -** interfaces always report the most recent result. To avoid -** this, each thread can obtain exclusive use of the [database connection] D -** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning -** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after -** all calls to the interfaces listed here are completed. -** -** If an interface fails with SQLITE_MISUSE, that means the interface -** was invoked incorrectly by the application. In that case, the -** error code and message may or may not be set. - */ -// llgo:link (*Sqlite3).Errcode C.sqlite3_errcode -func (recv_ *Sqlite3) Errcode() c.Int { - return 0 -} - -// llgo:link (*Sqlite3).ExtendedErrcode C.sqlite3_extended_errcode -func (recv_ *Sqlite3) ExtendedErrcode() c.Int { - return 0 -} - -// llgo:link (*Sqlite3).Errmsg C.sqlite3_errmsg -func (recv_ *Sqlite3) Errmsg() *c.Char { - return nil -} - -// llgo:link (*Sqlite3).Errmsg16 C.sqlite3_errmsg16 -func (recv_ *Sqlite3) Errmsg16() c.Pointer { - return nil -} - -//go:linkname Errstr C.sqlite3_errstr -func Errstr(c.Int) *c.Char - -// llgo:link (*Sqlite3).ErrorOffset C.sqlite3_error_offset -func (recv_ *Sqlite3) ErrorOffset() c.Int { - return 0 -} - -type Stmt struct { - Unused [8]uint8 -} - -/* -** CAPI3REF: Run-time Limits -** METHOD: sqlite3 -** -** ^(This interface allows the size of various constructs to be limited -** on a connection by connection basis. The first parameter is the -** [database connection] whose limit is to be set or queried. The -** second parameter is one of the [limit categories] that define a -** class of constructs to be size limited. The third parameter is the -** new limit for that construct.)^ -** -** ^If the new limit is a negative number, the limit is unchanged. -** ^(For each limit category SQLITE_LIMIT_NAME there is a -** [limits | hard upper bound] -** set at compile-time by a C preprocessor macro called -** [limits | SQLITE_MAX_NAME]. -** (The "_LIMIT_" in the name is changed to "_MAX_".))^ -** ^Attempts to increase a limit above its hard upper bound are -** silently truncated to the hard upper bound. -** -** ^Regardless of whether or not the limit was changed, the -** [sqlite3_limit()] interface returns the prior value of the limit. -** ^Hence, to find the current value of a limit without changing it, -** simply invoke this interface with the third parameter set to -1. -** -** Run-time limits are intended for use in applications that manage -** both their own internal database and also databases that are controlled -** by untrusted external sources. An example application might be a -** web browser that has its own databases for storing history and -** separate databases controlled by JavaScript applications downloaded -** off the Internet. The internal databases can be given the -** large, default limits. Databases managed by external sources can -** be given much smaller limits designed to prevent a denial of service -** attack. Developers might also want to use the [sqlite3_set_authorizer()] -** interface to further control untrusted SQL. The size of the database -** created by an untrusted script can be contained using the -** [max_page_count] [PRAGMA]. -** -** New run-time limit categories may be added in future releases. - */ -// llgo:link (*Sqlite3).Limit C.sqlite3_limit -func (recv_ *Sqlite3) Limit(id c.Int, newVal c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Compiling An SQL Statement -** KEYWORDS: {SQL statement compiler} -** METHOD: sqlite3 -** CONSTRUCTOR: sqlite3_stmt -** -** To execute an SQL statement, it must first be compiled into a byte-code -** program using one of these routines. Or, in other words, these routines -** are constructors for the [prepared statement] object. -** -** The preferred routine to use is [sqlite3_prepare_v2()]. The -** [sqlite3_prepare()] interface is legacy and should be avoided. -** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used -** for special purposes. -** -** The use of the UTF-8 interfaces is preferred, as SQLite currently -** does all parsing using UTF-8. The UTF-16 interfaces are provided -** as a convenience. The UTF-16 interfaces work by converting the -** input text into UTF-8, then invoking the corresponding UTF-8 interface. -** -** The first argument, "db", is a [database connection] obtained from a -** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or -** [sqlite3_open16()]. The database connection must not have been closed. -** -** The second argument, "zSql", is the statement to be compiled, encoded -** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), -** and sqlite3_prepare_v3() -** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), -** and sqlite3_prepare16_v3() use UTF-16. -** -** ^If the nByte argument is negative, then zSql is read up to the -** first zero terminator. ^If nByte is positive, then it is the maximum -** number of bytes read from zSql. When nByte is positive, zSql is read -** up to the first zero terminator or until the nByte bytes have been read, -** whichever comes first. ^If nByte is zero, then no prepared -** statement is generated. -** If the caller knows that the supplied string is nul-terminated, then -** there is a small performance advantage to passing an nByte parameter that -** is the number of bytes in the input string including -** the nul-terminator. -** Note that nByte measure the length of the input in bytes, not -** characters, even for the UTF-16 interfaces. -** -** ^If pzTail is not NULL then *pzTail is made to point to the first byte -** past the end of the first SQL statement in zSql. These routines only -** compile the first statement in zSql, so *pzTail is left pointing to -** what remains uncompiled. -** -** ^*ppStmt is left pointing to a compiled [prepared statement] that can be -** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set -** to NULL. ^If the input text contains no SQL (if the input is an empty -** string or a comment) then *ppStmt is set to NULL. -** The calling procedure is responsible for deleting the compiled -** SQL statement using [sqlite3_finalize()] after it has finished with it. -** ppStmt may not be NULL. -** -** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; -** otherwise an [error code] is returned. -** -** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), -** and sqlite3_prepare16_v3() interfaces are recommended for all new programs. -** The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) -** are retained for backwards compatibility, but their use is discouraged. -** ^In the "vX" interfaces, the prepared statement -** that is returned (the [sqlite3_stmt] object) contains a copy of the -** original SQL text. This causes the [sqlite3_step()] interface to -** behave differently in three ways: -** -**
    -**
  1. -** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it -** always used to do, [sqlite3_step()] will automatically recompile the SQL -** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY] -** retries will occur before sqlite3_step() gives up and returns an error. -**
  2. -** -**
  3. -** ^When an error occurs, [sqlite3_step()] will return one of the detailed -** [error codes] or [extended error codes]. ^The legacy behavior was that -** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code -** and the application would have to make a second call to [sqlite3_reset()] -** in order to find the underlying cause of the problem. With the "v2" prepare -** interfaces, the underlying reason for the error is returned immediately. -**
  4. -** -**
  5. -** ^If the specific value bound to a [parameter | host parameter] in the -** WHERE clause might influence the choice of query plan for a statement, -** then the statement will be automatically recompiled, as if there had been -** a schema change, on the first [sqlite3_step()] call following any change -** to the [sqlite3_bind_text | bindings] of that [parameter]. -** ^The specific value of a WHERE-clause [parameter] might influence the -** choice of query plan if the parameter is the left-hand side of a [LIKE] -** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. -**
  6. -**
-** -**

^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having -** the extra prepFlags parameter, which is a bit array consisting of zero or -** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The -** sqlite3_prepare_v2() interface works exactly the same as -** sqlite3_prepare_v3() with a zero prepFlags parameter. - */ -// llgo:link (*Sqlite3).DoPrepare C.sqlite3_prepare -func (recv_ *Sqlite3) DoPrepare(zSql *c.Char, nByte c.Int, ppStmt **Stmt, pzTail **c.Char) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).DoPrepareV2 C.sqlite3_prepare_v2 -func (recv_ *Sqlite3) DoPrepareV2(zSql *c.Char, nByte c.Int, ppStmt **Stmt, pzTail **c.Char) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).DoPrepareV3 C.sqlite3_prepare_v3 -func (recv_ *Sqlite3) DoPrepareV3(zSql *c.Char, nByte c.Int, prepFlags c.Uint, ppStmt **Stmt, pzTail **c.Char) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).DoPrepare16 C.sqlite3_prepare16 -func (recv_ *Sqlite3) DoPrepare16(zSql c.Pointer, nByte c.Int, ppStmt **Stmt, pzTail *c.Pointer) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).DoPrepare16V2 C.sqlite3_prepare16_v2 -func (recv_ *Sqlite3) DoPrepare16V2(zSql c.Pointer, nByte c.Int, ppStmt **Stmt, pzTail *c.Pointer) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).DoPrepare16V3 C.sqlite3_prepare16_v3 -func (recv_ *Sqlite3) DoPrepare16V3(zSql c.Pointer, nByte c.Int, prepFlags c.Uint, ppStmt **Stmt, pzTail *c.Pointer) c.Int { - return 0 -} - -/* -** CAPI3REF: Retrieving Statement SQL -** METHOD: sqlite3_stmt -** -** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 -** SQL text used to create [prepared statement] P if P was -** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], -** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. -** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 -** string containing the SQL text of prepared statement P with -** [bound parameters] expanded. -** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 -** string containing the normalized SQL text of prepared statement P. The -** semantics used to normalize a SQL statement are unspecified and subject -** to change. At a minimum, literal values will be replaced with suitable -** placeholders. -** -** ^(For example, if a prepared statement is created using the SQL -** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 -** and parameter :xyz is unbound, then sqlite3_sql() will return -** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() -** will return "SELECT 2345,NULL".)^ -** -** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory -** is available to hold the result, or if the result would exceed the -** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. -** -** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of -** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time -** option causes sqlite3_expanded_sql() to always return NULL. -** -** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P) -** are managed by SQLite and are automatically freed when the prepared -** statement is finalized. -** ^The string returned by sqlite3_expanded_sql(P), on the other hand, -** is obtained from [sqlite3_malloc()] and must be freed by the application -** by passing it to [sqlite3_free()]. -** -** ^The sqlite3_normalized_sql() interface is only available if -** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined. - */ -// llgo:link (*Stmt).Sql C.sqlite3_sql -func (recv_ *Stmt) Sql() *c.Char { - return nil -} - -// llgo:link (*Stmt).ExpandedSql C.sqlite3_expanded_sql -func (recv_ *Stmt) ExpandedSql() *c.Char { - return nil -} - -/* -** CAPI3REF: Determine If An SQL Statement Writes The Database -** METHOD: sqlite3_stmt -** -** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if -** and only if the [prepared statement] X makes no direct changes to -** the content of the database file. -** -** Note that [application-defined SQL functions] or -** [virtual tables] might change the database indirectly as a side effect. -** ^(For example, if an application defines a function "eval()" that -** calls [sqlite3_exec()], then the following SQL statement would -** change the database file through side-effects: -** -**

-**    SELECT eval('DELETE FROM t1') FROM t2;
-** 
-** -** But because the [SELECT] statement does not change the database file -** directly, sqlite3_stmt_readonly() would still return true.)^ -** -** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], -** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, -** since the statements themselves do not actually modify the database but -** rather they control the timing of when other statements modify the -** database. ^The [ATTACH] and [DETACH] statements also cause -** sqlite3_stmt_readonly() to return true since, while those statements -** change the configuration of a database connection, they do not make -** changes to the content of the database files on disk. -** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since -** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and -** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so -** sqlite3_stmt_readonly() returns false for those commands. -** -** ^This routine returns false if there is any possibility that the -** statement might change the database file. ^A false return does -** not guarantee that the statement will change the database file. -** ^For example, an UPDATE statement might have a WHERE clause that -** makes it a no-op, but the sqlite3_stmt_readonly() result would still -** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a -** read-only no-op if the table already exists, but -** sqlite3_stmt_readonly() still returns false for such a statement. -** -** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN] -** statement, then sqlite3_stmt_readonly(X) returns the same value as -** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted. - */ -// llgo:link (*Stmt).StmtReadonly C.sqlite3_stmt_readonly -func (recv_ *Stmt) StmtReadonly() c.Int { - return 0 -} - -/* -** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement -** METHOD: sqlite3_stmt -** -** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the -** prepared statement S is an EXPLAIN statement, or 2 if the -** statement S is an EXPLAIN QUERY PLAN. -** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is -** an ordinary statement or a NULL pointer. - */ -// llgo:link (*Stmt).StmtIsexplain C.sqlite3_stmt_isexplain -func (recv_ *Stmt) StmtIsexplain() c.Int { - return 0 -} - -/* -** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement -** METHOD: sqlite3_stmt -** -** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN -** setting for [prepared statement] S. If E is zero, then S becomes -** a normal prepared statement. If E is 1, then S behaves as if -** its SQL text began with "[EXPLAIN]". If E is 2, then S behaves as if -** its SQL text began with "[EXPLAIN QUERY PLAN]". -** -** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared. -** SQLite tries to avoid a reprepare, but a reprepare might be necessary -** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode. -** -** Because of the potential need to reprepare, a call to -** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be -** reprepared because it was created using [sqlite3_prepare()] instead of -** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and -** hence has no saved SQL text with which to reprepare. -** -** Changing the explain setting for a prepared statement does not change -** the original SQL text for the statement. Hence, if the SQL text originally -** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0) -** is called to convert the statement into an ordinary statement, the EXPLAIN -** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S) -** output, even though the statement now acts like a normal SQL statement. -** -** This routine returns SQLITE_OK if the explain mode is successfully -** changed, or an error code if the explain mode could not be changed. -** The explain mode cannot be changed while a statement is active. -** Hence, it is good practice to call [sqlite3_reset(S)] -** immediately prior to calling sqlite3_stmt_explain(S,E). - */ -// llgo:link (*Stmt).StmtExplain C.sqlite3_stmt_explain -func (recv_ *Stmt) StmtExplain(eMode c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Determine If A Prepared Statement Has Been Reset -** METHOD: sqlite3_stmt -** -** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the -** [prepared statement] S has been stepped at least once using -** [sqlite3_step(S)] but has neither run to completion (returned -** [SQLITE_DONE] from [sqlite3_step(S)]) nor -** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) -** interface returns false if S is a NULL pointer. If S is not a -** NULL pointer and is not a pointer to a valid [prepared statement] -** object, then the behavior is undefined and probably undesirable. -** -** This interface can be used in combination [sqlite3_next_stmt()] -** to locate all prepared statements associated with a database -** connection that are in need of being reset. This can be used, -** for example, in diagnostic routines to search for prepared -** statements that are holding a transaction open. - */ -// llgo:link (*Stmt).StmtBusy C.sqlite3_stmt_busy -func (recv_ *Stmt) StmtBusy() c.Int { - return 0 -} - -type Value struct { - Unused [8]uint8 -} - -type Context struct { - Unused [8]uint8 -} - -/* -** CAPI3REF: Binding Values To Prepared Statements -** KEYWORDS: {host parameter} {host parameters} {host parameter name} -** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} -** METHOD: sqlite3_stmt -** -** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, -** literals may be replaced by a [parameter] that matches one of following -** templates: -** -**
    -**
  • ? -**
  • ?NNN -**
  • :VVV -**
  • @VVV -**
  • $VVV -**
-** -** In the templates above, NNN represents an integer literal, -** and VVV represents an alphanumeric identifier.)^ ^The values of these -** parameters (also called "host parameter names" or "SQL parameters") -** can be set using the sqlite3_bind_*() routines defined here. -** -** ^The first argument to the sqlite3_bind_*() routines is always -** a pointer to the [sqlite3_stmt] object returned from -** [sqlite3_prepare_v2()] or its variants. -** -** ^The second argument is the index of the SQL parameter to be set. -** ^The leftmost SQL parameter has an index of 1. ^When the same named -** SQL parameter is used more than once, second and subsequent -** occurrences have the same index as the first occurrence. -** ^The index for named parameters can be looked up using the -** [sqlite3_bind_parameter_index()] API if desired. ^The index -** for "?NNN" parameters is the value of NNN. -** ^The NNN value must be between 1 and the [sqlite3_limit()] -** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 32766). -** -** ^The third argument is the value to bind to the parameter. -** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter -** is ignored and the end result is the same as sqlite3_bind_null(). -** ^If the third parameter to sqlite3_bind_text() is not NULL, then -** it should be a pointer to well-formed UTF8 text. -** ^If the third parameter to sqlite3_bind_text16() is not NULL, then -** it should be a pointer to well-formed UTF16 text. -** ^If the third parameter to sqlite3_bind_text64() is not NULL, then -** it should be a pointer to a well-formed unicode string that is -** either UTF8 if the sixth parameter is SQLITE_UTF8, or UTF16 -** otherwise. -** -** [[byte-order determination rules]] ^The byte-order of -** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF) -** found in first character, which is removed, or in the absence of a BOM -** the byte order is the native byte order of the host -** machine for sqlite3_bind_text16() or the byte order specified in -** the 6th parameter for sqlite3_bind_text64().)^ -** ^If UTF16 input text contains invalid unicode -** characters, then SQLite might change those invalid characters -** into the unicode replacement character: U+FFFD. -** -** ^(In those routines that have a fourth argument, its value is the -** number of bytes in the parameter. To be clear: the value is the -** number of bytes in the value, not the number of characters.)^ -** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** is negative, then the length of the string is -** the number of bytes up to the first zero terminator. -** If the fourth parameter to sqlite3_bind_blob() is negative, then -** the behavior is undefined. -** If a non-negative fourth parameter is provided to sqlite3_bind_text() -** or sqlite3_bind_text16() or sqlite3_bind_text64() then -** that parameter must be the byte offset -** where the NUL terminator would occur assuming the string were NUL -** terminated. If any NUL characters occurs at byte offsets less than -** the value of the fourth parameter then the resulting string value will -** contain embedded NULs. The result of expressions involving strings -** with embedded NULs is undefined. -** -** ^The fifth argument to the BLOB and string binding interfaces controls -** or indicates the lifetime of the object referenced by the third parameter. -** These three options exist: -** ^ (1) A destructor to dispose of the BLOB or string after SQLite has finished -** with it may be passed. ^It is called to dispose of the BLOB or string even -** if the call to the bind API fails, except the destructor is not called if -** the third parameter is a NULL pointer or the fourth parameter is negative. -** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that -** the application remains responsible for disposing of the object. ^In this -** case, the object and the provided pointer to it must remain valid until -** either the prepared statement is finalized or the same SQL parameter is -** bound to something else, whichever occurs sooner. -** ^ (3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the -** object is to be copied prior to the return from sqlite3_bind_*(). ^The -** object and pointer to it must remain valid until then. ^SQLite will then -** manage the lifetime of its private copy. -** -** ^The sixth argument to sqlite3_bind_text64() must be one of -** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE] -** to specify the encoding of the text in the third parameter. If -** the sixth argument to sqlite3_bind_text64() is not one of the -** allowed values shown above, or if the text encoding is different -** from the encoding specified by the sixth parameter, then the behavior -** is undefined. -** -** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that -** is filled with zeroes. ^A zeroblob uses a fixed amount of memory -** (just an integer to hold its size) while it is being processed. -** Zeroblobs are intended to serve as placeholders for BLOBs whose -** content is later written using -** [sqlite3_blob_open | incremental BLOB I/O] routines. -** ^A negative value for the zeroblob results in a zero-length BLOB. -** -** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in -** [prepared statement] S to have an SQL value of NULL, but to also be -** associated with the pointer P of type T. ^D is either a NULL pointer or -** a pointer to a destructor function for P. ^SQLite will invoke the -** destructor D with a single argument of P when it is finished using -** P. The T parameter should be a static string, preferably a string -** literal. The sqlite3_bind_pointer() routine is part of the -** [pointer passing interface] added for SQLite 3.20.0. -** -** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer -** for the [prepared statement] or with a prepared statement for which -** [sqlite3_step()] has been called more recently than [sqlite3_reset()], -** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() -** routine is passed a [prepared statement] that has been finalized, the -** result is undefined and probably harmful. -** -** ^Bindings are not cleared by the [sqlite3_reset()] routine. -** ^Unbound parameters are interpreted as NULL. -** -** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an -** [error code] if anything goes wrong. -** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB -** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or -** [SQLITE_MAX_LENGTH]. -** ^[SQLITE_RANGE] is returned if the parameter -** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. -** -** See also: [sqlite3_bind_parameter_count()], -** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. - */ -// llgo:link (*Stmt).BindBlob C.sqlite3_bind_blob -func (recv_ *Stmt) BindBlob(__llgo_arg_0 c.Int, __llgo_arg_1 c.Pointer, n c.Int, __llgo_arg_3 func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindBlob64 C.sqlite3_bind_blob64 -func (recv_ *Stmt) BindBlob64(c.Int, c.Pointer, Uint64, func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindDouble C.sqlite3_bind_double -func (recv_ *Stmt) BindDouble(c.Int, c.Double) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindInt C.sqlite3_bind_int -func (recv_ *Stmt) BindInt(c.Int, c.Int) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindInt64 C.sqlite3_bind_int64 -func (recv_ *Stmt) BindInt64(c.Int, Int64) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindNull C.sqlite3_bind_null -func (recv_ *Stmt) BindNull(c.Int) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindText C.sqlite3_bind_text -func (recv_ *Stmt) BindText(c.Int, *c.Char, c.Int, func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindText16 C.sqlite3_bind_text16 -func (recv_ *Stmt) BindText16(c.Int, c.Pointer, c.Int, func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindText64 C.sqlite3_bind_text64 -func (recv_ *Stmt) BindText64(__llgo_arg_0 c.Int, __llgo_arg_1 *c.Char, __llgo_arg_2 Uint64, __llgo_arg_3 func(c.Pointer), encoding c.Char) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindValue C.sqlite3_bind_value -func (recv_ *Stmt) BindValue(c.Int, *Value) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindPointer C.sqlite3_bind_pointer -func (recv_ *Stmt) BindPointer(c.Int, c.Pointer, *c.Char, func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindZeroblob C.sqlite3_bind_zeroblob -func (recv_ *Stmt) BindZeroblob(__llgo_arg_0 c.Int, n c.Int) c.Int { - return 0 -} - -// llgo:link (*Stmt).BindZeroblob64 C.sqlite3_bind_zeroblob64 -func (recv_ *Stmt) BindZeroblob64(c.Int, Uint64) c.Int { - return 0 -} - -/* -** CAPI3REF: Number Of SQL Parameters -** METHOD: sqlite3_stmt -** -** ^This routine can be used to find the number of [SQL parameters] -** in a [prepared statement]. SQL parameters are tokens of the -** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as -** placeholders for values that are [sqlite3_bind_blob | bound] -** to the parameters at a later time. -** -** ^(This routine actually returns the index of the largest (rightmost) -** parameter. For all forms except ?NNN, this will correspond to the -** number of unique parameters. If parameters of the ?NNN form are used, -** there may be gaps in the list.)^ -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_name()], and -** [sqlite3_bind_parameter_index()]. - */ -// llgo:link (*Stmt).BindParameterCount C.sqlite3_bind_parameter_count -func (recv_ *Stmt) BindParameterCount() c.Int { - return 0 -} - -/* -** CAPI3REF: Name Of A Host Parameter -** METHOD: sqlite3_stmt -** -** ^The sqlite3_bind_parameter_name(P,N) interface returns -** the name of the N-th [SQL parameter] in the [prepared statement] P. -** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" -** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" -** respectively. -** In other words, the initial ":" or "$" or "@" or "?" -** is included as part of the name.)^ -** ^Parameters of the form "?" without a following integer have no name -** and are referred to as "nameless" or "anonymous parameters". -** -** ^The first host parameter has an index of 1, not 0. -** -** ^If the value N is out of range or if the N-th parameter is -** nameless, then NULL is returned. ^The returned string is -** always in UTF-8 encoding even if the named parameter was -** originally specified as UTF-16 in [sqlite3_prepare16()], -** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_index()]. - */ -// llgo:link (*Stmt).BindParameterName C.sqlite3_bind_parameter_name -func (recv_ *Stmt) BindParameterName(c.Int) *c.Char { - return nil -} - -/* -** CAPI3REF: Index Of A Parameter With A Given Name -** METHOD: sqlite3_stmt -** -** ^Return the index of an SQL parameter given its name. ^The -** index value returned is suitable for use as the second -** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero -** is returned if no matching parameter is found. ^The parameter -** name must be given in UTF-8 even if the original statement -** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or -** [sqlite3_prepare16_v3()]. -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_name()]. - */ -// llgo:link (*Stmt).BindParameterIndex C.sqlite3_bind_parameter_index -func (recv_ *Stmt) BindParameterIndex(zName *c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Reset All Bindings On A Prepared Statement -** METHOD: sqlite3_stmt -** -** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset -** the [sqlite3_bind_blob | bindings] on a [prepared statement]. -** ^Use this routine to reset all host parameters to NULL. - */ -// llgo:link (*Stmt).ClearBindings C.sqlite3_clear_bindings -func (recv_ *Stmt) ClearBindings() c.Int { - return 0 -} - -/* -** CAPI3REF: Number Of Columns In A Result Set -** METHOD: sqlite3_stmt -** -** ^Return the number of columns in the result set returned by the -** [prepared statement]. ^If this routine returns 0, that means the -** [prepared statement] returns no data (for example an [UPDATE]). -** ^However, just because this routine returns a positive number does not -** mean that one or more rows of data will be returned. ^A SELECT statement -** will always have a positive sqlite3_column_count() but depending on the -** WHERE clause constraints and the table content, it might return no rows. -** -** See also: [sqlite3_data_count()] - */ -// llgo:link (*Stmt).ColumnCount C.sqlite3_column_count -func (recv_ *Stmt) ColumnCount() c.Int { - return 0 -} - -/* -** CAPI3REF: Column Names In A Result Set -** METHOD: sqlite3_stmt -** -** ^These routines return the name assigned to a particular column -** in the result set of a [SELECT] statement. ^The sqlite3_column_name() -** interface returns a pointer to a zero-terminated UTF-8 string -** and sqlite3_column_name16() returns a pointer to a zero-terminated -** UTF-16 string. ^The first parameter is the [prepared statement] -** that implements the [SELECT] statement. ^The second parameter is the -** column number. ^The leftmost column is number 0. -** -** ^The returned string pointer is valid until either the [prepared statement] -** is destroyed by [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run -** or until the next call to -** sqlite3_column_name() or sqlite3_column_name16() on the same column. -** -** ^If sqlite3_malloc() fails during the processing of either routine -** (for example during a conversion from UTF-8 to UTF-16) then a -** NULL pointer is returned. -** -** ^The name of a result column is the value of the "AS" clause for -** that column, if there is an AS clause. If there is no AS clause -** then the name of the column is unspecified and may change from -** one release of SQLite to the next. - */ -// llgo:link (*Stmt).ColumnName C.sqlite3_column_name -func (recv_ *Stmt) ColumnName(N c.Int) *c.Char { - return nil -} - -// llgo:link (*Stmt).ColumnName16 C.sqlite3_column_name16 -func (recv_ *Stmt) ColumnName16(N c.Int) c.Pointer { - return nil -} - -/* -** CAPI3REF: Source Of Data In A Query Result -** METHOD: sqlite3_stmt -** -** ^These routines provide a means to determine the database, table, and -** table column that is the origin of a particular result column in -** [SELECT] statement. -** ^The name of the database or table or column can be returned as -** either a UTF-8 or UTF-16 string. ^The _database_ routines return -** the database name, the _table_ routines return the table name, and -** the origin_ routines return the column name. -** ^The returned string is valid until the [prepared statement] is destroyed -** using [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run -** or until the same information is requested -** again in a different encoding. -** -** ^The names returned are the original un-aliased names of the -** database, table, and column. -** -** ^The first argument to these interfaces is a [prepared statement]. -** ^These functions return information about the Nth result column returned by -** the statement, where N is the second function argument. -** ^The left-most column is column 0 for these routines. -** -** ^If the Nth column returned by the statement is an expression or -** subquery and is not a column value, then all of these functions return -** NULL. ^These routines might also return NULL if a memory allocation error -** occurs. ^Otherwise, they return the name of the attached database, table, -** or column that query result column was extracted from. -** -** ^As with all other SQLite APIs, those whose names end with "16" return -** UTF-16 encoded strings and the other functions return UTF-8. -** -** ^These APIs are only available if the library was compiled with the -** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. -** -** If two or more threads call one or more -** [sqlite3_column_database_name | column metadata interfaces] -** for the same [prepared statement] and result column -** at the same time then the results are undefined. - */ -// llgo:link (*Stmt).ColumnDatabaseName C.sqlite3_column_database_name -func (recv_ *Stmt) ColumnDatabaseName(c.Int) *c.Char { - return nil -} - -// llgo:link (*Stmt).ColumnDatabaseName16 C.sqlite3_column_database_name16 -func (recv_ *Stmt) ColumnDatabaseName16(c.Int) c.Pointer { - return nil -} - -// llgo:link (*Stmt).ColumnTableName C.sqlite3_column_table_name -func (recv_ *Stmt) ColumnTableName(c.Int) *c.Char { - return nil -} - -// llgo:link (*Stmt).ColumnTableName16 C.sqlite3_column_table_name16 -func (recv_ *Stmt) ColumnTableName16(c.Int) c.Pointer { - return nil -} - -// llgo:link (*Stmt).ColumnOriginName C.sqlite3_column_origin_name -func (recv_ *Stmt) ColumnOriginName(c.Int) *c.Char { - return nil -} - -// llgo:link (*Stmt).ColumnOriginName16 C.sqlite3_column_origin_name16 -func (recv_ *Stmt) ColumnOriginName16(c.Int) c.Pointer { - return nil -} - -/* -** CAPI3REF: Declared Datatype Of A Query Result -** METHOD: sqlite3_stmt -** -** ^(The first parameter is a [prepared statement]. -** If this statement is a [SELECT] statement and the Nth column of the -** returned result set of that [SELECT] is a table column (not an -** expression or subquery) then the declared type of the table -** column is returned.)^ ^If the Nth column of the result set is an -** expression or subquery, then a NULL pointer is returned. -** ^The returned string is always UTF-8 encoded. -** -** ^(For example, given the database schema: -** -** CREATE TABLE t1(c1 VARIANT); -** -** and the following statement to be compiled: -** -** SELECT c1 + 1, c1 FROM t1; -** -** this routine would return the string "VARIANT" for the second result -** column (i==1), and a NULL pointer for the first result column (i==0).)^ -** -** ^SQLite uses dynamic run-time typing. ^So just because a column -** is declared to contain a particular type does not mean that the -** data stored in that column is of the declared type. SQLite is -** strongly typed, but the typing is dynamic not static. ^Type -** is associated with individual values, not with the containers -** used to hold those values. - */ -// llgo:link (*Stmt).ColumnDecltype C.sqlite3_column_decltype -func (recv_ *Stmt) ColumnDecltype(c.Int) *c.Char { - return nil -} - -// llgo:link (*Stmt).ColumnDecltype16 C.sqlite3_column_decltype16 -func (recv_ *Stmt) ColumnDecltype16(c.Int) c.Pointer { - return nil -} - -/* -** CAPI3REF: Evaluate An SQL Statement -** METHOD: sqlite3_stmt -** -** After a [prepared statement] has been prepared using any of -** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()], -** or [sqlite3_prepare16_v3()] or one of the legacy -** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function -** must be called one or more times to evaluate the statement. -** -** The details of the behavior of the sqlite3_step() interface depend -** on whether the statement was prepared using the newer "vX" interfaces -** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()], -** [sqlite3_prepare16_v2()] or the older legacy -** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the -** new "vX" interface is recommended for new applications but the legacy -** interface will continue to be supported. -** -** ^In the legacy interface, the return value will be either [SQLITE_BUSY], -** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. -** ^With the "v2" interface, any of the other [result codes] or -** [extended result codes] might be returned as well. -** -** ^[SQLITE_BUSY] means that the database engine was unable to acquire the -** database locks it needs to do its job. ^If the statement is a [COMMIT] -** or occurs outside of an explicit transaction, then you can retry the -** statement. If the statement is not a [COMMIT] and occurs within an -** explicit transaction then you should rollback the transaction before -** continuing. -** -** ^[SQLITE_DONE] means that the statement has finished executing -** successfully. sqlite3_step() should not be called again on this virtual -** machine without first calling [sqlite3_reset()] to reset the virtual -** machine back to its initial state. -** -** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] -** is returned each time a new row of data is ready for processing by the -** caller. The values may be accessed using the [column access functions]. -** sqlite3_step() is called again to retrieve the next row of data. -** -** ^[SQLITE_ERROR] means that a run-time error (such as a constraint -** violation) has occurred. sqlite3_step() should not be called again on -** the VM. More information may be found by calling [sqlite3_errmsg()]. -** ^With the legacy interface, a more specific error code (for example, -** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) -** can be obtained by calling [sqlite3_reset()] on the -** [prepared statement]. ^In the "v2" interface, -** the more specific error code is returned directly by sqlite3_step(). -** -** [SQLITE_MISUSE] means that the this routine was called inappropriately. -** Perhaps it was called on a [prepared statement] that has -** already been [sqlite3_finalize | finalized] or on one that had -** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could -** be the case that the same database connection is being used by two or -** more threads at the same moment in time. -** -** For all versions of SQLite up to and including 3.6.23.1, a call to -** [sqlite3_reset()] was required after sqlite3_step() returned anything -** other than [SQLITE_ROW] before any subsequent invocation of -** sqlite3_step(). Failure to reset the prepared statement using -** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from -** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1], -** sqlite3_step() began -** calling [sqlite3_reset()] automatically in this circumstance rather -** than returning [SQLITE_MISUSE]. This is not considered a compatibility -** break because any application that ever receives an SQLITE_MISUSE error -** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option -** can be used to restore the legacy behavior. -** -** Goofy Interface Alert: In the legacy interface, the sqlite3_step() -** API always returns a generic error code, [SQLITE_ERROR], following any -** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call -** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the -** specific [error codes] that better describes the error. -** We admit that this is a goofy design. The problem has been fixed -** with the "v2" interface. If you prepare all of your SQL statements -** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()] -** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead -** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, -** then the more specific [error codes] are returned directly -** by sqlite3_step(). The use of the "vX" interfaces is recommended. - */ -// llgo:link (*Stmt).Step C.sqlite3_step -func (recv_ *Stmt) Step() c.Int { - return 0 -} - -/* -** CAPI3REF: Number of columns in a result set -** METHOD: sqlite3_stmt -** -** ^The sqlite3_data_count(P) interface returns the number of columns in the -** current row of the result set of [prepared statement] P. -** ^If prepared statement P does not have results ready to return -** (via calls to the [sqlite3_column_int | sqlite3_column()] family of -** interfaces) then sqlite3_data_count(P) returns 0. -** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. -** ^The sqlite3_data_count(P) routine returns 0 if the previous call to -** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) -** will return non-zero if previous call to [sqlite3_step](P) returned -** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] -** where it always returns zero since each step of that multi-step -** pragma returns 0 columns of data. -** -** See also: [sqlite3_column_count()] - */ -// llgo:link (*Stmt).DataCount C.sqlite3_data_count -func (recv_ *Stmt) DataCount() c.Int { - return 0 -} - -/* -** CAPI3REF: Result Values From A Query -** KEYWORDS: {column access functions} -** METHOD: sqlite3_stmt -** -** Summary: -**
-**
sqlite3_column_blobBLOB result -**
sqlite3_column_doubleREAL result -**
sqlite3_column_int32-bit INTEGER result -**
sqlite3_column_int6464-bit INTEGER result -**
sqlite3_column_textUTF-8 TEXT result -**
sqlite3_column_text16UTF-16 TEXT result -**
sqlite3_column_valueThe result as an -** [sqlite3_value|unprotected sqlite3_value] object. -**
    -**
sqlite3_column_bytesSize of a BLOB -** or a UTF-8 TEXT result in bytes -**
sqlite3_column_bytes16   -** →  Size of UTF-16 -** TEXT in bytes -**
sqlite3_column_typeDefault -** datatype of the result -**
-** -** Details: -** -** ^These routines return information about a single column of the current -** result row of a query. ^In every case the first argument is a pointer -** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] -** that was returned from [sqlite3_prepare_v2()] or one of its variants) -** and the second argument is the index of the column for which information -** should be returned. ^The leftmost column of the result set has the index 0. -** ^The number of columns in the result can be determined using -** [sqlite3_column_count()]. -** -** If the SQL statement does not currently point to a valid row, or if the -** column index is out of range, the result is undefined. -** These routines may only be called when the most recent call to -** [sqlite3_step()] has returned [SQLITE_ROW] and neither -** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. -** If any of these routines are called after [sqlite3_reset()] or -** [sqlite3_finalize()] or after [sqlite3_step()] has returned -** something other than [SQLITE_ROW], the results are undefined. -** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] -** are called from a different thread while any of these routines -** are pending, then the results are undefined. -** -** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16) -** each return the value of a result column in a specific data format. If -** the result column is not initially in the requested format (for example, -** if the query returns an integer but the sqlite3_column_text() interface -** is used to extract the value) then an automatic type conversion is performed. -** -** ^The sqlite3_column_type() routine returns the -** [SQLITE_INTEGER | datatype code] for the initial data type -** of the result column. ^The returned value is one of [SQLITE_INTEGER], -** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. -** The return value of sqlite3_column_type() can be used to decide which -** of the first six interface should be used to extract the column value. -** The value returned by sqlite3_column_type() is only meaningful if no -** automatic type conversions have occurred for the value in question. -** After a type conversion, the result of calling sqlite3_column_type() -** is undefined, though harmless. Future -** versions of SQLite may change the behavior of sqlite3_column_type() -** following a type conversion. -** -** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes() -** or sqlite3_column_bytes16() interfaces can be used to determine the size -** of that BLOB or string. -** -** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() -** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts -** the string to UTF-8 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes() uses -** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns -** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes() returns zero. -** -** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() -** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts -** the string to UTF-16 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes16() uses -** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns -** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. -** -** ^The values returned by [sqlite3_column_bytes()] and -** [sqlite3_column_bytes16()] do not include the zero terminators at the end -** of the string. ^For clarity: the values returned by -** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of -** bytes in the string, not the number of characters. -** -** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), -** even empty strings, are always zero-terminated. ^The return -** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. -** -** ^Strings returned by sqlite3_column_text16() always have the endianness -** which is native to the platform, regardless of the text encoding set -** for the database. -** -** Warning: ^The object returned by [sqlite3_column_value()] is an -** [unprotected sqlite3_value] object. In a multithreaded environment, -** an unprotected sqlite3_value object may only be used safely with -** [sqlite3_bind_value()] and [sqlite3_result_value()]. -** If the [unprotected sqlite3_value] object returned by -** [sqlite3_column_value()] is used in any other way, including calls -** to routines like [sqlite3_value_int()], [sqlite3_value_text()], -** or [sqlite3_value_bytes()], the behavior is not threadsafe. -** Hence, the sqlite3_column_value() interface -** is normally only useful within the implementation of -** [application-defined SQL functions] or [virtual tables], not within -** top-level application code. -** -** These routines may attempt to convert the datatype of the result. -** ^For example, if the internal representation is FLOAT and a text result -** is requested, [sqlite3_snprintf()] is used internally to perform the -** conversion automatically. ^(The following table details the conversions -** that are applied: -** -**
-** -**
Internal
Type
Requested
Type
Conversion -** -**
NULL INTEGER Result is 0 -**
NULL FLOAT Result is 0.0 -**
NULL TEXT Result is a NULL pointer -**
NULL BLOB Result is a NULL pointer -**
INTEGER FLOAT Convert from integer to float -**
INTEGER TEXT ASCII rendering of the integer -**
INTEGER BLOB Same as INTEGER->TEXT -**
FLOAT INTEGER [CAST] to INTEGER -**
FLOAT TEXT ASCII rendering of the float -**
FLOAT BLOB [CAST] to BLOB -**
TEXT INTEGER [CAST] to INTEGER -**
TEXT FLOAT [CAST] to REAL -**
TEXT BLOB No change -**
BLOB INTEGER [CAST] to INTEGER -**
BLOB FLOAT [CAST] to REAL -**
BLOB TEXT [CAST] to TEXT, ensure zero terminator -**
-**
)^ -** -** Note that when type conversions occur, pointers returned by prior -** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or -** sqlite3_column_text16() may be invalidated. -** Type conversions and pointer invalidations might occur -** in the following cases: -** -**
    -**
  • The initial content is a BLOB and sqlite3_column_text() or -** sqlite3_column_text16() is called. A zero-terminator might -** need to be added to the string.
  • -**
  • The initial content is UTF-8 text and sqlite3_column_bytes16() or -** sqlite3_column_text16() is called. The content must be converted -** to UTF-16.
  • -**
  • The initial content is UTF-16 text and sqlite3_column_bytes() or -** sqlite3_column_text() is called. The content must be converted -** to UTF-8.
  • -**
-** -** ^Conversions between UTF-16be and UTF-16le are always done in place and do -** not invalidate a prior pointer, though of course the content of the buffer -** that the prior pointer references will have been modified. Other kinds -** of conversion are done in place when it is possible, but sometimes they -** are not possible and in those cases prior pointers are invalidated. -** -** The safest policy is to invoke these routines -** in one of the following ways: -** -**
    -**
  • sqlite3_column_text() followed by sqlite3_column_bytes()
  • -**
  • sqlite3_column_blob() followed by sqlite3_column_bytes()
  • -**
  • sqlite3_column_text16() followed by sqlite3_column_bytes16()
  • -**
-** -** In other words, you should call sqlite3_column_text(), -** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result -** into the desired format, then invoke sqlite3_column_bytes() or -** sqlite3_column_bytes16() to find the size of the result. Do not mix calls -** to sqlite3_column_text() or sqlite3_column_blob() with calls to -** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() -** with calls to sqlite3_column_bytes(). -** -** ^The pointers returned are valid until a type conversion occurs as -** described above, or until [sqlite3_step()] or [sqlite3_reset()] or -** [sqlite3_finalize()] is called. ^The memory space used to hold strings -** and BLOBs is freed automatically. Do not pass the pointers returned -** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into -** [sqlite3_free()]. -** -** As long as the input parameters are correct, these routines will only -** fail if an out-of-memory error occurs during a format conversion. -** Only the following subset of interfaces are subject to out-of-memory -** errors: -** -**
    -**
  • sqlite3_column_blob() -**
  • sqlite3_column_text() -**
  • sqlite3_column_text16() -**
  • sqlite3_column_bytes() -**
  • sqlite3_column_bytes16() -**
-** -** If an out-of-memory error occurs, then the return value from these -** routines is the same as if the column had contained an SQL NULL value. -** Valid SQL NULL returns can be distinguished from out-of-memory errors -** by invoking the [sqlite3_errcode()] immediately after the suspect -** return value is obtained and before any -** other SQLite interface is called on the same [database connection]. - */ -// llgo:link (*Stmt).ColumnBlob C.sqlite3_column_blob -func (recv_ *Stmt) ColumnBlob(iCol c.Int) c.Pointer { - return nil -} - -// llgo:link (*Stmt).ColumnDouble C.sqlite3_column_double -func (recv_ *Stmt) ColumnDouble(iCol c.Int) c.Double { - return 0 -} - -// llgo:link (*Stmt).ColumnInt C.sqlite3_column_int -func (recv_ *Stmt) ColumnInt(iCol c.Int) c.Int { - return 0 -} - -// llgo:link (*Stmt).ColumnInt64 C.sqlite3_column_int64 -func (recv_ *Stmt) ColumnInt64(iCol c.Int) Int64 { - return 0 -} - -// llgo:link (*Stmt).ColumnText C.sqlite3_column_text -func (recv_ *Stmt) ColumnText(iCol c.Int) *c.Char { - return nil -} - -// llgo:link (*Stmt).ColumnText16 C.sqlite3_column_text16 -func (recv_ *Stmt) ColumnText16(iCol c.Int) c.Pointer { - return nil -} - -// llgo:link (*Stmt).ColumnValue C.sqlite3_column_value -func (recv_ *Stmt) ColumnValue(iCol c.Int) *Value { - return nil -} - -// llgo:link (*Stmt).ColumnBytes C.sqlite3_column_bytes -func (recv_ *Stmt) ColumnBytes(iCol c.Int) c.Int { - return 0 -} - -// llgo:link (*Stmt).ColumnBytes16 C.sqlite3_column_bytes16 -func (recv_ *Stmt) ColumnBytes16(iCol c.Int) c.Int { - return 0 -} - -// llgo:link (*Stmt).ColumnType C.sqlite3_column_type -func (recv_ *Stmt) ColumnType(iCol c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Destroy A Prepared Statement Object -** DESTRUCTOR: sqlite3_stmt -** -** ^The sqlite3_finalize() function is called to delete a [prepared statement]. -** ^If the most recent evaluation of the statement encountered no errors -** or if the statement is never been evaluated, then sqlite3_finalize() returns -** SQLITE_OK. ^If the most recent evaluation of statement S failed, then -** sqlite3_finalize(S) returns the appropriate [error code] or -** [extended error code]. -** -** ^The sqlite3_finalize(S) routine can be called at any point during -** the life cycle of [prepared statement] S: -** before statement S is ever evaluated, after -** one or more calls to [sqlite3_reset()], or after any call -** to [sqlite3_step()] regardless of whether or not the statement has -** completed execution. -** -** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. -** -** The application must finalize every [prepared statement] in order to avoid -** resource leaks. It is a grievous error for the application to try to use -** a prepared statement after it has been finalized. Any use of a prepared -** statement after it has been finalized can result in undefined and -** undesirable behavior such as segfaults and heap corruption. - */ -// llgo:link (*Stmt).Close C.sqlite3_finalize -func (recv_ *Stmt) Close() c.Int { - return 0 -} - -/* -** CAPI3REF: Reset A Prepared Statement Object -** METHOD: sqlite3_stmt -** -** The sqlite3_reset() function is called to reset a [prepared statement] -** object back to its initial state, ready to be re-executed. -** ^Any SQL statement variables that had values bound to them using -** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. -** Use [sqlite3_clear_bindings()] to reset the bindings. -** -** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S -** back to the beginning of its program. -** -** ^The return code from [sqlite3_reset(S)] indicates whether or not -** the previous evaluation of prepared statement S completed successfully. -** ^If [sqlite3_step(S)] has never before been called on S or if -** [sqlite3_step(S)] has not been called since the previous call -** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return -** [SQLITE_OK]. -** -** ^If the most recent call to [sqlite3_step(S)] for the -** [prepared statement] S indicated an error, then -** [sqlite3_reset(S)] returns an appropriate [error code]. -** ^The [sqlite3_reset(S)] interface might also return an [error code] -** if there were no prior errors but the process of resetting -** the prepared statement caused a new error. ^For example, if an -** [INSERT] statement with a [RETURNING] clause is only stepped one time, -** that one call to [sqlite3_step(S)] might return SQLITE_ROW but -** the overall statement might still fail and the [sqlite3_reset(S)] call -** might return SQLITE_BUSY if locking constraints prevent the -** database change from committing. Therefore, it is important that -** applications check the return code from [sqlite3_reset(S)] even if -** no prior call to [sqlite3_step(S)] indicated a problem. -** -** ^The [sqlite3_reset(S)] interface does not change the values -** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. - */ -// llgo:link (*Stmt).Reset C.sqlite3_reset -func (recv_ *Stmt) Reset() c.Int { - return 0 -} - -/* -** CAPI3REF: Create Or Redefine SQL Functions -** KEYWORDS: {function creation routines} -** METHOD: sqlite3 -** -** ^These functions (collectively known as "function creation routines") -** are used to add SQL functions or aggregates or to redefine the behavior -** of existing SQL functions or aggregates. The only differences between -** the three "sqlite3_create_function*" routines are the text encoding -** expected for the second parameter (the name of the function being -** created) and the presence or absence of a destructor callback for -** the application data pointer. Function sqlite3_create_window_function() -** is similar, but allows the user to supply the extra callback functions -** needed by [aggregate window functions]. -** -** ^The first parameter is the [database connection] to which the SQL -** function is to be added. ^If an application uses more than one database -** connection then application-defined SQL functions must be added -** to each database connection separately. -** -** ^The second parameter is the name of the SQL function to be created or -** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 -** representation, exclusive of the zero-terminator. ^Note that the name -** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. -** ^Any attempt to create a function with a longer name -** will result in [SQLITE_MISUSE] being returned. -** -** ^The third parameter (nArg) -** is the number of arguments that the SQL function or -** aggregate takes. ^If this parameter is -1, then the SQL function or -** aggregate may take any number of arguments between 0 and the limit -** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third -** parameter is less than -1 or greater than 127 then the behavior is -** undefined. -** -** ^The fourth parameter, eTextRep, specifies what -** [SQLITE_UTF8 | text encoding] this SQL function prefers for -** its parameters. The application should set this parameter to -** [SQLITE_UTF16LE] if the function implementation invokes -** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the -** implementation invokes [sqlite3_value_text16be()] on an input, or -** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] -** otherwise. ^The same SQL function may be registered multiple times using -** different preferred text encodings, with different implementations for -** each encoding. -** ^When multiple implementations of the same function are available, SQLite -** will pick the one that involves the least amount of data conversion. -** -** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] -** to signal that the function will always return the same result given -** the same inputs within a single SQL statement. Most SQL functions are -** deterministic. The built-in [random()] SQL function is an example of a -** function that is not deterministic. The SQLite query planner is able to -** perform additional optimizations on deterministic functions, so use -** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. -** -** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] -** flag, which if present prevents the function from being invoked from -** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions, -** index expressions, or the WHERE clause of partial indexes. -** -** For best security, the [SQLITE_DIRECTONLY] flag is recommended for -** all application-defined SQL functions that do not need to be -** used inside of triggers, view, CHECK constraints, or other elements of -** the database schema. This flags is especially recommended for SQL -** functions that have side effects or reveal internal application state. -** Without this flag, an attacker might be able to modify the schema of -** a database file to include invocations of the function with parameters -** chosen by the attacker, which the application will then execute when -** the database file is opened and read. -** -** ^(The fifth parameter is an arbitrary pointer. The implementation of the -** function can gain access to this pointer using [sqlite3_user_data()].)^ -** -** ^The sixth, seventh and eighth parameters passed to the three -** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are -** pointers to C-language functions that implement the SQL function or -** aggregate. ^A scalar SQL function requires an implementation of the xFunc -** callback only; NULL pointers must be passed as the xStep and xFinal -** parameters. ^An aggregate SQL function requires an implementation of xStep -** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing -** SQL function or aggregate, pass NULL pointers for all three function -** callbacks. -** -** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue -** and xInverse) passed to sqlite3_create_window_function are pointers to -** C-language callbacks that implement the new function. xStep and xFinal -** must both be non-NULL. xValue and xInverse may either both be NULL, in -** which case a regular aggregate function is created, or must both be -** non-NULL, in which case the new function may be used as either an aggregate -** or aggregate window function. More details regarding the implementation -** of aggregate window functions are -** [user-defined window functions|available here]. -** -** ^(If the final parameter to sqlite3_create_function_v2() or -** sqlite3_create_window_function() is not NULL, then it is destructor for -** the application data pointer. The destructor is invoked when the function -** is deleted, either by being overloaded or when the database connection -** closes.)^ ^The destructor is also invoked if the call to -** sqlite3_create_function_v2() fails. ^When the destructor callback is -** invoked, it is passed a single argument which is a copy of the application -** data pointer which was the fifth parameter to sqlite3_create_function_v2(). -** -** ^It is permitted to register multiple implementations of the same -** functions with the same name but with either differing numbers of -** arguments or differing preferred text encodings. ^SQLite will use -** the implementation that most closely matches the way in which the -** SQL function is used. ^A function implementation with a non-negative -** nArg parameter is a better match than a function implementation with -** a negative nArg. ^A function where the preferred text encoding -** matches the database encoding is a better -** match than a function where the encoding is different. -** ^A function where the encoding difference is between UTF16le and UTF16be -** is a closer match than a function where the encoding difference is -** between UTF8 and UTF16. -** -** ^Built-in functions may be overloaded by new application-defined functions. -** -** ^An application-defined function is permitted to call other -** SQLite interfaces. However, such calls must not -** close the database connection nor finalize or reset the prepared -** statement in which the function is running. - */ -// llgo:link (*Sqlite3).CreateFunction C.sqlite3_create_function -func (recv_ *Sqlite3) CreateFunction(zFunctionName *c.Char, nArg c.Int, eTextRep c.Int, pApp c.Pointer, xFunc func(*Context, c.Int, **Value), xStep func(*Context, c.Int, **Value), xFinal func(*Context)) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CreateFunction16 C.sqlite3_create_function16 -func (recv_ *Sqlite3) CreateFunction16(zFunctionName c.Pointer, nArg c.Int, eTextRep c.Int, pApp c.Pointer, xFunc func(*Context, c.Int, **Value), xStep func(*Context, c.Int, **Value), xFinal func(*Context)) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CreateFunctionV2 C.sqlite3_create_function_v2 -func (recv_ *Sqlite3) CreateFunctionV2(zFunctionName *c.Char, nArg c.Int, eTextRep c.Int, pApp c.Pointer, xFunc func(*Context, c.Int, **Value), xStep func(*Context, c.Int, **Value), xFinal func(*Context), xDestroy func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CreateWindowFunction C.sqlite3_create_window_function -func (recv_ *Sqlite3) CreateWindowFunction(zFunctionName *c.Char, nArg c.Int, eTextRep c.Int, pApp c.Pointer, xStep func(*Context, c.Int, **Value), xFinal func(*Context), xValue func(*Context), xInverse func(*Context, c.Int, **Value), xDestroy func(c.Pointer)) c.Int { - return 0 -} - -/* -** CAPI3REF: Deprecated Functions -** DEPRECATED -** -** These functions are [deprecated]. In order to maintain -** backwards compatibility with older code, these functions continue -** to be supported. However, new applications should avoid -** the use of these functions. To encourage programmers to avoid -** these functions, we will not explain what they do. - */ -// llgo:link (*Context).AggregateCount C.sqlite3_aggregate_count -func (recv_ *Context) AggregateCount() c.Int { - return 0 -} - -// llgo:link (*Stmt).Expired C.sqlite3_expired -func (recv_ *Stmt) Expired() c.Int { - return 0 -} - -// llgo:link (*Stmt).TransferBindings C.sqlite3_transfer_bindings -func (recv_ *Stmt) TransferBindings(*Stmt) c.Int { - return 0 -} - -//go:linkname GlobalRecover C.sqlite3_global_recover -func GlobalRecover() c.Int - -//go:linkname ThreadCleanup C.sqlite3_thread_cleanup -func ThreadCleanup() - -//go:linkname MemoryAlarm C.sqlite3_memory_alarm -func MemoryAlarm(func(c.Pointer, Int64, c.Int), c.Pointer, Int64) c.Int - -/* -** CAPI3REF: Obtaining SQL Values -** METHOD: sqlite3_value -** -** Summary: -**
-**
sqlite3_value_blobBLOB value -**
sqlite3_value_doubleREAL value -**
sqlite3_value_int32-bit INTEGER value -**
sqlite3_value_int6464-bit INTEGER value -**
sqlite3_value_pointerPointer value -**
sqlite3_value_textUTF-8 TEXT value -**
sqlite3_value_text16UTF-16 TEXT value in -** the native byteorder -**
sqlite3_value_text16beUTF-16be TEXT value -**
sqlite3_value_text16leUTF-16le TEXT value -**
    -**
sqlite3_value_bytesSize of a BLOB -** or a UTF-8 TEXT in bytes -**
sqlite3_value_bytes16   -** →  Size of UTF-16 -** TEXT in bytes -**
sqlite3_value_typeDefault -** datatype of the value -**
sqlite3_value_numeric_type   -** →  Best numeric datatype of the value -**
sqlite3_value_nochange   -** →  True if the column is unchanged in an UPDATE -** against a virtual table. -**
sqlite3_value_frombind   -** →  True if value originated from a [bound parameter] -**
-** -** Details: -** -** These routines extract type, size, and content information from -** [protected sqlite3_value] objects. Protected sqlite3_value objects -** are used to pass parameter information into the functions that -** implement [application-defined SQL functions] and [virtual tables]. -** -** These routines work only with [protected sqlite3_value] objects. -** Any attempt to use these routines on an [unprotected sqlite3_value] -** is not threadsafe. -** -** ^These routines work just like the corresponding [column access functions] -** except that these routines take a single [protected sqlite3_value] object -** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. -** -** ^The sqlite3_value_text16() interface extracts a UTF-16 string -** in the native byte-order of the host machine. ^The -** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces -** extract UTF-16 strings as big-endian and little-endian respectively. -** -** ^If [sqlite3_value] object V was initialized -** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)] -** and if X and Y are strings that compare equal according to strcmp(X,Y), -** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise, -** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer() -** routine is part of the [pointer passing interface] added for SQLite 3.20.0. -** -** ^(The sqlite3_value_type(V) interface returns the -** [SQLITE_INTEGER | datatype code] for the initial datatype of the -** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER], -** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^ -** Other interfaces might change the datatype for an sqlite3_value object. -** For example, if the datatype is initially SQLITE_INTEGER and -** sqlite3_value_text(V) is called to extract a text value for that -** integer, then subsequent calls to sqlite3_value_type(V) might return -** SQLITE_TEXT. Whether or not a persistent internal datatype conversion -** occurs is undefined and may change from one release of SQLite to the next. -** -** ^(The sqlite3_value_numeric_type() interface attempts to apply -** numeric affinity to the value. This means that an attempt is -** made to convert the value to an integer or floating point. If -** such a conversion is possible without loss of information (in other -** words, if the value is a string that looks like a number) -** then the conversion is performed. Otherwise no conversion occurs. -** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ -** -** ^Within the [xUpdate] method of a [virtual table], the -** sqlite3_value_nochange(X) interface returns true if and only if -** the column corresponding to X is unchanged by the UPDATE operation -** that the xUpdate method call was invoked to implement and if -** and the prior [xColumn] method call that was invoked to extracted -** the value for that column returned without setting a result (probably -** because it queried [sqlite3_vtab_nochange()] and found that the column -** was unchanging). ^Within an [xUpdate] method, any value for which -** sqlite3_value_nochange(X) is true will in all other respects appear -** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other -** than within an [xUpdate] method call for an UPDATE statement, then -** the return value is arbitrary and meaningless. -** -** ^The sqlite3_value_frombind(X) interface returns non-zero if the -** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()] -** interfaces. ^If X comes from an SQL literal value, or a table column, -** or an expression, then sqlite3_value_frombind(X) returns zero. -** -** Please pay particular attention to the fact that the pointer returned -** from [sqlite3_value_blob()], [sqlite3_value_text()], or -** [sqlite3_value_text16()] can be invalidated by a subsequent call to -** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], -** or [sqlite3_value_text16()]. -** -** These routines must be called from the same thread as -** the SQL function that supplied the [sqlite3_value*] parameters. -** -** As long as the input parameter is correct, these routines can only -** fail if an out-of-memory error occurs during a format conversion. -** Only the following subset of interfaces are subject to out-of-memory -** errors: -** -**
    -**
  • sqlite3_value_blob() -**
  • sqlite3_value_text() -**
  • sqlite3_value_text16() -**
  • sqlite3_value_text16le() -**
  • sqlite3_value_text16be() -**
  • sqlite3_value_bytes() -**
  • sqlite3_value_bytes16() -**
-** -** If an out-of-memory error occurs, then the return value from these -** routines is the same as if the column had contained an SQL NULL value. -** Valid SQL NULL returns can be distinguished from out-of-memory errors -** by invoking the [sqlite3_errcode()] immediately after the suspect -** return value is obtained and before any -** other SQLite interface is called on the same [database connection]. - */ -// llgo:link (*Value).ValueBlob C.sqlite3_value_blob -func (recv_ *Value) ValueBlob() c.Pointer { - return nil -} - -// llgo:link (*Value).ValueDouble C.sqlite3_value_double -func (recv_ *Value) ValueDouble() c.Double { - return 0 -} - -// llgo:link (*Value).ValueInt C.sqlite3_value_int -func (recv_ *Value) ValueInt() c.Int { - return 0 -} - -// llgo:link (*Value).ValueInt64 C.sqlite3_value_int64 -func (recv_ *Value) ValueInt64() Int64 { - return 0 -} - -// llgo:link (*Value).ValuePointer C.sqlite3_value_pointer -func (recv_ *Value) ValuePointer(*c.Char) c.Pointer { - return nil -} - -// llgo:link (*Value).ValueText C.sqlite3_value_text -func (recv_ *Value) ValueText() *c.Char { - return nil -} - -// llgo:link (*Value).ValueText16 C.sqlite3_value_text16 -func (recv_ *Value) ValueText16() c.Pointer { - return nil -} - -// llgo:link (*Value).ValueText16le C.sqlite3_value_text16le -func (recv_ *Value) ValueText16le() c.Pointer { - return nil -} - -// llgo:link (*Value).ValueText16be C.sqlite3_value_text16be -func (recv_ *Value) ValueText16be() c.Pointer { - return nil -} - -// llgo:link (*Value).ValueBytes C.sqlite3_value_bytes -func (recv_ *Value) ValueBytes() c.Int { - return 0 -} - -// llgo:link (*Value).ValueBytes16 C.sqlite3_value_bytes16 -func (recv_ *Value) ValueBytes16() c.Int { - return 0 -} - -// llgo:link (*Value).ValueType C.sqlite3_value_type -func (recv_ *Value) ValueType() c.Int { - return 0 -} - -// llgo:link (*Value).ValueNumericType C.sqlite3_value_numeric_type -func (recv_ *Value) ValueNumericType() c.Int { - return 0 -} - -// llgo:link (*Value).ValueNochange C.sqlite3_value_nochange -func (recv_ *Value) ValueNochange() c.Int { - return 0 -} - -// llgo:link (*Value).ValueFrombind C.sqlite3_value_frombind -func (recv_ *Value) ValueFrombind() c.Int { - return 0 -} - -/* -** CAPI3REF: Report the internal text encoding state of an sqlite3_value object -** METHOD: sqlite3_value -** -** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8], -** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current text encoding -** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X) -** returns something other than SQLITE_TEXT, then the return value from -** sqlite3_value_encoding(X) is meaningless. ^Calls to -** [sqlite3_value_text(X)], [sqlite3_value_text16(X)], [sqlite3_value_text16be(X)], -** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or -** [sqlite3_value_bytes16(X)] might change the encoding of the value X and -** thus change the return from subsequent calls to sqlite3_value_encoding(X). -** -** This routine is intended for used by applications that test and validate -** the SQLite implementation. This routine is inquiring about the opaque -** internal state of an [sqlite3_value] object. Ordinary applications should -** not need to know what the internal state of an sqlite3_value object is and -** hence should not need to use this interface. - */ -// llgo:link (*Value).ValueEncoding C.sqlite3_value_encoding -func (recv_ *Value) ValueEncoding() c.Int { - return 0 -} - -/* -** CAPI3REF: Finding The Subtype Of SQL Values -** METHOD: sqlite3_value -** -** The sqlite3_value_subtype(V) function returns the subtype for -** an [application-defined SQL function] argument V. The subtype -** information can be used to pass a limited amount of context from -** one SQL function to another. Use the [sqlite3_result_subtype()] -** routine to set the subtype for the return value of an SQL function. -** -** Every [application-defined SQL function] that invokes this interface -** should include the [SQLITE_SUBTYPE] property in the text -** encoding argument when the function is [sqlite3_create_function|registered]. -** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype() -** might return zero instead of the upstream subtype in some corner cases. - */ -// llgo:link (*Value).ValueSubtype C.sqlite3_value_subtype -func (recv_ *Value) ValueSubtype() c.Uint { - return 0 -} - -/* -** CAPI3REF: Copy And Free SQL Values -** METHOD: sqlite3_value -** -** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value] -** object D and returns a pointer to that copy. ^The [sqlite3_value] returned -** is a [protected sqlite3_value] object even if the input is not. -** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a -** memory allocation fails. ^If V is a [pointer value], then the result -** of sqlite3_value_dup(V) is a NULL value. -** -** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object -** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer -** then sqlite3_value_free(V) is a harmless no-op. - */ -// llgo:link (*Value).ValueDup C.sqlite3_value_dup -func (recv_ *Value) ValueDup() *Value { - return nil -} - -// llgo:link (*Value).ValueFree C.sqlite3_value_free -func (recv_ *Value) ValueFree() { -} - -/* -** CAPI3REF: Obtain Aggregate Function Context -** METHOD: sqlite3_context -** -** Implementations of aggregate SQL functions use this -** routine to allocate memory for storing their state. -** -** ^The first time the sqlite3_aggregate_context(C,N) routine is called -** for a particular aggregate function, SQLite allocates -** N bytes of memory, zeroes out that memory, and returns a pointer -** to the new memory. ^On second and subsequent calls to -** sqlite3_aggregate_context() for the same aggregate function instance, -** the same buffer is returned. Sqlite3_aggregate_context() is normally -** called once for each invocation of the xStep callback and then one -** last time when the xFinal callback is invoked. ^(When no rows match -** an aggregate query, the xStep() callback of the aggregate function -** implementation is never called and xFinal() is called exactly once. -** In those cases, sqlite3_aggregate_context() might be called for the -** first time from within xFinal().)^ -** -** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer -** when first called if N is less than or equal to zero or if a memory -** allocation error occurs. -** -** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is -** determined by the N parameter on first successful call. Changing the -** value of N in any subsequent call to sqlite3_aggregate_context() within -** the same aggregate function instance will not resize the memory -** allocation.)^ Within the xFinal callback, it is customary to set -** N=0 in calls to sqlite3_aggregate_context(C,N) so that no -** pointless memory allocations occur. -** -** ^SQLite automatically frees the memory allocated by -** sqlite3_aggregate_context() when the aggregate query concludes. -** -** The first parameter must be a copy of the -** [sqlite3_context | SQL function context] that is the first parameter -** to the xStep or xFinal callback routine that implements the aggregate -** function. -** -** This routine must be called from the same thread in which -** the aggregate SQL function is running. - */ -// llgo:link (*Context).AggregateContext C.sqlite3_aggregate_context -func (recv_ *Context) AggregateContext(nBytes c.Int) c.Pointer { - return nil -} - -/* -** CAPI3REF: User Data For Functions -** METHOD: sqlite3_context -** -** ^The sqlite3_user_data() interface returns a copy of -** the pointer that was the pUserData parameter (the 5th parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally -** registered the application defined function. -** -** This routine must be called from the same thread in which -** the application-defined function is running. - */ -// llgo:link (*Context).UserData C.sqlite3_user_data -func (recv_ *Context) UserData() c.Pointer { - return nil -} - -/* -** CAPI3REF: Database Connection For Functions -** METHOD: sqlite3_context -** -** ^The sqlite3_context_db_handle() interface returns a copy of -** the pointer to the [database connection] (the 1st parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally -** registered the application defined function. - */ -// llgo:link (*Context).ContextDbHandle C.sqlite3_context_db_handle -func (recv_ *Context) ContextDbHandle() *Sqlite3 { - return nil -} - -/* -** CAPI3REF: Function Auxiliary Data -** METHOD: sqlite3_context -** -** These functions may be used by (non-aggregate) SQL functions to -** associate auxiliary data with argument values. If the same argument -** value is passed to multiple invocations of the same SQL function during -** query execution, under some circumstances the associated auxiliary data -** might be preserved. An example of where this might be useful is in a -** regular-expression matching function. The compiled version of the regular -** expression can be stored as auxiliary data associated with the pattern string. -** Then as long as the pattern string remains the same, -** the compiled regular expression can be reused on multiple -** invocations of the same function. -** -** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data -** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument -** value to the application-defined function. ^N is zero for the left-most -** function argument. ^If there is no auxiliary data -** associated with the function argument, the sqlite3_get_auxdata(C,N) interface -** returns a NULL pointer. -** -** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the -** N-th argument of the application-defined function. ^Subsequent -** calls to sqlite3_get_auxdata(C,N) return P from the most recent -** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or -** NULL if the auxiliary data has been discarded. -** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, -** SQLite will invoke the destructor function X with parameter P exactly -** once, when the auxiliary data is discarded. -** SQLite is free to discard the auxiliary data at any time, including:
    -**
  • ^(when the corresponding function parameter changes)^, or -**
  • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement)^, or -**
  • ^(when sqlite3_set_auxdata() is invoked again on the same -** parameter)^, or -**
  • ^(during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.)^ -**
  • ^(during the original sqlite3_set_auxdata() call if the function -** is evaluated during query planning instead of during query execution, -** as sometimes happens with [SQLITE_ENABLE_STAT4].)^
-** -** Note the last two bullets in particular. The destructor X in -** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the -** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() -** should be called near the end of the function implementation and the -** function implementation should not make any use of P after -** sqlite3_set_auxdata() has been called. Furthermore, a call to -** sqlite3_get_auxdata() that occurs immediately after a corresponding call -** to sqlite3_set_auxdata() might still return NULL if an out-of-memory -** condition occurred during the sqlite3_set_auxdata() call or if the -** function is being evaluated during query planning rather than during -** query execution. -** -** ^(In practice, auxiliary data is preserved between function calls for -** function parameters that are compile-time constants, including literal -** values and [parameters] and expressions composed from the same.)^ -** -** The value of the N parameter to these interfaces should be non-negative. -** Future enhancements may make use of negative N values to define new -** kinds of function caching behavior. -** -** These routines must be called from the same thread in which -** the SQL function is running. -** -** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()]. - */ -// llgo:link (*Context).GetAuxdata C.sqlite3_get_auxdata -func (recv_ *Context) GetAuxdata(N c.Int) c.Pointer { - return nil -} - -// llgo:link (*Context).SetAuxdata C.sqlite3_set_auxdata -func (recv_ *Context) SetAuxdata(N c.Int, __llgo_arg_1 c.Pointer, __llgo_arg_2 func(c.Pointer)) { -} - -/* -** CAPI3REF: Database Connection Client Data -** METHOD: sqlite3 -** -** These functions are used to associate one or more named pointers -** with a [database connection]. -** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P -** to be attached to [database connection] D using name N. Subsequent -** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P -** or a NULL pointer if there were no prior calls to -** sqlite3_set_clientdata() with the same values of D and N. -** Names are compared using strcmp() and are thus case sensitive. -** -** If P and X are both non-NULL, then the destructor X is invoked with -** argument P on the first of the following occurrences: -**
    -**
  • An out-of-memory error occurs during the call to -** sqlite3_set_clientdata() which attempts to register pointer P. -**
  • A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made -** with the same D and N parameters. -**
  • The database connection closes. SQLite does not make any guarantees -** about the order in which destructors are called, only that all -** destructors will be called exactly once at some point during the -** database connection closing process. -**
-** -** SQLite does not do anything with client data other than invoke -** destructors on the client data at the appropriate time. The intended -** use for client data is to provide a mechanism for wrapper libraries -** to store additional information about an SQLite database connection. -** -** There is no limit (other than available memory) on the number of different -** client data pointers (with different names) that can be attached to a -** single database connection. However, the implementation is optimized -** for the case of having only one or two different client data names. -** Applications and wrapper libraries are discouraged from using more than -** one client data name each. -** -** There is no way to enumerate the client data pointers -** associated with a database connection. The N parameter can be thought -** of as a secret key such that only code that knows the secret key is able -** to access the associated data. -** -** Security Warning: These interfaces should not be exposed in scripting -** languages or in other circumstances where it might be possible for an -** an attacker to invoke them. Any agent that can invoke these interfaces -** can probably also take control of the process. -** -** Database connection client data is only available for SQLite -** version 3.44.0 ([dateof:3.44.0]) and later. -** -** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()]. - */ -// llgo:link (*Sqlite3).GetClientdata C.sqlite3_get_clientdata -func (recv_ *Sqlite3) GetClientdata(*c.Char) c.Pointer { - return nil -} - -// llgo:link (*Sqlite3).SetClientdata C.sqlite3_set_clientdata -func (recv_ *Sqlite3) SetClientdata(*c.Char, c.Pointer, func(c.Pointer)) c.Int { - return 0 -} - -// llgo:type C -type DestructorType func(c.Pointer) - -/* -** CAPI3REF: Setting The Result Of An SQL Function -** METHOD: sqlite3_context -** -** These routines are used by the xFunc or xFinal callbacks that -** implement SQL functions and aggregates. See -** [sqlite3_create_function()] and [sqlite3_create_function16()] -** for additional information. -** -** These functions work very much like the [parameter binding] family of -** functions used to bind values to host parameters in prepared statements. -** Refer to the [SQL parameter] documentation for additional information. -** -** ^The sqlite3_result_blob() interface sets the result from -** an application-defined function to be the BLOB whose content is pointed -** to by the second parameter and which is N bytes long where N is the -** third parameter. -** -** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N) -** interfaces set the result of the application-defined function to be -** a BLOB containing all zero bytes and N bytes in size. -** -** ^The sqlite3_result_double() interface sets the result from -** an application-defined function to be a floating point value specified -** by its 2nd argument. -** -** ^The sqlite3_result_error() and sqlite3_result_error16() functions -** cause the implemented SQL function to throw an exception. -** ^SQLite uses the string pointed to by the -** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() -** as the text of an error message. ^SQLite interprets the error -** message string from sqlite3_result_error() as UTF-8. ^SQLite -** interprets the string from sqlite3_result_error16() as UTF-16 using -** the same [byte-order determination rules] as [sqlite3_bind_text16()]. -** ^If the third parameter to sqlite3_result_error() -** or sqlite3_result_error16() is negative then SQLite takes as the error -** message all text up through the first zero character. -** ^If the third parameter to sqlite3_result_error() or -** sqlite3_result_error16() is non-negative then SQLite takes that many -** bytes (not characters) from the 2nd parameter as the error message. -** ^The sqlite3_result_error() and sqlite3_result_error16() -** routines make a private copy of the error message text before -** they return. Hence, the calling function can deallocate or -** modify the text after they return without harm. -** ^The sqlite3_result_error_code() function changes the error code -** returned by SQLite as a result of an error in a function. ^By default, -** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() -** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. -** -** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an -** error indicating that a string or BLOB is too long to represent. -** -** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an -** error indicating that a memory allocation failed. -** -** ^The sqlite3_result_int() interface sets the return value -** of the application-defined function to be the 32-bit signed integer -** value given in the 2nd argument. -** ^The sqlite3_result_int64() interface sets the return value -** of the application-defined function to be the 64-bit signed integer -** value given in the 2nd argument. -** -** ^The sqlite3_result_null() interface sets the return value -** of the application-defined function to be NULL. -** -** ^The sqlite3_result_text(), sqlite3_result_text16(), -** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces -** set the return value of the application-defined function to be -** a text string which is represented as UTF-8, UTF-16 native byte order, -** UTF-16 little endian, or UTF-16 big endian, respectively. -** ^The sqlite3_result_text64() interface sets the return value of an -** application-defined function to be a text string in an encoding -** specified by the fifth (and last) parameter, which must be one -** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]. -** ^SQLite takes the text result from the application from -** the 2nd parameter of the sqlite3_result_text* interfaces. -** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces -** other than sqlite3_result_text64() is negative, then SQLite computes -** the string length itself by searching the 2nd parameter for the first -** zero character. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces -** is non-negative, then as many bytes (not characters) of the text -** pointed to by the 2nd parameter are taken as the application-defined -** function result. If the 3rd parameter is non-negative, then it -** must be the byte offset into the string where the NUL terminator would -** appear if the string where NUL terminated. If any NUL characters occur -** in the string at a byte offset that is less than the value of the 3rd -** parameter, then the resulting string will contain embedded NULs and the -** result of expressions operating on strings with embedded NULs is undefined. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that -** function as the destructor on the text or BLOB result when it has -** finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces or to -** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite -** assumes that the text or BLOB result is in constant space and does not -** copy the content of the parameter nor call a destructor on the content -** when it has finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT -** then SQLite makes a copy of the result into space obtained -** from [sqlite3_malloc()] before it returns. -** -** ^For the sqlite3_result_text16(), sqlite3_result_text16le(), and -** sqlite3_result_text16be() routines, and for sqlite3_result_text64() -** when the encoding is not UTF8, if the input UTF16 begins with a -** byte-order mark (BOM, U+FEFF) then the BOM is removed from the -** string and the rest of the string is interpreted according to the -** byte-order specified by the BOM. ^The byte-order specified by -** the BOM at the beginning of the text overrides the byte-order -** specified by the interface procedure. ^So, for example, if -** sqlite3_result_text16le() is invoked with text that begins -** with bytes 0xfe, 0xff (a big-endian byte-order mark) then the -** first two bytes of input are skipped and the remaining input -** is interpreted as UTF16BE text. -** -** ^For UTF16 input text to the sqlite3_result_text16(), -** sqlite3_result_text16be(), sqlite3_result_text16le(), and -** sqlite3_result_text64() routines, if the text contains invalid -** UTF16 characters, the invalid characters might be converted -** into the unicode replacement character, U+FFFD. -** -** ^The sqlite3_result_value() interface sets the result of -** the application-defined function to be a copy of the -** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The -** sqlite3_result_value() interface makes a copy of the [sqlite3_value] -** so that the [sqlite3_value] specified in the parameter may change or -** be deallocated after sqlite3_result_value() returns without harm. -** ^A [protected sqlite3_value] object may always be used where an -** [unprotected sqlite3_value] object is required, so either -** kind of [sqlite3_value] object can be used with this interface. -** -** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an -** SQL NULL value, just like [sqlite3_result_null(C)], except that it -** also associates the host-language pointer P or type T with that -** NULL value such that the pointer can be retrieved within an -** [application-defined SQL function] using [sqlite3_value_pointer()]. -** ^If the D parameter is not NULL, then it is a pointer to a destructor -** for the P parameter. ^SQLite invokes D with P as its only argument -** when SQLite is finished with P. The T parameter should be a static -** string and preferably a string literal. The sqlite3_result_pointer() -** routine is part of the [pointer passing interface] added for SQLite 3.20.0. -** -** If these routines are called from within the different thread -** than the one containing the application-defined function that received -** the [sqlite3_context] pointer, the results are undefined. - */ -// llgo:link (*Context).ResultBlob C.sqlite3_result_blob -func (recv_ *Context) ResultBlob(c.Pointer, c.Int, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultBlob64 C.sqlite3_result_blob64 -func (recv_ *Context) ResultBlob64(c.Pointer, Uint64, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultDouble C.sqlite3_result_double -func (recv_ *Context) ResultDouble(c.Double) { -} - -// llgo:link (*Context).ResultError C.sqlite3_result_error -func (recv_ *Context) ResultError(*c.Char, c.Int) { -} - -// llgo:link (*Context).ResultError16 C.sqlite3_result_error16 -func (recv_ *Context) ResultError16(c.Pointer, c.Int) { -} - -// llgo:link (*Context).ResultErrorToobig C.sqlite3_result_error_toobig -func (recv_ *Context) ResultErrorToobig() { -} - -// llgo:link (*Context).ResultErrorNomem C.sqlite3_result_error_nomem -func (recv_ *Context) ResultErrorNomem() { -} - -// llgo:link (*Context).ResultErrorCode C.sqlite3_result_error_code -func (recv_ *Context) ResultErrorCode(c.Int) { -} - -// llgo:link (*Context).ResultInt C.sqlite3_result_int -func (recv_ *Context) ResultInt(c.Int) { -} - -// llgo:link (*Context).ResultInt64 C.sqlite3_result_int64 -func (recv_ *Context) ResultInt64(Int64) { -} - -// llgo:link (*Context).ResultNull C.sqlite3_result_null -func (recv_ *Context) ResultNull() { -} - -// llgo:link (*Context).ResultText C.sqlite3_result_text -func (recv_ *Context) ResultText(*c.Char, c.Int, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultText64 C.sqlite3_result_text64 -func (recv_ *Context) ResultText64(__llgo_arg_0 *c.Char, __llgo_arg_1 Uint64, __llgo_arg_2 func(c.Pointer), encoding c.Char) { -} - -// llgo:link (*Context).ResultText16 C.sqlite3_result_text16 -func (recv_ *Context) ResultText16(c.Pointer, c.Int, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultText16le C.sqlite3_result_text16le -func (recv_ *Context) ResultText16le(c.Pointer, c.Int, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultText16be C.sqlite3_result_text16be -func (recv_ *Context) ResultText16be(c.Pointer, c.Int, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultValue C.sqlite3_result_value -func (recv_ *Context) ResultValue(*Value) { -} - -// llgo:link (*Context).ResultPointer C.sqlite3_result_pointer -func (recv_ *Context) ResultPointer(c.Pointer, *c.Char, func(c.Pointer)) { -} - -// llgo:link (*Context).ResultZeroblob C.sqlite3_result_zeroblob -func (recv_ *Context) ResultZeroblob(n c.Int) { -} - -// llgo:link (*Context).ResultZeroblob64 C.sqlite3_result_zeroblob64 -func (recv_ *Context) ResultZeroblob64(n Uint64) c.Int { - return 0 -} - -/* -** CAPI3REF: Setting The Subtype Of An SQL Function -** METHOD: sqlite3_context -** -** The sqlite3_result_subtype(C,T) function causes the subtype of -** the result from the [application-defined SQL function] with -** [sqlite3_context] C to be the value T. Only the lower 8 bits -** of the subtype T are preserved in current versions of SQLite; -** higher order bits are discarded. -** The number of subtype bytes preserved by SQLite might increase -** in future releases of SQLite. -** -** Every [application-defined SQL function] that invokes this interface -** should include the [SQLITE_RESULT_SUBTYPE] property in its -** text encoding argument when the SQL function is -** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE] -** property is omitted from the function that invokes sqlite3_result_subtype(), -** then in some cases the sqlite3_result_subtype() might fail to set -** the result subtype. -** -** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any -** SQL function that invokes the sqlite3_result_subtype() interface -** and that does not have the SQLITE_RESULT_SUBTYPE property will raise -** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1 -** by default. - */ -// llgo:link (*Context).ResultSubtype C.sqlite3_result_subtype -func (recv_ *Context) ResultSubtype(c.Uint) { -} - -/* -** CAPI3REF: Define New Collating Sequences -** METHOD: sqlite3 -** -** ^These functions add, remove, or modify a [collation] associated -** with the [database connection] specified as the first argument. -** -** ^The name of the collation is a UTF-8 string -** for sqlite3_create_collation() and sqlite3_create_collation_v2() -** and a UTF-16 string in native byte order for sqlite3_create_collation16(). -** ^Collation names that compare equal according to [sqlite3_strnicmp()] are -** considered to be the same name. -** -** ^(The third argument (eTextRep) must be one of the constants: -**
    -**
  • [SQLITE_UTF8], -**
  • [SQLITE_UTF16LE], -**
  • [SQLITE_UTF16BE], -**
  • [SQLITE_UTF16], or -**
  • [SQLITE_UTF16_ALIGNED]. -**
)^ -** ^The eTextRep argument determines the encoding of strings passed -** to the collating function callback, xCompare. -** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep -** force strings to be UTF16 with native byte order. -** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin -** on an even byte address. -** -** ^The fourth argument, pArg, is an application data pointer that is passed -** through as the first argument to the collating function callback. -** -** ^The fifth argument, xCompare, is a pointer to the collating function. -** ^Multiple collating functions can be registered using the same name but -** with different eTextRep parameters and SQLite will use whichever -** function requires the least amount of data transformation. -** ^If the xCompare argument is NULL then the collating function is -** deleted. ^When all collating functions having the same name are deleted, -** that collation is no longer usable. -** -** ^The collating function callback is invoked with a copy of the pArg -** application data pointer and with two strings in the encoding specified -** by the eTextRep argument. The two integer parameters to the collating -** function callback are the length of the two strings, in bytes. The collating -** function must return an integer that is negative, zero, or positive -** if the first string is less than, equal to, or greater than the second, -** respectively. A collating function must always return the same answer -** given the same inputs. If two or more collating functions are registered -** to the same collation name (using different eTextRep values) then all -** must give an equivalent answer when invoked with equivalent strings. -** The collating function must obey the following properties for all -** strings A, B, and C: -** -**
    -**
  1. If A==B then B==A. -**
  2. If A==B and B==C then A==C. -**
  3. If A<B THEN B>A. -**
  4. If A<B and B<C then A<C. -**
-** -** If a collating function fails any of the above constraints and that -** collating function is registered and used, then the behavior of SQLite -** is undefined. -** -** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() -** with the addition that the xDestroy callback is invoked on pArg when -** the collating function is deleted. -** ^Collating functions are deleted when they are overridden by later -** calls to the collation creation functions or when the -** [database connection] is closed using [sqlite3_close()]. -** -** ^The xDestroy callback is not called if the -** sqlite3_create_collation_v2() function fails. Applications that invoke -** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should -** check the return code and dispose of the application data pointer -** themselves rather than expecting SQLite to deal with it for them. -** This is different from every other SQLite interface. The inconsistency -** is unfortunate but cannot be changed without breaking backwards -** compatibility. -** -** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. - */ -// llgo:link (*Sqlite3).CreateCollation C.sqlite3_create_collation -func (recv_ *Sqlite3) CreateCollation(zName *c.Char, eTextRep c.Int, pArg c.Pointer, xCompare func(c.Pointer, c.Int, c.Pointer, c.Int, c.Pointer) c.Int) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CreateCollationV2 C.sqlite3_create_collation_v2 -func (recv_ *Sqlite3) CreateCollationV2(zName *c.Char, eTextRep c.Int, pArg c.Pointer, xCompare func(c.Pointer, c.Int, c.Pointer, c.Int, c.Pointer) c.Int, xDestroy func(c.Pointer)) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CreateCollation16 C.sqlite3_create_collation16 -func (recv_ *Sqlite3) CreateCollation16(zName c.Pointer, eTextRep c.Int, pArg c.Pointer, xCompare func(c.Pointer, c.Int, c.Pointer, c.Int, c.Pointer) c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Collation Needed Callbacks -** METHOD: sqlite3 -** -** ^To avoid having to register all collation sequences before a database -** can be used, a single callback function may be registered with the -** [database connection] to be invoked whenever an undefined collation -** sequence is required. -** -** ^If the function is registered using the sqlite3_collation_needed() API, -** then it is passed the names of undefined collation sequences as strings -** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, -** the names are passed as UTF-16 in machine native byte order. -** ^A call to either function replaces the existing collation-needed callback. -** -** ^(When the callback is invoked, the first argument passed is a copy -** of the second argument to sqlite3_collation_needed() or -** sqlite3_collation_needed16(). The second argument is the database -** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], -** or [SQLITE_UTF16LE], indicating the most desirable form of the collation -** sequence function required. The fourth parameter is the name of the -** required collation sequence.)^ -** -** The callback function should register the desired collation using -** [sqlite3_create_collation()], [sqlite3_create_collation16()], or -** [sqlite3_create_collation_v2()]. - */ -// llgo:link (*Sqlite3).CollationNeeded C.sqlite3_collation_needed -func (recv_ *Sqlite3) CollationNeeded(c.Pointer, func(c.Pointer, *Sqlite3, c.Int, *c.Char)) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CollationNeeded16 C.sqlite3_collation_needed16 -func (recv_ *Sqlite3) CollationNeeded16(c.Pointer, func(c.Pointer, *Sqlite3, c.Int, c.Pointer)) c.Int { - return 0 -} - -/* -** CAPI3REF: Suspend Execution For A Short Time -** -** The sqlite3_sleep() function causes the current thread to suspend execution -** for at least a number of milliseconds specified in its parameter. -** -** If the operating system does not support sleep requests with -** millisecond time resolution, then the time will be rounded up to -** the nearest second. The number of milliseconds of sleep actually -** requested from the operating system is returned. -** -** ^SQLite implements this interface by calling the xSleep() -** method of the default [sqlite3_vfs] object. If the xSleep() method -** of the default VFS is not implemented correctly, or not implemented at -** all, then the behavior of sqlite3_sleep() may deviate from the description -** in the previous paragraphs. -** -** If a negative argument is passed to sqlite3_sleep() the results vary by -** VFS and operating system. Some system treat a negative argument as an -** instruction to sleep forever. Others understand it to mean do not sleep -** at all. ^In SQLite version 3.42.0 and later, a negative -** argument passed into sqlite3_sleep() is changed to zero before it is relayed -** down into the xSleep method of the VFS. - */ -//go:linkname Sleep C.sqlite3_sleep -func Sleep(c.Int) c.Int - -/* -** CAPI3REF: Test For Auto-Commit Mode -** KEYWORDS: {autocommit mode} -** METHOD: sqlite3 -** -** ^The sqlite3_get_autocommit() interface returns non-zero or -** zero if the given database connection is or is not in autocommit mode, -** respectively. ^Autocommit mode is on by default. -** ^Autocommit mode is disabled by a [BEGIN] statement. -** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. -** -** If certain kinds of errors occur on a statement within a multi-statement -** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], -** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the -** transaction might be rolled back automatically. The only way to -** find out whether SQLite automatically rolled back the transaction after -** an error is to use this function. -** -** If another thread changes the autocommit status of the database -** connection while this routine is running, then the return value -** is undefined. - */ -// llgo:link (*Sqlite3).GetAutocommit C.sqlite3_get_autocommit -func (recv_ *Sqlite3) GetAutocommit() c.Int { - return 0 -} - -/* -** CAPI3REF: Find The Database Handle Of A Prepared Statement -** METHOD: sqlite3_stmt -** -** ^The sqlite3_db_handle interface returns the [database connection] handle -** to which a [prepared statement] belongs. ^The [database connection] -** returned by sqlite3_db_handle is the same [database connection] -** that was the first argument -** to the [sqlite3_prepare_v2()] call (or its variants) that was used to -** create the statement in the first place. - */ -// llgo:link (*Stmt).DbHandle C.sqlite3_db_handle -func (recv_ *Stmt) DbHandle() *Sqlite3 { - return nil -} - -/* -** CAPI3REF: Return The Schema Name For A Database Connection -** METHOD: sqlite3 -** -** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name -** for the N-th database on database connection D, or a NULL pointer of N is -** out of range. An N value of 0 means the main database file. An N of 1 is -** the "temp" schema. Larger values of N correspond to various ATTACH-ed -** databases. -** -** Space to hold the string that is returned by sqlite3_db_name() is managed -** by SQLite itself. The string might be deallocated by any operation that -** changes the schema, including [ATTACH] or [DETACH] or calls to -** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that -** occur on a different thread. Applications that need to -** remember the string long-term should make their own copy. Applications that -** are accessing the same database connection simultaneously on multiple -** threads should mutex-protect calls to this API and should make their own -** private copy of the result prior to releasing the mutex. - */ -// llgo:link (*Sqlite3).DbName C.sqlite3_db_name -func (recv_ *Sqlite3) DbName(N c.Int) *c.Char { - return nil -} - -/* -** CAPI3REF: Return The Filename For A Database Connection -** METHOD: sqlite3 -** -** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename -** associated with database N of connection D. -** ^If there is no attached database N on the database -** connection D, or if database N is a temporary or in-memory database, then -** this function will return either a NULL pointer or an empty string. -** -** ^The string value returned by this routine is owned and managed by -** the database connection. ^The value will be valid until the database N -** is [DETACH]-ed or until the database connection closes. -** -** ^The filename returned by this function is the output of the -** xFullPathname method of the [VFS]. ^In other words, the filename -** will be an absolute pathname, even if the filename used -** to open the database originally was a URI or relative pathname. -** -** If the filename pointer returned by this routine is not NULL, then it -** can be used as the filename input parameter to these routines: -**
    -**
  • [sqlite3_uri_parameter()] -**
  • [sqlite3_uri_boolean()] -**
  • [sqlite3_uri_int64()] -**
  • [sqlite3_filename_database()] -**
  • [sqlite3_filename_journal()] -**
  • [sqlite3_filename_wal()] -**
- */ -// llgo:link (*Sqlite3).DbFilename C.sqlite3_db_filename -func (recv_ *Sqlite3) DbFilename(zDbName *c.Char) Filename { - return nil -} - -/* -** CAPI3REF: Determine if a database is read-only -** METHOD: sqlite3 -** -** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N -** of connection D is read-only, 0 if it is read/write, or -1 if N is not -** the name of a database on connection D. - */ -// llgo:link (*Sqlite3).DbReadonly C.sqlite3_db_readonly -func (recv_ *Sqlite3) DbReadonly(zDbName *c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Determine the transaction state of a database -** METHOD: sqlite3 -** -** ^The sqlite3_txn_state(D,S) interface returns the current -** [transaction state] of schema S in database connection D. ^If S is NULL, -** then the highest transaction state of any schema on database connection D -** is returned. Transaction states are (in order of lowest to highest): -**
    -**
  1. SQLITE_TXN_NONE -**
  2. SQLITE_TXN_READ -**
  3. SQLITE_TXN_WRITE -**
-** ^If the S argument to sqlite3_txn_state(D,S) is not the name of -** a valid schema, then -1 is returned. - */ -// llgo:link (*Sqlite3).TxnState C.sqlite3_txn_state -func (recv_ *Sqlite3) TxnState(zSchema *c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Find the next prepared statement -** METHOD: sqlite3 -** -** ^This interface returns a pointer to the next [prepared statement] after -** pStmt associated with the [database connection] pDb. ^If pStmt is NULL -** then this interface returns a pointer to the first prepared statement -** associated with the database connection pDb. ^If no prepared statement -** satisfies the conditions of this routine, it returns NULL. -** -** The [database connection] pointer D in a call to -** [sqlite3_next_stmt(D,S)] must refer to an open database -** connection and in particular must not be a NULL pointer. - */ -// llgo:link (*Sqlite3).NextStmt C.sqlite3_next_stmt -func (recv_ *Sqlite3) NextStmt(pStmt *Stmt) *Stmt { - return nil -} - -/* -** CAPI3REF: Commit And Rollback Notification Callbacks -** METHOD: sqlite3 -** -** ^The sqlite3_commit_hook() interface registers a callback -** function to be invoked whenever a transaction is [COMMIT | committed]. -** ^Any callback set by a previous call to sqlite3_commit_hook() -** for the same database connection is overridden. -** ^The sqlite3_rollback_hook() interface registers a callback -** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. -** ^Any callback set by a previous call to sqlite3_rollback_hook() -** for the same database connection is overridden. -** ^The pArg argument is passed through to the callback. -** ^If the callback on a commit hook function returns non-zero, -** then the commit is converted into a rollback. -** -** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions -** return the P argument from the previous call of the same function -** on the same [database connection] D, or NULL for -** the first call for each function on D. -** -** The commit and rollback hook callbacks are not reentrant. -** The callback implementation must not do anything that will modify -** the database connection that invoked the callback. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the commit -** or rollback hook in the first place. -** Note that running any other SQL statements, including SELECT statements, -** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify -** the database connections for the meaning of "modify" in this paragraph. -** -** ^Registering a NULL function disables the callback. -** -** ^When the commit hook callback routine returns zero, the [COMMIT] -** operation is allowed to continue normally. ^If the commit hook -** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. -** ^The rollback hook is invoked on a rollback that results from a commit -** hook returning non-zero, just as it would be with any other rollback. -** -** ^For the purposes of this API, a transaction is said to have been -** rolled back if an explicit "ROLLBACK" statement is executed, or -** an error or constraint causes an implicit rollback to occur. -** ^The rollback callback is not invoked if a transaction is -** automatically rolled back because the database connection is closed. -** -** See also the [sqlite3_update_hook()] interface. - */ -// llgo:link (*Sqlite3).CommitHook C.sqlite3_commit_hook -func (recv_ *Sqlite3) CommitHook(func(c.Pointer) c.Int, c.Pointer) c.Pointer { - return nil -} - -// llgo:link (*Sqlite3).RollbackHook C.sqlite3_rollback_hook -func (recv_ *Sqlite3) RollbackHook(func(c.Pointer), c.Pointer) c.Pointer { - return nil -} - -/* -** CAPI3REF: Autovacuum Compaction Amount Callback -** METHOD: sqlite3 -** -** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback -** function C that is invoked prior to each autovacuum of the database -** file. ^The callback is passed a copy of the generic data pointer (P), -** the schema-name of the attached database that is being autovacuumed, -** the size of the database file in pages, the number of free pages, -** and the number of bytes per page, respectively. The callback should -** return the number of free pages that should be removed by the -** autovacuum. ^If the callback returns zero, then no autovacuum happens. -** ^If the value returned is greater than or equal to the number of -** free pages, then a complete autovacuum happens. -** -**

^If there are multiple ATTACH-ed database files that are being -** modified as part of a transaction commit, then the autovacuum pages -** callback is invoked separately for each file. -** -**

The callback is not reentrant. The callback function should -** not attempt to invoke any other SQLite interface. If it does, bad -** things may happen, including segmentation faults and corrupt database -** files. The callback function should be a simple function that -** does some arithmetic on its input parameters and returns a result. -** -** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional -** destructor for the P parameter. ^If X is not NULL, then X(P) is -** invoked whenever the database connection closes or when the callback -** is overwritten by another invocation of sqlite3_autovacuum_pages(). -** -**

^There is only one autovacuum pages callback per database connection. -** ^Each call to the sqlite3_autovacuum_pages() interface overrides all -** previous invocations for that database connection. ^If the callback -** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, -** then the autovacuum steps callback is canceled. The return value -** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might -** be some other error code if something goes wrong. The current -** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other -** return codes might be added in future releases. -** -**

If no autovacuum pages callback is specified (the usual case) or -** a NULL pointer is provided for the callback, -** then the default behavior is to vacuum all free pages. So, in other -** words, the default behavior is the same as if the callback function -** were something like this: -** -**

-**     unsigned int demonstration_autovac_pages_callback(
-**       void *pClientData,
-**       const char *zSchema,
-**       unsigned int nDbPage,
-**       unsigned int nFreePage,
-**       unsigned int nBytePerPage
-**     ){
-**       return nFreePage;
-**     }
-** 
- */ -// llgo:link (*Sqlite3).AutovacuumPages C.sqlite3_autovacuum_pages -func (recv_ *Sqlite3) AutovacuumPages(func(c.Pointer, *c.Char, c.Uint, c.Uint, c.Uint) c.Uint, c.Pointer, func(c.Pointer)) c.Int { - return 0 -} - -/* -** CAPI3REF: Data Change Notification Callbacks -** METHOD: sqlite3 -** -** ^The sqlite3_update_hook() interface registers a callback function -** with the [database connection] identified by the first argument -** to be invoked whenever a row is updated, inserted or deleted in -** a [rowid table]. -** ^Any callback set by a previous call to this function -** for the same database connection is overridden. -** -** ^The second argument is a pointer to the function to invoke when a -** row is updated, inserted or deleted in a rowid table. -** ^The first argument to the callback is a copy of the third argument -** to sqlite3_update_hook(). -** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], -** or [SQLITE_UPDATE], depending on the operation that caused the callback -** to be invoked. -** ^The third and fourth arguments to the callback contain pointers to the -** database and table name containing the affected row. -** ^The final callback parameter is the [rowid] of the row. -** ^In the case of an update, this is the [rowid] after the update takes place. -** -** ^(The update hook is not invoked when internal system tables are -** modified (i.e. sqlite_sequence).)^ -** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified. -** -** ^In the current implementation, the update hook -** is not invoked when conflicting rows are deleted because of an -** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook -** invoked when rows are deleted using the [truncate optimization]. -** The exceptions defined in this paragraph might change in a future -** release of SQLite. -** -** Whether the update hook is invoked before or after the -** corresponding change is currently unspecified and may differ -** depending on the type of change. Do not rely on the order of the -** hook call with regards to the final result of the operation which -** triggers the hook. -** -** The update hook implementation must not do anything that will modify -** the database connection that invoked the update hook. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the update hook. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** ^The sqlite3_update_hook(D,C,P) function -** returns the P argument from the previous call -** on the same [database connection] D, or NULL for -** the first call on D. -** -** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()], -** and [sqlite3_preupdate_hook()] interfaces. - */ -// llgo:link (*Sqlite3).UpdateHook C.sqlite3_update_hook -func (recv_ *Sqlite3) UpdateHook(func(c.Pointer, c.Int, *c.Char, *c.Char, Int64), c.Pointer) c.Pointer { - return nil -} - -/* -** CAPI3REF: Enable Or Disable Shared Pager Cache -** -** ^(This routine enables or disables the sharing of the database cache -** and schema data structures between [database connection | connections] -** to the same database. Sharing is enabled if the argument is true -** and disabled if the argument is false.)^ -** -** This interface is omitted if SQLite is compiled with -** [-DSQLITE_OMIT_SHARED_CACHE]. The [-DSQLITE_OMIT_SHARED_CACHE] -** compile-time option is recommended because the -** [use of shared cache mode is discouraged]. -** -** ^Cache sharing is enabled and disabled for an entire process. -** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). -** In prior versions of SQLite, -** sharing was enabled or disabled for each thread separately. -** -** ^(The cache sharing mode set by this interface effects all subsequent -** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. -** Existing database connections continue to use the sharing mode -** that was in effect at the time they were opened.)^ -** -** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled -** successfully. An [error code] is returned otherwise.)^ -** -** ^Shared cache is disabled by default. It is recommended that it stay -** that way. In other words, do not use this routine. This interface -** continues to be provided for historical compatibility, but its use is -** discouraged. Any use of shared cache is discouraged. If shared cache -** must be used, it is recommended that shared cache only be enabled for -** individual database connections using the [sqlite3_open_v2()] interface -** with the [SQLITE_OPEN_SHAREDCACHE] flag. -** -** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 -** and will always return SQLITE_MISUSE. On those systems, -** shared cache mode should be enabled per-database connection via -** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE]. -** -** This interface is threadsafe on processors where writing a -** 32-bit integer is atomic. -** -** See Also: [SQLite Shared-Cache Mode] - */ -//go:linkname EnableSharedCache C.sqlite3_enable_shared_cache -func EnableSharedCache(c.Int) c.Int - -/* -** CAPI3REF: Attempt To Free Heap Memory -** -** ^The sqlite3_release_memory() interface attempts to free N bytes -** of heap memory by deallocating non-essential memory allocations -** held by the database library. Memory used to cache database -** pages to improve performance is an example of non-essential memory. -** ^sqlite3_release_memory() returns the number of bytes actually freed, -** which might be more or less than the amount requested. -** ^The sqlite3_release_memory() routine is a no-op returning zero -** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. -** -** See also: [sqlite3_db_release_memory()] - */ -//go:linkname ReleaseMemory C.sqlite3_release_memory -func ReleaseMemory(c.Int) c.Int - -/* -** CAPI3REF: Free Memory Used By A Database Connection -** METHOD: sqlite3 -** -** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap -** memory as possible from database connection D. Unlike the -** [sqlite3_release_memory()] interface, this interface is in effect even -** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is -** omitted. -** -** See also: [sqlite3_release_memory()] - */ -// llgo:link (*Sqlite3).DbReleaseMemory C.sqlite3_db_release_memory -func (recv_ *Sqlite3) DbReleaseMemory() c.Int { - return 0 -} - -/* -** CAPI3REF: Impose A Limit On Heap Size -** -** These interfaces impose limits on the amount of heap memory that will be -** by all database connections within a single process. -** -** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the -** soft limit on the amount of heap memory that may be allocated by SQLite. -** ^SQLite strives to keep heap memory utilization below the soft heap -** limit by reducing the number of pages held in the page cache -** as heap memory usages approaches the limit. -** ^The soft heap limit is "soft" because even though SQLite strives to stay -** below the limit, it will exceed the limit rather than generate -** an [SQLITE_NOMEM] error. In other words, the soft heap limit -** is advisory only. -** -** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of -** N bytes on the amount of memory that will be allocated. ^The -** sqlite3_hard_heap_limit64(N) interface is similar to -** sqlite3_soft_heap_limit64(N) except that memory allocations will fail -** when the hard heap limit is reached. -** -** ^The return value from both sqlite3_soft_heap_limit64() and -** sqlite3_hard_heap_limit64() is the size of -** the heap limit prior to the call, or negative in the case of an -** error. ^If the argument N is negative -** then no change is made to the heap limit. Hence, the current -** size of heap limits can be determined by invoking -** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1). -** -** ^Setting the heap limits to zero disables the heap limiter mechanism. -** -** ^The soft heap limit may not be greater than the hard heap limit. -** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N) -** is invoked with a value of N that is greater than the hard heap limit, -** the soft heap limit is set to the value of the hard heap limit. -** ^The soft heap limit is automatically enabled whenever the hard heap -** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and -** the soft heap limit is outside the range of 1..N, then the soft heap -** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the -** hard heap limit is enabled makes the soft heap limit equal to the -** hard heap limit. -** -** The memory allocation limits can also be adjusted using -** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit]. -** -** ^(The heap limits are not enforced in the current implementation -** if one or more of following conditions are true: -** -**
    -**
  • The limit value is set to zero. -**
  • Memory accounting is disabled using a combination of the -** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and -** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. -**
  • An alternative page cache implementation is specified using -** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). -**
  • The page cache allocates from its own memory pool supplied -** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than -** from the heap. -**
)^ -** -** The circumstances under which SQLite will enforce the heap limits may -** changes in future releases of SQLite. - */ -// llgo:link Int64.SoftHeapLimit64 C.sqlite3_soft_heap_limit64 -func (recv_ Int64) SoftHeapLimit64() Int64 { - return 0 -} - -// llgo:link Int64.HardHeapLimit64 C.sqlite3_hard_heap_limit64 -func (recv_ Int64) HardHeapLimit64() Int64 { - return 0 -} - -/* -** CAPI3REF: Deprecated Soft Heap Limit Interface -** DEPRECATED -** -** This is a deprecated version of the [sqlite3_soft_heap_limit64()] -** interface. This routine is provided for historical compatibility -** only. All new applications should use the -** [sqlite3_soft_heap_limit64()] interface rather than this one. - */ -//go:linkname SoftHeapLimit C.sqlite3_soft_heap_limit -func SoftHeapLimit(N c.Int) - -/* -** CAPI3REF: Extract Metadata About A Column Of A Table -** METHOD: sqlite3 -** -** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns -** information about column C of table T in database D -** on [database connection] X.)^ ^The sqlite3_table_column_metadata() -** interface returns SQLITE_OK and fills in the non-NULL pointers in -** the final five arguments with appropriate values if the specified -** column exists. ^The sqlite3_table_column_metadata() interface returns -** SQLITE_ERROR if the specified column does not exist. -** ^If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then this routine simply checks for the existence of the -** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it -** does not. If the table name parameter T in a call to -** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is -** undefined behavior. -** -** ^The column is identified by the second, third and fourth parameters to -** this function. ^(The second parameter is either the name of the database -** (i.e. "main", "temp", or an attached database) containing the specified -** table or NULL.)^ ^If it is NULL, then all attached databases are searched -** for the table using the same algorithm used by the database engine to -** resolve unqualified table references. -** -** ^The third and fourth parameters to this function are the table and column -** name of the desired column, respectively. -** -** ^Metadata is returned by writing to the memory locations passed as the 5th -** and subsequent parameters to this function. ^Any of these arguments may be -** NULL, in which case the corresponding element of metadata is omitted. -** -** ^(
-** -**
Parameter Output
Type
Description -** -**
5th const char* Data type -**
6th const char* Name of default collation sequence -**
7th int True if column has a NOT NULL constraint -**
8th int True if column is part of the PRIMARY KEY -**
9th int True if column is [AUTOINCREMENT] -**
-**
)^ -** -** ^The memory pointed to by the character pointers returned for the -** declaration type and collation sequence is valid until the next -** call to any SQLite API function. -** -** ^If the specified table is actually a view, an [error code] is returned. -** -** ^If the specified column is "rowid", "oid" or "_rowid_" and the table -** is not a [WITHOUT ROWID] table and an -** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output -** parameters are set for the explicitly declared column. ^(If there is no -** [INTEGER PRIMARY KEY] column, then the outputs -** for the [rowid] are set as follows: -** -**
-**     data type: "INTEGER"
-**     collation sequence: "BINARY"
-**     not null: 0
-**     primary key: 1
-**     auto increment: 0
-** 
)^ -** -** ^This function causes all database schemas to be read from disk and -** parsed, if that has not already been done, and returns an error if -** any errors are encountered while loading the schema. - */ -// llgo:link (*Sqlite3).TableColumnMetadata C.sqlite3_table_column_metadata -func (recv_ *Sqlite3) TableColumnMetadata(zDbName *c.Char, zTableName *c.Char, zColumnName *c.Char, pzDataType **c.Char, pzCollSeq **c.Char, pNotNull *c.Int, pPrimaryKey *c.Int, pAutoinc *c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Load An Extension -** METHOD: sqlite3 -** -** ^This interface loads an SQLite extension library from the named file. -** -** ^The sqlite3_load_extension() interface attempts to load an -** [SQLite extension] library contained in the file zFile. If -** the file cannot be loaded directly, attempts are made to load -** with various operating-system specific extensions added. -** So for example, if "samplelib" cannot be loaded, then names like -** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might -** be tried also. -** -** ^The entry point is zProc. -** ^(zProc may be 0, in which case SQLite will try to come up with an -** entry point name on its own. It first tries "sqlite3_extension_init". -** If that does not work, it constructs a name "sqlite3_X_init" where the -** X is consists of the lower-case equivalent of all ASCII alphabetic -** characters in the filename from the last "/" to the first following -** "." and omitting any initial "lib".)^ -** ^The sqlite3_load_extension() interface returns -** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. -** ^If an error occurs and pzErrMsg is not 0, then the -** [sqlite3_load_extension()] interface shall attempt to -** fill *pzErrMsg with error message text stored in memory -** obtained from [sqlite3_malloc()]. The calling function -** should free this memory by calling [sqlite3_free()]. -** -** ^Extension loading must be enabled using -** [sqlite3_enable_load_extension()] or -** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL) -** prior to calling this API, -** otherwise an error will be returned. -** -** Security warning: It is recommended that the -** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this -** interface. The use of the [sqlite3_enable_load_extension()] interface -** should be avoided. This will keep the SQL function [load_extension()] -** disabled and prevent SQL injections from giving attackers -** access to extension loading capabilities. -** -** See also the [load_extension() SQL function]. - */ -// llgo:link (*Sqlite3).LoadExtension C.sqlite3_load_extension -func (recv_ *Sqlite3) LoadExtension(zFile *c.Char, zProc *c.Char, pzErrMsg **c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Enable Or Disable Extension Loading -** METHOD: sqlite3 -** -** ^So as not to open security holes in older applications that are -** unprepared to deal with [extension loading], and as a means of disabling -** [extension loading] while evaluating user-entered SQL, the following API -** is provided to turn the [sqlite3_load_extension()] mechanism on and off. -** -** ^Extension loading is off by default. -** ^Call the sqlite3_enable_load_extension() routine with onoff==1 -** to turn extension loading on and call it with onoff==0 to turn -** it back off again. -** -** ^This interface enables or disables both the C-API -** [sqlite3_load_extension()] and the SQL function [load_extension()]. -** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) -** to enable or disable only the C-API.)^ -** -** Security warning: It is recommended that extension loading -** be enabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method -** rather than this interface, so the [load_extension()] SQL function -** remains disabled. This will prevent SQL injections from giving attackers -** access to extension loading capabilities. - */ -// llgo:link (*Sqlite3).EnableLoadExtension C.sqlite3_enable_load_extension -func (recv_ *Sqlite3) EnableLoadExtension(onoff c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Automatically Load Statically Linked Extensions -** -** ^This interface causes the xEntryPoint() function to be invoked for -** each new [database connection] that is created. The idea here is that -** xEntryPoint() is the entry point for a statically linked [SQLite extension] -** that is to be automatically loaded into all new database connections. -** -** ^(Even though the function prototype shows that xEntryPoint() takes -** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects an integer result as if the signature of the -** entry point where as follows: -** -**
-**    int xEntryPoint(
-**      sqlite3 *db,
-**      const char **pzErrMsg,
-**      const struct sqlite3_api_routines *pThunk
-**    );
-** 
)^ -** -** If the xEntryPoint routine encounters an error, it should make *pzErrMsg -** point to an appropriate error message (obtained from [sqlite3_mprintf()]) -** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg -** is NULL before calling the xEntryPoint(). ^SQLite will invoke -** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any -** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], -** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. -** -** ^Calling sqlite3_auto_extension(X) with an entry point X that is already -** on the list of automatic extensions is a harmless no-op. ^No entry point -** will be called more than once for each database connection that is opened. -** -** See also: [sqlite3_reset_auto_extension()] -** and [sqlite3_cancel_auto_extension()] - */ -//go:linkname AutoExtension C.sqlite3_auto_extension -func AutoExtension(xEntryPoint func()) c.Int - -/* -** CAPI3REF: Cancel Automatic Extension Loading -** -** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the -** initialization routine X that was registered using a prior call to -** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] -** routine returns 1 if initialization routine X was successfully -** unregistered and it returns 0 if X was not on the list of initialization -** routines. - */ -//go:linkname CancelAutoExtension C.sqlite3_cancel_auto_extension -func CancelAutoExtension(xEntryPoint func()) c.Int - -/* -** CAPI3REF: Reset Automatic Extension Loading -** -** ^This interface disables all automatic extensions previously -** registered using [sqlite3_auto_extension()]. - */ -//go:linkname ResetAutoExtension C.sqlite3_reset_auto_extension -func ResetAutoExtension() - -type Vtab struct { - PModule *Module - NRef c.Int - ZErrMsg *c.Char -} - -type IndexInfo struct { - NConstraint c.Int - AConstraint *IndexConstraint - NOrderBy c.Int - AOrderBy *IndexOrderby - AConstraintUsage *IndexConstraintUsage - IdxNum c.Int - IdxStr *c.Char - NeedToFreeIdxStr c.Int - OrderByConsumed c.Int - EstimatedCost c.Double - EstimatedRows Int64 - IdxFlags c.Int - ColUsed Uint64 -} - -type VtabCursor struct { - PVtab *Vtab -} - -type Module struct { - IVersion c.Int - XCreate c.Pointer - XConnect c.Pointer - XBestIndex c.Pointer - XDisconnect c.Pointer - XDestroy c.Pointer - XOpen c.Pointer - XClose c.Pointer - XFilter c.Pointer - XNext c.Pointer - XEof c.Pointer - XColumn c.Pointer - XRowid c.Pointer - XUpdate c.Pointer - XBegin c.Pointer - XSync c.Pointer - XCommit c.Pointer - XRollback c.Pointer - XFindFunction c.Pointer - XRename c.Pointer - XSavepoint c.Pointer - XRelease c.Pointer - XRollbackTo c.Pointer - XShadowName c.Pointer - XIntegrity c.Pointer -} - -type IndexConstraint struct { - IColumn c.Int - Op c.Char - Usable c.Char - ITermOffset c.Int -} - -type IndexOrderby struct { - IColumn c.Int - Desc c.Char -} - -/* Outputs */ - -type IndexConstraintUsage struct { - ArgvIndex c.Int - Omit c.Char -} - -/* -** CAPI3REF: Register A Virtual Table Implementation -** METHOD: sqlite3 -** -** ^These routines are used to register a new [virtual table module] name. -** ^Module names must be registered before -** creating a new [virtual table] using the module and before using a -** preexisting [virtual table] for the module. -** -** ^The module name is registered on the [database connection] specified -** by the first parameter. ^The name of the module is given by the -** second parameter. ^The third parameter is a pointer to -** the implementation of the [virtual table module]. ^The fourth -** parameter is an arbitrary client data pointer that is passed through -** into the [xCreate] and [xConnect] methods of the virtual table module -** when a new virtual table is be being created or reinitialized. -** -** ^The sqlite3_create_module_v2() interface has a fifth parameter which -** is a pointer to a destructor for the pClientData. ^SQLite will -** invoke the destructor function (if it is not NULL) when SQLite -** no longer needs the pClientData pointer. ^The destructor will also -** be invoked if the call to sqlite3_create_module_v2() fails. -** ^The sqlite3_create_module() -** interface is equivalent to sqlite3_create_module_v2() with a NULL -** destructor. -** -** ^If the third parameter (the pointer to the sqlite3_module object) is -** NULL then no new module is created and any existing modules with the -** same name are dropped. -** -** See also: [sqlite3_drop_modules()] - */ -// llgo:link (*Sqlite3).CreateModule C.sqlite3_create_module -func (recv_ *Sqlite3) CreateModule(zName *c.Char, p *Module, pClientData c.Pointer) c.Int { - return 0 -} - -// llgo:link (*Sqlite3).CreateModuleV2 C.sqlite3_create_module_v2 -func (recv_ *Sqlite3) CreateModuleV2(zName *c.Char, p *Module, pClientData c.Pointer, xDestroy func(c.Pointer)) c.Int { - return 0 -} - -/* -** CAPI3REF: Remove Unnecessary Virtual Table Implementations -** METHOD: sqlite3 -** -** ^The sqlite3_drop_modules(D,L) interface removes all virtual -** table modules from database connection D except those named on list L. -** The L parameter must be either NULL or a pointer to an array of pointers -** to strings where the array is terminated by a single NULL pointer. -** ^If the L parameter is NULL, then all virtual table modules are removed. -** -** See also: [sqlite3_create_module()] - */ -// llgo:link (*Sqlite3).DropModules C.sqlite3_drop_modules -func (recv_ *Sqlite3) DropModules(azKeep **c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Declare The Schema Of A Virtual Table -** -** ^The [xCreate] and [xConnect] methods of a -** [virtual table module] call this interface -** to declare the format (the names and datatypes of the columns) of -** the virtual tables they implement. - */ -// llgo:link (*Sqlite3).DeclareVtab C.sqlite3_declare_vtab -func (recv_ *Sqlite3) DeclareVtab(zSQL *c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Overload A Function For A Virtual Table -** METHOD: sqlite3 -** -** ^(Virtual tables can provide alternative implementations of functions -** using the [xFindFunction] method of the [virtual table module]. -** But global versions of those functions -** must exist in order to be overloaded.)^ -** -** ^(This API makes sure a global version of a function with a particular -** name and number of parameters exists. If no such function exists -** before this API is called, a new function is created.)^ ^The implementation -** of the new function always causes an exception to be thrown. So -** the new function is not good for anything by itself. Its only -** purpose is to be a placeholder function that can be overloaded -** by a [virtual table]. - */ -// llgo:link (*Sqlite3).OverloadFunction C.sqlite3_overload_function -func (recv_ *Sqlite3) OverloadFunction(zFuncName *c.Char, nArg c.Int) c.Int { - return 0 -} - -type Blob struct { - Unused [8]uint8 -} - -/* -** CAPI3REF: Open A BLOB For Incremental I/O -** METHOD: sqlite3 -** CONSTRUCTOR: sqlite3_blob -** -** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located -** in row iRow, column zColumn, table zTable in database zDb; -** in other words, the same BLOB that would be selected by: -** -**
-**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
-** 
)^ -** -** ^(Parameter zDb is not the filename that contains the database, but -** rather the symbolic name of the database. For attached databases, this is -** the name that appears after the AS keyword in the [ATTACH] statement. -** For the main database file, the database name is "main". For TEMP -** tables, the database name is "temp".)^ -** -** ^If the flags parameter is non-zero, then the BLOB is opened for read -** and write access. ^If the flags parameter is zero, the BLOB is opened for -** read-only access. -** -** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored -** in *ppBlob. Otherwise an [error code] is returned and, unless the error -** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided -** the API is not misused, it is always safe to call [sqlite3_blob_close()] -** on *ppBlob after this function it returns. -** -** This function fails with SQLITE_ERROR if any of the following are true: -**
    -**
  • ^(Database zDb does not exist)^, -**
  • ^(Table zTable does not exist within database zDb)^, -**
  • ^(Table zTable is a WITHOUT ROWID table)^, -**
  • ^(Column zColumn does not exist)^, -**
  • ^(Row iRow is not present in the table)^, -**
  • ^(The specified column of row iRow contains a value that is not -** a TEXT or BLOB value)^, -**
  • ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE -** constraint and the blob is being opened for read/write access)^, -**
  • ^([foreign key constraints | Foreign key constraints] are enabled, -** column zColumn is part of a [child key] definition and the blob is -** being opened for read/write access)^. -**
-** -** ^Unless it returns SQLITE_MISUSE, this function sets the -** [database connection] error code and message accessible via -** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. -** -** A BLOB referenced by sqlite3_blob_open() may be read using the -** [sqlite3_blob_read()] interface and modified by using -** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a -** different row of the same table using the [sqlite3_blob_reopen()] -** interface. However, the column, table, or database of a [BLOB handle] -** cannot be changed after the [BLOB handle] is opened. -** -** ^(If the row that a BLOB handle points to is modified by an -** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects -** then the BLOB handle is marked as "expired". -** This is true if any column of the row is changed, even a column -** other than the one the BLOB handle is open on.)^ -** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for -** an expired BLOB handle fail with a return code of [SQLITE_ABORT]. -** ^(Changes written into a BLOB prior to the BLOB expiring are not -** rolled back by the expiration of the BLOB. Such changes will eventually -** commit if the transaction continues to completion.)^ -** -** ^Use the [sqlite3_blob_bytes()] interface to determine the size of -** the opened blob. ^The size of a blob may not be changed by this -** interface. Use the [UPDATE] SQL command to change the size of a -** blob. -** -** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces -** and the built-in [zeroblob] SQL function may be used to create a -** zero-filled blob to read or write using the incremental-blob interface. -** -** To avoid a resource leak, every open [BLOB handle] should eventually -** be released by a call to [sqlite3_blob_close()]. -** -** See also: [sqlite3_blob_close()], -** [sqlite3_blob_reopen()], [sqlite3_blob_read()], -** [sqlite3_blob_bytes()], [sqlite3_blob_write()]. - */ -// llgo:link (*Sqlite3).BlobOpen C.sqlite3_blob_open -func (recv_ *Sqlite3) BlobOpen(zDb *c.Char, zTable *c.Char, zColumn *c.Char, iRow Int64, flags c.Int, ppBlob **Blob) c.Int { - return 0 -} - -/* -** CAPI3REF: Move a BLOB Handle to a New Row -** METHOD: sqlite3_blob -** -** ^This function is used to move an existing [BLOB handle] so that it points -** to a different row of the same database table. ^The new row is identified -** by the rowid value passed as the second argument. Only the row can be -** changed. ^The database, table and column on which the blob handle is open -** remain the same. Moving an existing [BLOB handle] to a new row is -** faster than closing the existing handle and opening a new one. -** -** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - -** it must exist and there must be either a blob or text value stored in -** the nominated column.)^ ^If the new row is not present in the table, or if -** it does not contain a blob or text value, or if another error occurs, an -** SQLite error code is returned and the blob handle is considered aborted. -** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or -** [sqlite3_blob_reopen()] on an aborted blob handle immediately return -** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle -** always returns zero. -** -** ^This function sets the database handle error code and message. - */ -// llgo:link (*Blob).BlobReopen C.sqlite3_blob_reopen -func (recv_ *Blob) BlobReopen(Int64) c.Int { - return 0 -} - -/* -** CAPI3REF: Close A BLOB Handle -** DESTRUCTOR: sqlite3_blob -** -** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed -** unconditionally. Even if this routine returns an error code, the -** handle is still closed.)^ -** -** ^If the blob handle being closed was opened for read-write access, and if -** the database is in auto-commit mode and there are no other open read-write -** blob handles or active write statements, the current transaction is -** committed. ^If an error occurs while committing the transaction, an error -** code is returned and the transaction rolled back. -** -** Calling this function with an argument that is not a NULL pointer or an -** open blob handle results in undefined behavior. ^Calling this routine -** with a null pointer (such as would be returned by a failed call to -** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function -** is passed a valid open blob handle, the values returned by the -** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning. - */ -// llgo:link (*Blob).BlobClose C.sqlite3_blob_close -func (recv_ *Blob) BlobClose() c.Int { - return 0 -} - -/* -** CAPI3REF: Return The Size Of An Open BLOB -** METHOD: sqlite3_blob -** -** ^Returns the size in bytes of the BLOB accessible via the -** successfully opened [BLOB handle] in its only argument. ^The -** incremental blob I/O routines can only read or overwriting existing -** blob content; they cannot change the size of a blob. -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. - */ -// llgo:link (*Blob).BlobBytes C.sqlite3_blob_bytes -func (recv_ *Blob) BlobBytes() c.Int { - return 0 -} - -/* -** CAPI3REF: Read Data From A BLOB Incrementally -** METHOD: sqlite3_blob -** -** ^(This function is used to read data from an open [BLOB handle] into a -** caller-supplied buffer. N bytes of data are copied into buffer Z -** from the open BLOB, starting at offset iOffset.)^ -** -** ^If offset iOffset is less than N bytes from the end of the BLOB, -** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is -** less than zero, [SQLITE_ERROR] is returned and no data is read. -** ^The size of the blob (and hence the maximum value of N+iOffset) -** can be determined using the [sqlite3_blob_bytes()] interface. -** -** ^An attempt to read from an expired [BLOB handle] fails with an -** error code of [SQLITE_ABORT]. -** -** ^(On success, sqlite3_blob_read() returns SQLITE_OK. -** Otherwise, an [error code] or an [extended error code] is returned.)^ -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -** -** See also: [sqlite3_blob_write()]. - */ -// llgo:link (*Blob).BlobRead C.sqlite3_blob_read -func (recv_ *Blob) BlobRead(Z c.Pointer, N c.Int, iOffset c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Write Data Into A BLOB Incrementally -** METHOD: sqlite3_blob -** -** ^(This function is used to write data into an open [BLOB handle] from a -** caller-supplied buffer. N bytes of data are copied from the buffer Z -** into the open BLOB, starting at offset iOffset.)^ -** -** ^(On success, sqlite3_blob_write() returns SQLITE_OK. -** Otherwise, an [error code] or an [extended error code] is returned.)^ -** ^Unless SQLITE_MISUSE is returned, this function sets the -** [database connection] error code and message accessible via -** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. -** -** ^If the [BLOB handle] passed as the first argument was not opened for -** writing (the flags parameter to [sqlite3_blob_open()] was zero), -** this function returns [SQLITE_READONLY]. -** -** This function may only modify the contents of the BLOB; it is -** not possible to increase the size of a BLOB using this API. -** ^If offset iOffset is less than N bytes from the end of the BLOB, -** [SQLITE_ERROR] is returned and no data is written. The size of the -** BLOB (and hence the maximum value of N+iOffset) can be determined -** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less -** than zero [SQLITE_ERROR] is returned and no data is written. -** -** ^An attempt to write to an expired [BLOB handle] fails with an -** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred -** before the [BLOB handle] expired are not rolled back by the -** expiration of the handle, though of course those changes might -** have been overwritten by the statement that expired the BLOB handle -** or by other independent statements. -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -** -** See also: [sqlite3_blob_read()]. - */ -// llgo:link (*Blob).BlobWrite C.sqlite3_blob_write -func (recv_ *Blob) BlobWrite(z c.Pointer, n c.Int, iOffset c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Virtual File System Objects -** -** A virtual filesystem (VFS) is an [sqlite3_vfs] object -** that SQLite uses to interact -** with the underlying operating system. Most SQLite builds come with a -** single default VFS that is appropriate for the host computer. -** New VFSes can be registered and existing VFSes can be unregistered. -** The following interfaces are provided. -** -** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. -** ^Names are case sensitive. -** ^Names are zero-terminated UTF-8 strings. -** ^If there is no match, a NULL pointer is returned. -** ^If zVfsName is NULL then the default VFS is returned. -** -** ^New VFSes are registered with sqlite3_vfs_register(). -** ^Each new VFS becomes the default VFS if the makeDflt flag is set. -** ^The same VFS can be registered multiple times without injury. -** ^To make an existing VFS into the default VFS, register it again -** with the makeDflt flag set. If two different VFSes with the -** same name are registered, the behavior is undefined. If a -** VFS is registered with a name that is NULL or an empty string, -** then the behavior is undefined. -** -** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. -** ^(If the default VFS is unregistered, another VFS is chosen as -** the default. The choice for the new VFS is arbitrary.)^ - */ -//go:linkname VfsFind C.sqlite3_vfs_find -func VfsFind(zVfsName *c.Char) *Vfs - -// llgo:link (*Vfs).VfsRegister C.sqlite3_vfs_register -func (recv_ *Vfs) VfsRegister(makeDflt c.Int) c.Int { - return 0 -} - -// llgo:link (*Vfs).VfsUnregister C.sqlite3_vfs_unregister -func (recv_ *Vfs) VfsUnregister() c.Int { - return 0 -} - -/* -** CAPI3REF: Mutexes -** -** The SQLite core uses these routines for thread -** synchronization. Though they are intended for internal -** use by SQLite, code that links against SQLite is -** permitted to use any of these routines. -** -** The SQLite source code contains multiple implementations -** of these mutex routines. An appropriate implementation -** is selected automatically at compile-time. The following -** implementations are available in the SQLite core: -** -**
    -**
  • SQLITE_MUTEX_PTHREADS -**
  • SQLITE_MUTEX_W32 -**
  • SQLITE_MUTEX_NOOP -**
-** -** The SQLITE_MUTEX_NOOP implementation is a set of routines -** that does no real locking and is appropriate for use in -** a single-threaded application. The SQLITE_MUTEX_PTHREADS and -** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix -** and Windows. -** -** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor -** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex -** implementation is included with the library. In this case the -** application must supply a custom mutex implementation using the -** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function -** before calling sqlite3_initialize() or any other public sqlite3_ -** function that calls sqlite3_initialize(). -** -** ^The sqlite3_mutex_alloc() routine allocates a new -** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc() -** routine returns NULL if it is unable to allocate the requested -** mutex. The argument to sqlite3_mutex_alloc() must one of these -** integer constants: -** -**
    -**
  • SQLITE_MUTEX_FAST -**
  • SQLITE_MUTEX_RECURSIVE -**
  • SQLITE_MUTEX_STATIC_MAIN -**
  • SQLITE_MUTEX_STATIC_MEM -**
  • SQLITE_MUTEX_STATIC_OPEN -**
  • SQLITE_MUTEX_STATIC_PRNG -**
  • SQLITE_MUTEX_STATIC_LRU -**
  • SQLITE_MUTEX_STATIC_PMEM -**
  • SQLITE_MUTEX_STATIC_APP1 -**
  • SQLITE_MUTEX_STATIC_APP2 -**
  • SQLITE_MUTEX_STATIC_APP3 -**
  • SQLITE_MUTEX_STATIC_VFS1 -**
  • SQLITE_MUTEX_STATIC_VFS2 -**
  • SQLITE_MUTEX_STATIC_VFS3 -**
-** -** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) -** cause sqlite3_mutex_alloc() to create -** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE -** is used but not necessarily so when SQLITE_MUTEX_FAST is used. -** The mutex implementation does not need to make a distinction -** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does -** not want to. SQLite will only request a recursive mutex in -** cases where it really needs one. If a faster non-recursive mutex -** implementation is available on the host platform, the mutex subsystem -** might return such a mutex in response to SQLITE_MUTEX_FAST. -** -** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other -** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return -** a pointer to a static preexisting mutex. ^Nine static mutexes are -** used by the current version of SQLite. Future versions of SQLite -** may add additional static mutexes. Static mutexes are for internal -** use by SQLite only. Applications that use SQLite mutexes should -** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or -** SQLITE_MUTEX_RECURSIVE. -** -** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() -** returns a different mutex on every call. ^For the static -** mutex types, the same mutex is returned on every call that has -** the same type number. -** -** ^The sqlite3_mutex_free() routine deallocates a previously -** allocated dynamic mutex. Attempting to deallocate a static -** mutex results in undefined behavior. -** -** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt -** to enter a mutex. ^If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] -** upon successful entry. ^(Mutexes created using -** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. -** In such cases, the -** mutex must be exited an equal number of times before another thread -** can enter.)^ If the same thread tries to enter any mutex other -** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined. -** -** ^(Some systems (for example, Windows 95) do not support the operation -** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() -** will always return SQLITE_BUSY. In most cases the SQLite core only uses -** sqlite3_mutex_try() as an optimization, so this is acceptable -** behavior. The exceptions are unix builds that set the -** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working -** sqlite3_mutex_try() is required.)^ -** -** ^The sqlite3_mutex_leave() routine exits a mutex that was -** previously entered by the same thread. The behavior -** is undefined if the mutex is not currently entered by the -** calling thread or is not currently allocated. -** -** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), -** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer, -** then any of the four routines behaves as a no-op. -** -** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. - */ -//go:linkname MutexAlloc C.sqlite3_mutex_alloc -func MutexAlloc(c.Int) *Mutex - -// llgo:link (*Mutex).MutexFree C.sqlite3_mutex_free -func (recv_ *Mutex) MutexFree() { -} - -// llgo:link (*Mutex).MutexEnter C.sqlite3_mutex_enter -func (recv_ *Mutex) MutexEnter() { -} - -// llgo:link (*Mutex).MutexTry C.sqlite3_mutex_try -func (recv_ *Mutex) MutexTry() c.Int { - return 0 -} - -// llgo:link (*Mutex).MutexLeave C.sqlite3_mutex_leave -func (recv_ *Mutex) MutexLeave() { -} - -type MutexMethods struct { - XMutexInit c.Pointer - XMutexEnd c.Pointer - XMutexAlloc c.Pointer - XMutexFree c.Pointer - XMutexEnter c.Pointer - XMutexTry c.Pointer - XMutexLeave c.Pointer - XMutexHeld c.Pointer - XMutexNotheld c.Pointer -} - -/* -** CAPI3REF: Retrieve the mutex for a database connection -** METHOD: sqlite3 -** -** ^This interface returns a pointer the [sqlite3_mutex] object that -** serializes access to the [database connection] given in the argument -** when the [threading mode] is Serialized. -** ^If the [threading mode] is Single-thread or Multi-thread then this -** routine returns a NULL pointer. - */ -// llgo:link (*Sqlite3).DbMutex C.sqlite3_db_mutex -func (recv_ *Sqlite3) DbMutex() *Mutex { - return nil -} - -/* -** CAPI3REF: Low-Level Control Of Database Files -** METHOD: sqlite3 -** KEYWORDS: {file control} -** -** ^The [sqlite3_file_control()] interface makes a direct call to the -** xFileControl method for the [sqlite3_io_methods] object associated -** with a particular database identified by the second argument. ^The -** name of the database is "main" for the main database or "temp" for the -** TEMP database, or the name that appears after the AS keyword for -** databases that are added using the [ATTACH] SQL command. -** ^A NULL pointer can be used in place of "main" to refer to the -** main database file. -** ^The third and fourth parameters to this routine -** are passed directly through to the second and third parameters of -** the xFileControl method. ^The return value of the xFileControl -** method becomes the return value of this routine. -** -** A few opcodes for [sqlite3_file_control()] are handled directly -** by the SQLite core and never invoke the -** sqlite3_io_methods.xFileControl method. -** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes -** a pointer to the underlying [sqlite3_file] object to be written into -** the space pointed to by the 4th parameter. The -** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns -** the [sqlite3_file] object associated with the journal file instead of -** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns -** a pointer to the underlying [sqlite3_vfs] object for the file. -** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter -** from the pager. -** -** ^If the second parameter (zDbName) does not match the name of any -** open database file, then SQLITE_ERROR is returned. ^This error -** code is not remembered and will not be recalled by [sqlite3_errcode()] -** or [sqlite3_errmsg()]. The underlying xFileControl method might -** also return SQLITE_ERROR. There is no way to distinguish between -** an incorrect zDbName and an SQLITE_ERROR return from the underlying -** xFileControl method. -** -** See also: [file control opcodes] - */ -// llgo:link (*Sqlite3).FileControl C.sqlite3_file_control -func (recv_ *Sqlite3) FileControl(zDbName *c.Char, op c.Int, __llgo_arg_2 c.Pointer) c.Int { - return 0 -} - -/* -** CAPI3REF: Testing Interface -** -** ^The sqlite3_test_control() interface is used to read out internal -** state of SQLite and to inject faults into SQLite for testing -** purposes. ^The first parameter is an operation code that determines -** the number, meaning, and operation of all subsequent parameters. -** -** This interface is not for use by applications. It exists solely -** for verifying the correct operation of the SQLite library. Depending -** on how the SQLite library is compiled, this interface might not exist. -** -** The details of the operation codes, their meanings, the parameters -** they take, and what they do are all subject to change without notice. -** Unlike most of the SQLite API, this function is not guaranteed to -** operate consistently from one release to the next. - */ -//go:linkname TestControl C.sqlite3_test_control -func TestControl(op c.Int, __llgo_va_list ...interface{}) c.Int - -/* -** CAPI3REF: SQL Keyword Checking -** -** These routines provide access to the set of SQL language keywords -** recognized by SQLite. Applications can uses these routines to determine -** whether or not a specific identifier needs to be escaped (for example, -** by enclosing in double-quotes) so as not to confuse the parser. -** -** The sqlite3_keyword_count() interface returns the number of distinct -** keywords understood by SQLite. -** -** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and -** makes *Z point to that keyword expressed as UTF8 and writes the number -** of bytes in the keyword into *L. The string that *Z points to is not -** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns -** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z -** or L are NULL or invalid pointers then calls to -** sqlite3_keyword_name(N,Z,L) result in undefined behavior. -** -** The sqlite3_keyword_check(Z,L) interface checks to see whether or not -** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero -** if it is and zero if not. -** -** The parser used by SQLite is forgiving. It is often possible to use -** a keyword as an identifier as long as such use does not result in a -** parsing ambiguity. For example, the statement -** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and -** creates a new table named "BEGIN" with three columns named -** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid -** using keywords as identifiers. Common techniques used to avoid keyword -** name collisions include: -**
    -**
  • Put all identifier names inside double-quotes. This is the official -** SQL way to escape identifier names. -**
  • Put identifier names inside [...]. This is not standard SQL, -** but it is what SQL Server does and so lots of programmers use this -** technique. -**
  • Begin every identifier with the letter "Z" as no SQL keywords start -** with "Z". -**
  • Include a digit somewhere in every identifier name. -**
-** -** Note that the number of keywords understood by SQLite can depend on -** compile-time options. For example, "VACUUM" is not a keyword if -** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also, -** new keywords may be added to future releases of SQLite. - */ -//go:linkname KeywordCount C.sqlite3_keyword_count -func KeywordCount() c.Int - -//go:linkname KeywordName C.sqlite3_keyword_name -func KeywordName(c.Int, **c.Char, *c.Int) c.Int - -//go:linkname KeywordCheck C.sqlite3_keyword_check -func KeywordCheck(*c.Char, c.Int) c.Int - -type Str struct { - Unused [8]uint8 -} - -/* -** CAPI3REF: Create A New Dynamic String Object -** CONSTRUCTOR: sqlite3_str -** -** ^The [sqlite3_str_new(D)] interface allocates and initializes -** a new [sqlite3_str] object. To avoid memory leaks, the object returned by -** [sqlite3_str_new()] must be freed by a subsequent call to -** [sqlite3_str_finish(X)]. -** -** ^The [sqlite3_str_new(D)] interface always returns a pointer to a -** valid [sqlite3_str] object, though in the event of an out-of-memory -** error the returned object might be a special singleton that will -** silently reject new text, always return SQLITE_NOMEM from -** [sqlite3_str_errcode()], always return 0 for -** [sqlite3_str_length()], and always return NULL from -** [sqlite3_str_finish(X)]. It is always safe to use the value -** returned by [sqlite3_str_new(D)] as the sqlite3_str parameter -** to any of the other [sqlite3_str] methods. -** -** The D parameter to [sqlite3_str_new(D)] may be NULL. If the -** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum -** length of the string contained in the [sqlite3_str] object will be -** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead -** of [SQLITE_MAX_LENGTH]. - */ -// llgo:link (*Sqlite3).StrNew C.sqlite3_str_new -func (recv_ *Sqlite3) StrNew() *Str { - return nil -} - -/* -** CAPI3REF: Finalize A Dynamic String -** DESTRUCTOR: sqlite3_str -** -** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X -** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()] -** that contains the constructed string. The calling application should -** pass the returned value to [sqlite3_free()] to avoid a memory leak. -** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any -** errors were encountered during construction of the string. ^The -** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the -** string in [sqlite3_str] object X is zero bytes long. - */ -// llgo:link (*Str).StrFinish C.sqlite3_str_finish -func (recv_ *Str) StrFinish() *c.Char { - return nil -} - -/* -** CAPI3REF: Add Content To A Dynamic String -** METHOD: sqlite3_str -** -** These interfaces add content to an sqlite3_str object previously obtained -** from [sqlite3_str_new()]. -** -** ^The [sqlite3_str_appendf(X,F,...)] and -** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf] -** functionality of SQLite to append formatted text onto the end of -** [sqlite3_str] object X. -** -** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S -** onto the end of the [sqlite3_str] object X. N must be non-negative. -** S must contain at least N non-zero bytes of content. To append a -** zero-terminated string in its entirety, use the [sqlite3_str_appendall()] -** method instead. -** -** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of -** zero-terminated string S onto the end of [sqlite3_str] object X. -** -** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the -** single-byte character C onto the end of [sqlite3_str] object X. -** ^This method can be used, for example, to add whitespace indentation. -** -** ^The [sqlite3_str_reset(X)] method resets the string under construction -** inside [sqlite3_str] object X back to zero bytes in length. -** -** These methods do not return a result code. ^If an error occurs, that fact -** is recorded in the [sqlite3_str] object and can be recovered by a -** subsequent call to [sqlite3_str_errcode(X)]. - */ -//go:linkname StrAppendf C.sqlite3_str_appendf -func StrAppendf(__llgo_arg_0 *Str, zFormat *c.Char, __llgo_va_list ...interface{}) - -// llgo:link (*Str).StrVappendf C.sqlite3_str_vappendf -func (recv_ *Str) StrVappendf(zFormat *c.Char, __llgo_arg_1 c.VaList) { -} - -// llgo:link (*Str).StrAppend C.sqlite3_str_append -func (recv_ *Str) StrAppend(zIn *c.Char, N c.Int) { -} - -// llgo:link (*Str).StrAppendall C.sqlite3_str_appendall -func (recv_ *Str) StrAppendall(zIn *c.Char) { -} - -// llgo:link (*Str).StrAppendchar C.sqlite3_str_appendchar -func (recv_ *Str) StrAppendchar(N c.Int, C c.Char) { -} - -// llgo:link (*Str).StrReset C.sqlite3_str_reset -func (recv_ *Str) StrReset() { -} - -/* -** CAPI3REF: Status Of A Dynamic String -** METHOD: sqlite3_str -** -** These interfaces return the current status of an [sqlite3_str] object. -** -** ^If any prior errors have occurred while constructing the dynamic string -** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return -** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns -** [SQLITE_NOMEM] following any out-of-memory error, or -** [SQLITE_TOOBIG] if the size of the dynamic string exceeds -** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors. -** -** ^The [sqlite3_str_length(X)] method returns the current length, in bytes, -** of the dynamic string under construction in [sqlite3_str] object X. -** ^The length returned by [sqlite3_str_length(X)] does not include the -** zero-termination byte. -** -** ^The [sqlite3_str_value(X)] method returns a pointer to the current -** content of the dynamic string under construction in X. The value -** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X -** and might be freed or altered by any subsequent method on the same -** [sqlite3_str] object. Applications must not used the pointer returned -** [sqlite3_str_value(X)] after any subsequent method call on the same -** object. ^Applications may change the content of the string returned -** by [sqlite3_str_value(X)] as long as they do not write into any bytes -** outside the range of 0 to [sqlite3_str_length(X)] and do not read or -** write any byte after any subsequent sqlite3_str method call. - */ -// llgo:link (*Str).StrErrcode C.sqlite3_str_errcode -func (recv_ *Str) StrErrcode() c.Int { - return 0 -} - -// llgo:link (*Str).StrLength C.sqlite3_str_length -func (recv_ *Str) StrLength() c.Int { - return 0 -} - -// llgo:link (*Str).StrValue C.sqlite3_str_value -func (recv_ *Str) StrValue() *c.Char { - return nil -} - -/* -** CAPI3REF: SQLite Runtime Status -** -** ^These interfaces are used to retrieve runtime status information -** about the performance of SQLite, and optionally to reset various -** highwater marks. ^The first argument is an integer code for -** the specific parameter to measure. ^(Recognized integer codes -** are of the form [status parameters | SQLITE_STATUS_...].)^ -** ^The current value of the parameter is returned into *pCurrent. -** ^The highest recorded value is returned in *pHighwater. ^If the -** resetFlag is true, then the highest record value is reset after -** *pHighwater is written. ^(Some parameters do not record the highest -** value. For those parameters -** nothing is written into *pHighwater and the resetFlag is ignored.)^ -** ^(Other parameters record only the highwater mark and not the current -** value. For these latter parameters nothing is written into *pCurrent.)^ -** -** ^The sqlite3_status() and sqlite3_status64() routines return -** SQLITE_OK on success and a non-zero [error code] on failure. -** -** If either the current value or the highwater mark is too large to -** be represented by a 32-bit integer, then the values returned by -** sqlite3_status() are undefined. -** -** See also: [sqlite3_db_status()] - */ -//go:linkname Status C.sqlite3_status -func Status(op c.Int, pCurrent *c.Int, pHighwater *c.Int, resetFlag c.Int) c.Int - -//go:linkname Status64 C.sqlite3_status64 -func Status64(op c.Int, pCurrent *Int64, pHighwater *Int64, resetFlag c.Int) c.Int - -/* -** CAPI3REF: Database Connection Status -** METHOD: sqlite3 -** -** ^This interface is used to retrieve runtime status information -** about a single [database connection]. ^The first argument is the -** database connection object to be interrogated. ^The second argument -** is an integer constant, taken from the set of -** [SQLITE_DBSTATUS options], that -** determines the parameter to interrogate. The set of -** [SQLITE_DBSTATUS options] is likely -** to grow in future releases of SQLite. -** -** ^The current value of the requested parameter is written into *pCur -** and the highest instantaneous value is written into *pHiwtr. ^If -** the resetFlg is true, then the highest instantaneous value is -** reset back down to the current value. -** -** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a -** non-zero [error code] on failure. -** -** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. - */ -// llgo:link (*Sqlite3).DbStatus C.sqlite3_db_status -func (recv_ *Sqlite3) DbStatus(op c.Int, pCur *c.Int, pHiwtr *c.Int, resetFlg c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Prepared Statement Status -** METHOD: sqlite3_stmt -** -** ^(Each prepared statement maintains various -** [SQLITE_STMTSTATUS counters] that measure the number -** of times it has performed specific operations.)^ These counters can -** be used to monitor the performance characteristics of the prepared -** statements. For example, if the number of table steps greatly exceeds -** the number of table searches or result rows, that would tend to indicate -** that the prepared statement is using a full table scan rather than -** an index. -** -** ^(This interface is used to retrieve and reset counter values from -** a [prepared statement]. The first argument is the prepared statement -** object to be interrogated. The second argument -** is an integer code for a specific [SQLITE_STMTSTATUS counter] -** to be interrogated.)^ -** ^The current value of the requested counter is returned. -** ^If the resetFlg is true, then the counter is reset to zero after this -** interface call returns. -** -** See also: [sqlite3_status()] and [sqlite3_db_status()]. - */ -// llgo:link (*Stmt).StmtStatus C.sqlite3_stmt_status -func (recv_ *Stmt) StmtStatus(op c.Int, resetFlg c.Int) c.Int { - return 0 -} - -type Pcache struct { - Unused [8]uint8 -} - -type PcachePage struct { - PBuf c.Pointer - PExtra c.Pointer -} - -type PcacheMethods2 struct { - IVersion c.Int - PArg c.Pointer - XInit c.Pointer - XShutdown c.Pointer - XCreate c.Pointer - XCachesize c.Pointer - XPagecount c.Pointer - XFetch c.Pointer - XUnpin c.Pointer - XRekey c.Pointer - XTruncate c.Pointer - XDestroy c.Pointer - XShrink c.Pointer -} - -type PcacheMethods struct { - PArg c.Pointer - XInit c.Pointer - XShutdown c.Pointer - XCreate c.Pointer - XCachesize c.Pointer - XPagecount c.Pointer - XFetch c.Pointer - XUnpin c.Pointer - XRekey c.Pointer - XTruncate c.Pointer - XDestroy c.Pointer -} - -type Backup struct { - Unused [8]uint8 -} - -/* -** CAPI3REF: Online Backup API. -** -** The backup API copies the content of one database into another. -** It is useful either for creating backups of databases or -** for copying in-memory databases to or from persistent files. -** -** See Also: [Using the SQLite Online Backup API] -** -** ^SQLite holds a write transaction open on the destination database file -** for the duration of the backup operation. -** ^The source database is read-locked only while it is being read; -** it is not locked continuously for the entire backup operation. -** ^Thus, the backup may be performed on a live source database without -** preventing other database connections from -** reading or writing to the source database while the backup is underway. -** -** ^(To perform a backup operation: -**
    -**
  1. sqlite3_backup_init() is called once to initialize the -** backup, -**
  2. sqlite3_backup_step() is called one or more times to transfer -** the data between the two databases, and finally -**
  3. sqlite3_backup_finish() is called to release all resources -** associated with the backup operation. -**
)^ -** There should be exactly one call to sqlite3_backup_finish() for each -** successful call to sqlite3_backup_init(). -** -** [[sqlite3_backup_init()]] sqlite3_backup_init() -** -** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the -** [database connection] associated with the destination database -** and the database name, respectively. -** ^The database name is "main" for the main database, "temp" for the -** temporary database, or the name specified after the AS keyword in -** an [ATTACH] statement for an attached database. -** ^The S and M arguments passed to -** sqlite3_backup_init(D,N,S,M) identify the [database connection] -** and database name of the source database, respectively. -** ^The source and destination [database connections] (parameters S and D) -** must be different or else sqlite3_backup_init(D,N,S,M) will fail with -** an error. -** -** ^A call to sqlite3_backup_init() will fail, returning NULL, if -** there is already a read or read-write transaction open on the -** destination database. -** -** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is -** returned and an error code and error message are stored in the -** destination [database connection] D. -** ^The error code and message for the failed call to sqlite3_backup_init() -** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or -** [sqlite3_errmsg16()] functions. -** ^A successful call to sqlite3_backup_init() returns a pointer to an -** [sqlite3_backup] object. -** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and -** sqlite3_backup_finish() functions to perform the specified backup -** operation. -** -** [[sqlite3_backup_step()]] sqlite3_backup_step() -** -** ^Function sqlite3_backup_step(B,N) will copy up to N pages between -** the source and destination databases specified by [sqlite3_backup] object B. -** ^If N is negative, all remaining source pages are copied. -** ^If sqlite3_backup_step(B,N) successfully copies N pages and there -** are still more pages to be copied, then the function returns [SQLITE_OK]. -** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages -** from source to destination, then it returns [SQLITE_DONE]. -** ^If an error occurs while running sqlite3_backup_step(B,N), -** then an [error code] is returned. ^As well as [SQLITE_OK] and -** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], -** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an -** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. -** -** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if -**
    -**
  1. the destination database was opened read-only, or -**
  2. the destination database is using write-ahead-log journaling -** and the destination and source page sizes differ, or -**
  3. the destination database is an in-memory database and the -** destination and source page sizes differ. -**
)^ -** -** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then -** the [sqlite3_busy_handler | busy-handler function] -** is invoked (if one is specified). ^If the -** busy-handler returns non-zero before the lock is available, then -** [SQLITE_BUSY] is returned to the caller. ^In this case the call to -** sqlite3_backup_step() can be retried later. ^If the source -** [database connection] -** is being used to write to the source database when sqlite3_backup_step() -** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this -** case the call to sqlite3_backup_step() can be retried later on. ^(If -** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or -** [SQLITE_READONLY] is returned, then -** there is no point in retrying the call to sqlite3_backup_step(). These -** errors are considered fatal.)^ The application must accept -** that the backup operation has failed and pass the backup operation handle -** to the sqlite3_backup_finish() to release associated resources. -** -** ^The first call to sqlite3_backup_step() obtains an exclusive lock -** on the destination file. ^The exclusive lock is not released until either -** sqlite3_backup_finish() is called or the backup operation is complete -** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to -** sqlite3_backup_step() obtains a [shared lock] on the source database that -** lasts for the duration of the sqlite3_backup_step() call. -** ^Because the source database is not locked between calls to -** sqlite3_backup_step(), the source database may be modified mid-way -** through the backup process. ^If the source database is modified by an -** external process or via a database connection other than the one being -** used by the backup operation, then the backup will be automatically -** restarted by the next call to sqlite3_backup_step(). ^If the source -** database is modified by the using the same database connection as is used -** by the backup operation, then the backup database is automatically -** updated at the same time. -** -** [[sqlite3_backup_finish()]] sqlite3_backup_finish() -** -** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the -** application wishes to abandon the backup operation, the application -** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). -** ^The sqlite3_backup_finish() interfaces releases all -** resources associated with the [sqlite3_backup] object. -** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any -** active write-transaction on the destination database is rolled back. -** The [sqlite3_backup] object is invalid -** and may not be used following a call to sqlite3_backup_finish(). -** -** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no -** sqlite3_backup_step() errors occurred, regardless or whether or not -** sqlite3_backup_step() completed. -** ^If an out-of-memory condition or IO error occurred during any prior -** sqlite3_backup_step() call on the same [sqlite3_backup] object, then -** sqlite3_backup_finish() returns the corresponding [error code]. -** -** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() -** is not a permanent error and does not affect the return value of -** sqlite3_backup_finish(). -** -** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]] -** sqlite3_backup_remaining() and sqlite3_backup_pagecount() -** -** ^The sqlite3_backup_remaining() routine returns the number of pages still -** to be backed up at the conclusion of the most recent sqlite3_backup_step(). -** ^The sqlite3_backup_pagecount() routine returns the total number of pages -** in the source database at the conclusion of the most recent -** sqlite3_backup_step(). -** ^(The values returned by these functions are only updated by -** sqlite3_backup_step(). If the source database is modified in a way that -** changes the size of the source database or the number of pages remaining, -** those changes are not reflected in the output of sqlite3_backup_pagecount() -** and sqlite3_backup_remaining() until after the next -** sqlite3_backup_step().)^ -** -** Concurrent Usage of Database Handles -** -** ^The source [database connection] may be used by the application for other -** purposes while a backup operation is underway or being initialized. -** ^If SQLite is compiled and configured to support threadsafe database -** connections, then the source database connection may be used concurrently -** from within other threads. -** -** However, the application must guarantee that the destination -** [database connection] is not passed to any other API (by any thread) after -** sqlite3_backup_init() is called and before the corresponding call to -** sqlite3_backup_finish(). SQLite does not currently check to see -** if the application incorrectly accesses the destination [database connection] -** and so no error code is reported, but the operations may malfunction -** nevertheless. Use of the destination database connection while a -** backup is in progress might also cause a mutex deadlock. -** -** If running in [shared cache mode], the application must -** guarantee that the shared cache used by the destination database -** is not accessed while the backup is running. In practice this means -** that the application must guarantee that the disk file being -** backed up to is not accessed by any connection within the process, -** not just the specific connection that was passed to sqlite3_backup_init(). -** -** The [sqlite3_backup] object itself is partially threadsafe. Multiple -** threads may safely make multiple concurrent calls to sqlite3_backup_step(). -** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() -** APIs are not strictly speaking threadsafe. If they are invoked at the -** same time as another thread is invoking sqlite3_backup_step() it is -** possible that they return invalid values. -** -** Alternatives To Using The Backup API -** -** Other techniques for safely creating a consistent backup of an SQLite -** database include: -** -**
    -**
  • The [VACUUM INTO] command. -**
  • The [sqlite3_rsync] utility program. -**
- */ -// llgo:link (*Sqlite3).BackupInit C.sqlite3_backup_init -func (recv_ *Sqlite3) BackupInit(zDestName *c.Char, pSource *Sqlite3, zSourceName *c.Char) *Backup { - return nil -} - -// llgo:link (*Backup).BackupStep C.sqlite3_backup_step -func (recv_ *Backup) BackupStep(nPage c.Int) c.Int { - return 0 -} - -// llgo:link (*Backup).BackupFinish C.sqlite3_backup_finish -func (recv_ *Backup) BackupFinish() c.Int { - return 0 -} - -// llgo:link (*Backup).BackupRemaining C.sqlite3_backup_remaining -func (recv_ *Backup) BackupRemaining() c.Int { - return 0 -} - -// llgo:link (*Backup).BackupPagecount C.sqlite3_backup_pagecount -func (recv_ *Backup) BackupPagecount() c.Int { - return 0 -} - -/* -** CAPI3REF: Unlock Notification -** METHOD: sqlite3 -** -** ^When running in shared-cache mode, a database operation may fail with -** an [SQLITE_LOCKED] error if the required locks on the shared-cache or -** individual tables within the shared-cache cannot be obtained. See -** [SQLite Shared-Cache Mode] for a description of shared-cache locking. -** ^This API may be used to register a callback that SQLite will invoke -** when the connection currently holding the required lock relinquishes it. -** ^This API is only available if the library was compiled with the -** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. -** -** See Also: [Using the SQLite Unlock Notification Feature]. -** -** ^Shared-cache locks are released when a database connection concludes -** its current transaction, either by committing it or rolling it back. -** -** ^When a connection (known as the blocked connection) fails to obtain a -** shared-cache lock and SQLITE_LOCKED is returned to the caller, the -** identity of the database connection (the blocking connection) that -** has locked the required resource is stored internally. ^After an -** application receives an SQLITE_LOCKED error, it may call the -** sqlite3_unlock_notify() method with the blocked connection handle as -** the first argument to register for a callback that will be invoked -** when the blocking connections current transaction is concluded. ^The -** callback is invoked from within the [sqlite3_step] or [sqlite3_close] -** call that concludes the blocking connection's transaction. -** -** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, -** there is a chance that the blocking connection will have already -** concluded its transaction by the time sqlite3_unlock_notify() is invoked. -** If this happens, then the specified callback is invoked immediately, -** from within the call to sqlite3_unlock_notify().)^ -** -** ^If the blocked connection is attempting to obtain a write-lock on a -** shared-cache table, and more than one other connection currently holds -** a read-lock on the same table, then SQLite arbitrarily selects one of -** the other connections to use as the blocking connection. -** -** ^(There may be at most one unlock-notify callback registered by a -** blocked connection. If sqlite3_unlock_notify() is called when the -** blocked connection already has a registered unlock-notify callback, -** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is -** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is canceled. ^The blocked connections -** unlock-notify callback may also be canceled by closing the blocked -** connection using [sqlite3_close()]. -** -** The unlock-notify callback is not reentrant. If an application invokes -** any sqlite3_xxx API functions from within an unlock-notify callback, a -** crash or deadlock may be the result. -** -** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always -** returns SQLITE_OK. -** -** Callback Invocation Details -** -** When an unlock-notify callback is registered, the application provides a -** single void* pointer that is passed to the callback when it is invoked. -** However, the signature of the callback function allows SQLite to pass -** it an array of void* context pointers. The first argument passed to -** an unlock-notify callback is a pointer to an array of void* pointers, -** and the second is the number of entries in the array. -** -** When a blocking connection's transaction is concluded, there may be -** more than one blocked connection that has registered for an unlock-notify -** callback. ^If two or more such blocked connections have specified the -** same callback function, then instead of invoking the callback function -** multiple times, it is invoked once with the set of void* context pointers -** specified by the blocked connections bundled together into an array. -** This gives the application an opportunity to prioritize any actions -** related to the set of unblocked database connections. -** -** Deadlock Detection -** -** Assuming that after registering for an unlock-notify callback a -** database waits for the callback to be issued before taking any further -** action (a reasonable assumption), then using this API may cause the -** application to deadlock. For example, if connection X is waiting for -** connection Y's transaction to be concluded, and similarly connection -** Y is waiting on connection X's transaction, then neither connection -** will proceed and the system may remain deadlocked indefinitely. -** -** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock -** detection. ^If a given call to sqlite3_unlock_notify() would put the -** system in a deadlocked state, then SQLITE_LOCKED is returned and no -** unlock-notify callback is registered. The system is said to be in -** a deadlocked state if connection A has registered for an unlock-notify -** callback on the conclusion of connection B's transaction, and connection -** B has itself registered for an unlock-notify callback when connection -** A's transaction is concluded. ^Indirect deadlock is also detected, so -** the system is also considered to be deadlocked if connection B has -** registered for an unlock-notify callback on the conclusion of connection -** C's transaction, where connection C is waiting on connection A. ^Any -** number of levels of indirection are allowed. -** -** The "DROP TABLE" Exception -** -** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost -** always appropriate to call sqlite3_unlock_notify(). There is however, -** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, -** SQLite checks if there are any currently executing SELECT statements -** that belong to the same connection. If there are, SQLITE_LOCKED is -** returned. In this case there is no "blocking connection", so invoking -** sqlite3_unlock_notify() results in the unlock-notify callback being -** invoked immediately. If the application then re-attempts the "DROP TABLE" -** or "DROP INDEX" query, an infinite loop might be the result. -** -** One way around this problem is to check the extended error code returned -** by an sqlite3_step() call. ^(If there is a blocking connection, then the -** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in -** the special "DROP TABLE/INDEX" case, the extended error code is just -** SQLITE_LOCKED.)^ - */ -// llgo:link (*Sqlite3).UnlockNotify C.sqlite3_unlock_notify -func (recv_ *Sqlite3) UnlockNotify(xNotify func(*c.Pointer, c.Int), pNotifyArg c.Pointer) c.Int { - return 0 -} - -/* -** CAPI3REF: String Comparison -** -** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications -** and extensions to compare the contents of two buffers containing UTF-8 -** strings in a case-independent fashion, using the same definition of "case -** independence" that SQLite uses internally when comparing identifiers. - */ -//go:linkname Stricmp C.sqlite3_stricmp -func Stricmp(*c.Char, *c.Char) c.Int - -//go:linkname Strnicmp C.sqlite3_strnicmp -func Strnicmp(*c.Char, *c.Char, c.Int) c.Int - -/* -** CAPI3REF: String Globbing -* -** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if -** string X matches the [GLOB] pattern P. -** ^The definition of [GLOB] pattern matching used in -** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the -** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function -** is case sensitive. -** -** Note that this routine returns zero on a match and non-zero if the strings -** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. -** -** See also: [sqlite3_strlike()]. - */ -//go:linkname Strglob C.sqlite3_strglob -func Strglob(zGlob *c.Char, zStr *c.Char) c.Int - -/* -** CAPI3REF: String LIKE Matching -* -** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if -** string X matches the [LIKE] pattern P with escape character E. -** ^The definition of [LIKE] pattern matching used in -** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E" -** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without -** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0. -** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case -** insensitive - equivalent upper and lower case ASCII characters match -** one another. -** -** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though -** only ASCII characters are case folded. -** -** Note that this routine returns zero on a match and non-zero if the strings -** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. -** -** See also: [sqlite3_strglob()]. - */ -//go:linkname Strlike C.sqlite3_strlike -func Strlike(zGlob *c.Char, zStr *c.Char, cEsc c.Uint) c.Int - -/* -** CAPI3REF: Error Logging Interface -** -** ^The [sqlite3_log()] interface writes a message into the [error log] -** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. -** ^If logging is enabled, the zFormat string and subsequent arguments are -** used with [sqlite3_snprintf()] to generate the final output string. -** -** The sqlite3_log() interface is intended for use by extensions such as -** virtual tables, collating functions, and SQL functions. While there is -** nothing to prevent an application from calling sqlite3_log(), doing so -** is considered bad form. -** -** The zFormat string must not be NULL. -** -** To avoid deadlocks and other threading problems, the sqlite3_log() routine -** will not use dynamically allocated memory. The log message is stored in -** a fixed-length buffer on the stack. If the log message is longer than -** a few hundred characters, it will be truncated to the length of the -** buffer. - */ -//go:linkname Log C.sqlite3_log -func Log(iErrCode c.Int, zFormat *c.Char, __llgo_va_list ...interface{}) - -/* -** CAPI3REF: Write-Ahead Log Commit Hook -** METHOD: sqlite3 -** -** ^The [sqlite3_wal_hook()] function is used to register a callback that -** is invoked each time data is committed to a database in wal mode. -** -** ^(The callback is invoked by SQLite after the commit has taken place and -** the associated write-lock on the database released)^, so the implementation -** may read, write or [checkpoint] the database as required. -** -** ^The first parameter passed to the callback function when it is invoked -** is a copy of the third parameter passed to sqlite3_wal_hook() when -** registering the callback. ^The second is a copy of the database handle. -** ^The third parameter is the name of the database that was written to - -** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter -** is the number of pages currently in the write-ahead log file, -** including those that were just committed. -** -** The callback function should normally return [SQLITE_OK]. ^If an error -** code is returned, that error will propagate back up through the -** SQLite code base to cause the statement that provoked the callback -** to report an error, though the commit will have still occurred. If the -** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value -** that does not correspond to any valid SQLite error code, the results -** are undefined. -** -** A single database handle may have at most a single write-ahead log callback -** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any -** previously registered write-ahead log callback. ^The return value is -** a copy of the third parameter from the previous call, if any, or 0. -** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the -** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will -** overwrite any prior [sqlite3_wal_hook()] settings. - */ -// llgo:link (*Sqlite3).WalHook C.sqlite3_wal_hook -func (recv_ *Sqlite3) WalHook(func(c.Pointer, *Sqlite3, *c.Char, c.Int) c.Int, c.Pointer) c.Pointer { - return nil -} - -/* -** CAPI3REF: Configure an auto-checkpoint -** METHOD: sqlite3 -** -** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around -** [sqlite3_wal_hook()] that causes any database on [database connection] D -** to automatically [checkpoint] -** after committing a transaction if there are N or -** more frames in the [write-ahead log] file. ^Passing zero or -** a negative value as the nFrame parameter disables automatic -** checkpoints entirely. -** -** ^The callback registered by this function replaces any existing callback -** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback -** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism -** configured by this function. -** -** ^The [wal_autocheckpoint pragma] can be used to invoke this interface -** from SQL. -** -** ^Checkpoints initiated by this mechanism are -** [sqlite3_wal_checkpoint_v2|PASSIVE]. -** -** ^Every new [database connection] defaults to having the auto-checkpoint -** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT] -** pages. The use of this interface -** is only necessary if the default setting is found to be suboptimal -** for a particular application. - */ -// llgo:link (*Sqlite3).WalAutocheckpoint C.sqlite3_wal_autocheckpoint -func (recv_ *Sqlite3) WalAutocheckpoint(N c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Checkpoint a database -** METHOD: sqlite3 -** -** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to -** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^ -** -** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the -** [write-ahead log] for database X on [database connection] D to be -** transferred into the database file and for the write-ahead log to -** be reset. See the [checkpointing] documentation for addition -** information. -** -** This interface used to be the only way to cause a checkpoint to -** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()] -** interface was added. This interface is retained for backwards -** compatibility and as a convenience for applications that need to manually -** start a callback but which do not need the full power (and corresponding -** complication) of [sqlite3_wal_checkpoint_v2()]. - */ -// llgo:link (*Sqlite3).WalCheckpoint C.sqlite3_wal_checkpoint -func (recv_ *Sqlite3) WalCheckpoint(zDb *c.Char) c.Int { - return 0 -} - -/* -** CAPI3REF: Checkpoint a database -** METHOD: sqlite3 -** -** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint -** operation on database X of [database connection] D in mode M. Status -** information is written back into integers pointed to by L and C.)^ -** ^(The M parameter must be a valid [checkpoint mode]:)^ -** -**
-**
SQLITE_CHECKPOINT_PASSIVE
-** ^Checkpoint as many frames as possible without waiting for any database -** readers or writers to finish, then sync the database file if all frames -** in the log were checkpointed. ^The [busy-handler callback] -** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode. -** ^On the other hand, passive mode might leave the checkpoint unfinished -** if there are concurrent readers or writers. -** -**
SQLITE_CHECKPOINT_FULL
-** ^This mode blocks (it invokes the -** [sqlite3_busy_handler|busy-handler callback]) until there is no -** database writer and all readers are reading from the most recent database -** snapshot. ^It then checkpoints all frames in the log file and syncs the -** database file. ^This mode blocks new database writers while it is pending, -** but new database readers are allowed to continue unimpeded. -** -**
SQLITE_CHECKPOINT_RESTART
-** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition -** that after checkpointing the log file it blocks (calls the -** [busy-handler callback]) -** until all readers are reading from the database file only. ^This ensures -** that the next writer will restart the log file from the beginning. -** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new -** database writer attempts while it is pending, but does not impede readers. -** -**
SQLITE_CHECKPOINT_TRUNCATE
-** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the -** addition that it also truncates the log file to zero bytes just prior -** to a successful return. -**
-** -** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in -** the log file or to -1 if the checkpoint could not run because -** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not -** NULL,then *pnCkpt is set to the total number of checkpointed frames in the -** log file (including any that were already checkpointed before the function -** was called) or to -1 if the checkpoint could not run due to an error or -** because the database is not in WAL mode. ^Note that upon successful -** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been -** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero. -** -** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If -** any other process is running a checkpoint operation at the same time, the -** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a -** busy-handler configured, it will not be invoked in this case. -** -** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the -** exclusive "writer" lock on the database file. ^If the writer lock cannot be -** obtained immediately, and a busy-handler is configured, it is invoked and -** the writer lock retried until either the busy-handler returns 0 or the lock -** is successfully obtained. ^The busy-handler is also invoked while waiting for -** database readers as described above. ^If the busy-handler returns 0 before -** the writer lock is obtained or while waiting for database readers, the -** checkpoint operation proceeds from that point in the same way as -** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible -** without blocking any further. ^SQLITE_BUSY is returned in this case. -** -** ^If parameter zDb is NULL or points to a zero length string, then the -** specified operation is attempted on all WAL databases [attached] to -** [database connection] db. In this case the -** values written to output parameters *pnLog and *pnCkpt are undefined. ^If -** an SQLITE_BUSY error is encountered when processing one or more of the -** attached WAL databases, the operation is still attempted on any remaining -** attached databases and SQLITE_BUSY is returned at the end. ^If any other -** error occurs while processing an attached database, processing is abandoned -** and the error code is returned to the caller immediately. ^If no error -** (SQLITE_BUSY or otherwise) is encountered while processing the attached -** databases, SQLITE_OK is returned. -** -** ^If database zDb is the name of an attached database that is not in WAL -** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If -** zDb is not NULL (or a zero length string) and is not the name of any -** attached database, SQLITE_ERROR is returned to the caller. -** -** ^Unless it returns SQLITE_MISUSE, -** the sqlite3_wal_checkpoint_v2() interface -** sets the error information that is queried by -** [sqlite3_errcode()] and [sqlite3_errmsg()]. -** -** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface -** from SQL. - */ -// llgo:link (*Sqlite3).WalCheckpointV2 C.sqlite3_wal_checkpoint_v2 -func (recv_ *Sqlite3) WalCheckpointV2(zDb *c.Char, eMode c.Int, pnLog *c.Int, pnCkpt *c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Virtual Table Interface Configuration -** -** This function may be called by either the [xConnect] or [xCreate] method -** of a [virtual table] implementation to configure -** various facets of the virtual table interface. -** -** If this interface is invoked outside the context of an xConnect or -** xCreate virtual table method then the behavior is undefined. -** -** In the call sqlite3_vtab_config(D,C,...) the D parameter is the -** [database connection] in which the virtual table is being created and -** which is passed in as the first argument to the [xConnect] or [xCreate] -** method that is invoking sqlite3_vtab_config(). The C parameter is one -** of the [virtual table configuration options]. The presence and meaning -** of parameters after C depend on which [virtual table configuration option] -** is used. - */ -//go:linkname VtabConfig C.sqlite3_vtab_config -func VtabConfig(__llgo_arg_0 *Sqlite3, op c.Int, __llgo_va_list ...interface{}) c.Int - -/* -** CAPI3REF: Determine The Virtual Table Conflict Policy -** -** This function may only be called from within a call to the [xUpdate] method -** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The -** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL], -** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode -** of the SQL statement that triggered the call to the [xUpdate] method of the -** [virtual table]. - */ -// llgo:link (*Sqlite3).VtabOnConflict C.sqlite3_vtab_on_conflict -func (recv_ *Sqlite3) VtabOnConflict() c.Int { - return 0 -} - -/* -** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE -** -** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn] -** method of a [virtual table], then it might return true if the -** column is being fetched as part of an UPDATE operation during which the -** column value will not change. The virtual table implementation can use -** this hint as permission to substitute a return value that is less -** expensive to compute and that the corresponding -** [xUpdate] method understands as a "no-change" value. -** -** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that -** the column is not changed by the UPDATE statement, then the xColumn -** method can optionally return without setting a result, without calling -** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces]. -** In that case, [sqlite3_value_nochange(X)] will return true for the -** same column in the [xUpdate] method. -** -** The sqlite3_vtab_nochange() routine is an optimization. Virtual table -** implementations should continue to give a correct answer even if the -** sqlite3_vtab_nochange() interface were to always return false. In the -** current implementation, the sqlite3_vtab_nochange() interface does always -** returns false for the enhanced [UPDATE FROM] statement. - */ -// llgo:link (*Context).VtabNochange C.sqlite3_vtab_nochange -func (recv_ *Context) VtabNochange() c.Int { - return 0 -} - -/* -** CAPI3REF: Determine The Collation For a Virtual Table Constraint -** METHOD: sqlite3_index_info -** -** This function may only be called from within a call to the [xBestIndex] -** method of a [virtual table]. This function returns a pointer to a string -** that is the name of the appropriate collation sequence to use for text -** comparisons on the constraint identified by its arguments. -** -** The first argument must be the pointer to the [sqlite3_index_info] object -** that is the first parameter to the xBestIndex() method. The second argument -** must be an index into the aConstraint[] array belonging to the -** sqlite3_index_info structure passed to xBestIndex. -** -** Important: -** The first parameter must be the same pointer that is passed into the -** xBestMethod() method. The first parameter may not be a pointer to a -** different [sqlite3_index_info] object, even an exact copy. -** -** The return value is computed as follows: -** -**
    -**
  1. If the constraint comes from a WHERE clause expression that contains -** a [COLLATE operator], then the name of the collation specified by -** that COLLATE operator is returned. -**

  2. If there is no COLLATE operator, but the column that is the subject -** of the constraint specifies an alternative collating sequence via -** a [COLLATE clause] on the column definition within the CREATE TABLE -** statement that was passed into [sqlite3_declare_vtab()], then the -** name of that alternative collating sequence is returned. -**

  3. Otherwise, "BINARY" is returned. -**

- */ -// llgo:link (*IndexInfo).VtabCollation C.sqlite3_vtab_collation -func (recv_ *IndexInfo) VtabCollation(c.Int) *c.Char { - return nil -} - -/* -** CAPI3REF: Determine if a virtual table query is DISTINCT -** METHOD: sqlite3_index_info -** -** This API may only be used from within an [xBestIndex|xBestIndex method] -** of a [virtual table] implementation. The result of calling this -** interface from outside of xBestIndex() is undefined and probably harmful. -** -** ^The sqlite3_vtab_distinct() interface returns an integer between 0 and -** 3. The integer returned by sqlite3_vtab_distinct() -** gives the virtual table additional information about how the query -** planner wants the output to be ordered. As long as the virtual table -** can meet the ordering requirements of the query planner, it may set -** the "orderByConsumed" flag. -** -**
  1. -** ^If the sqlite3_vtab_distinct() interface returns 0, that means -** that the query planner needs the virtual table to return all rows in the -** sort order defined by the "nOrderBy" and "aOrderBy" fields of the -** [sqlite3_index_info] object. This is the default expectation. If the -** virtual table outputs all rows in sorted order, then it is always safe for -** the xBestIndex method to set the "orderByConsumed" flag, regardless of -** the return value from sqlite3_vtab_distinct(). -**

  2. -** ^(If the sqlite3_vtab_distinct() interface returns 1, that means -** that the query planner does not need the rows to be returned in sorted order -** as long as all rows with the same values in all columns identified by the -** "aOrderBy" field are adjacent.)^ This mode is used when the query planner -** is doing a GROUP BY. -**

  3. -** ^(If the sqlite3_vtab_distinct() interface returns 2, that means -** that the query planner does not need the rows returned in any particular -** order, as long as rows with the same values in all columns identified -** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows -** contain the same values for all columns identified by "colUsed", all but -** one such row may optionally be omitted from the result.)^ -** The virtual table is not required to omit rows that are duplicates -** over the "colUsed" columns, but if the virtual table can do that without -** too much extra effort, it could potentially help the query to run faster. -** This mode is used for a DISTINCT query. -**

  4. -** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the -** virtual table must return rows in the order defined by "aOrderBy" as -** if the sqlite3_vtab_distinct() interface had returned 0. However if -** two or more rows in the result have the same values for all columns -** identified by "colUsed", then all but one such row may optionally be -** omitted.)^ Like when the return value is 2, the virtual table -** is not required to omit rows that are duplicates over the "colUsed" -** columns, but if the virtual table can do that without -** too much extra effort, it could potentially help the query to run faster. -** This mode is used for queries -** that have both DISTINCT and ORDER BY clauses. -**

-** -**

The following table summarizes the conditions under which the -** virtual table is allowed to set the "orderByConsumed" flag based on -** the value returned by sqlite3_vtab_distinct(). This table is a -** restatement of the previous four paragraphs: -** -** -** -**
sqlite3_vtab_distinct() return value -** Rows are returned in aOrderBy order -** Rows with the same value in all aOrderBy columns are adjacent -** Duplicates over all colUsed columns may be omitted -**
0yesyesno -**
1noyesno -**
2noyesyes -**
3yesyesyes -**
-** -** ^For the purposes of comparing virtual table output values to see if the -** values are same value for sorting purposes, two NULL values are considered -** to be the same. In other words, the comparison operator is "IS" -** (or "IS NOT DISTINCT FROM") and not "==". -** -** If a virtual table implementation is unable to meet the requirements -** specified above, then it must not set the "orderByConsumed" flag in the -** [sqlite3_index_info] object or an incorrect answer may result. -** -** ^A virtual table implementation is always free to return rows in any order -** it wants, as long as the "orderByConsumed" flag is not set. ^When the -** the "orderByConsumed" flag is unset, the query planner will add extra -** [bytecode] to ensure that the final results returned by the SQL query are -** ordered correctly. The use of the "orderByConsumed" flag and the -** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful -** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" -** flag might help queries against a virtual table to run faster. Being -** overly aggressive and setting the "orderByConsumed" flag when it is not -** valid to do so, on the other hand, might cause SQLite to return incorrect -** results. - */ -// llgo:link (*IndexInfo).VtabDistinct C.sqlite3_vtab_distinct -func (recv_ *IndexInfo) VtabDistinct() c.Int { - return 0 -} - -/* -** CAPI3REF: Identify and handle IN constraints in xBestIndex -** -** This interface may only be used from within an -** [xBestIndex|xBestIndex() method] of a [virtual table] implementation. -** The result of invoking this interface from any other context is -** undefined and probably harmful. -** -** ^(A constraint on a virtual table of the form -** "[IN operator|column IN (...)]" is -** communicated to the xBestIndex method as a -** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use -** this constraint, it must set the corresponding -** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under -** the usual mode of handling IN operators, SQLite generates [bytecode] -** that invokes the [xFilter|xFilter() method] once for each value -** on the right-hand side of the IN operator.)^ Thus the virtual table -** only sees a single value from the right-hand side of the IN operator -** at a time. -** -** In some cases, however, it would be advantageous for the virtual -** table to see all values on the right-hand of the IN operator all at -** once. The sqlite3_vtab_in() interfaces facilitates this in two ways: -** -**

    -**
  1. -** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero) -** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint -** is an [IN operator] that can be processed all at once. ^In other words, -** sqlite3_vtab_in() with -1 in the third argument is a mechanism -** by which the virtual table can ask SQLite if all-at-once processing -** of the IN operator is even possible. -** -**

  2. -** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates -** to SQLite that the virtual table does or does not want to process -** the IN operator all-at-once, respectively. ^Thus when the third -** parameter (F) is non-negative, this interface is the mechanism by -** which the virtual table tells SQLite how it wants to process the -** IN operator. -**

-** -** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times -** within the same xBestIndex method call. ^For any given P,N pair, -** the return value from sqlite3_vtab_in(P,N,F) will always be the same -** within the same xBestIndex call. ^If the interface returns true -** (non-zero), that means that the constraint is an IN operator -** that can be processed all-at-once. ^If the constraint is not an IN -** operator or cannot be processed all-at-once, then the interface returns -** false. -** -** ^(All-at-once processing of the IN operator is selected if both of the -** following conditions are met: -** -**
    -**
  1. The P->aConstraintUsage[N].argvIndex value is set to a positive -** integer. This is how the virtual table tells SQLite that it wants to -** use the N-th constraint. -** -**

  2. The last call to sqlite3_vtab_in(P,N,F) for which F was -** non-negative had F>=1. -**

)^ -** -** ^If either or both of the conditions above are false, then SQLite uses -** the traditional one-at-a-time processing strategy for the IN constraint. -** ^If both conditions are true, then the argvIndex-th parameter to the -** xFilter method will be an [sqlite3_value] that appears to be NULL, -** but which can be passed to [sqlite3_vtab_in_first()] and -** [sqlite3_vtab_in_next()] to find all values on the right-hand side -** of the IN constraint. - */ -// llgo:link (*IndexInfo).VtabIn C.sqlite3_vtab_in -func (recv_ *IndexInfo) VtabIn(iCons c.Int, bHandle c.Int) c.Int { - return 0 -} - -/* -** CAPI3REF: Find all elements on the right-hand side of an IN constraint. -** -** These interfaces are only useful from within the -** [xFilter|xFilter() method] of a [virtual table] implementation. -** The result of invoking these interfaces from any other context -** is undefined and probably harmful. -** -** The X parameter in a call to sqlite3_vtab_in_first(X,P) or -** sqlite3_vtab_in_next(X,P) should be one of the parameters to the -** xFilter method which invokes these routines, and specifically -** a parameter that was previously selected for all-at-once IN constraint -** processing use the [sqlite3_vtab_in()] interface in the -** [xBestIndex|xBestIndex method]. ^(If the X parameter is not -** an xFilter argument that was selected for all-at-once IN constraint -** processing, then these routines return [SQLITE_ERROR].)^ -** -** ^(Use these routines to access all values on the right-hand side -** of the IN constraint using code like the following: -** -**
-**    for(rc=sqlite3_vtab_in_first(pList, &pVal);
-**        rc==SQLITE_OK && pVal;
-**        rc=sqlite3_vtab_in_next(pList, &pVal)
-**    ){
-**      // do something with pVal
-**    }
-**    if( rc!=SQLITE_OK ){
-**      // an error has occurred
-**    }
-** 
)^ -** -** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P) -** routines return SQLITE_OK and set *P to point to the first or next value -** on the RHS of the IN constraint. ^If there are no more values on the -** right hand side of the IN constraint, then *P is set to NULL and these -** routines return [SQLITE_DONE]. ^The return value might be -** some other value, such as SQLITE_NOMEM, in the event of a malfunction. -** -** The *ppOut values returned by these routines are only valid until the -** next call to either of these routines or until the end of the xFilter -** method from which these routines were called. If the virtual table -** implementation needs to retain the *ppOut values for longer, it must make -** copies. The *ppOut values are [protected sqlite3_value|protected]. - */ -// llgo:link (*Value).VtabInFirst C.sqlite3_vtab_in_first -func (recv_ *Value) VtabInFirst(ppOut **Value) c.Int { - return 0 -} - -// llgo:link (*Value).VtabInNext C.sqlite3_vtab_in_next -func (recv_ *Value) VtabInNext(ppOut **Value) c.Int { - return 0 -} - -/* -** CAPI3REF: Constraint values in xBestIndex() -** METHOD: sqlite3_index_info -** -** This API may only be used from within the [xBestIndex|xBestIndex method] -** of a [virtual table] implementation. The result of calling this interface -** from outside of an xBestIndex method are undefined and probably harmful. -** -** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within -** the [xBestIndex] method of a [virtual table] implementation, with P being -** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and -** J being a 0-based index into P->aConstraint[], then this routine -** attempts to set *V to the value of the right-hand operand of -** that constraint if the right-hand operand is known. ^If the -** right-hand operand is not known, then *V is set to a NULL pointer. -** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if -** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) -** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th -** constraint is not available. ^The sqlite3_vtab_rhs_value() interface -** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if -** something goes wrong. -** -** The sqlite3_vtab_rhs_value() interface is usually only successful if -** the right-hand operand of a constraint is a literal value in the original -** SQL statement. If the right-hand operand is an expression or a reference -** to some other column or a [host parameter], then sqlite3_vtab_rhs_value() -** will probably return [SQLITE_NOTFOUND]. -** -** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and -** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such -** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^ -** -** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value -** and remains valid for the duration of the xBestIndex method call. -** ^When xBestIndex returns, the sqlite3_value object returned by -** sqlite3_vtab_rhs_value() is automatically deallocated. -** -** The "_rhs_" in the name of this routine is an abbreviation for -** "Right-Hand Side". - */ -// llgo:link (*IndexInfo).VtabRhsValue C.sqlite3_vtab_rhs_value -func (recv_ *IndexInfo) VtabRhsValue(__llgo_arg_0 c.Int, ppVal **Value) c.Int { - return 0 -} - -/* -** CAPI3REF: Flush caches to disk mid-transaction -** METHOD: sqlite3 -** -** ^If a write-transaction is open on [database connection] D when the -** [sqlite3_db_cacheflush(D)] interface invoked, any dirty -** pages in the pager-cache that are not currently in use are written out -** to disk. A dirty page may be in use if a database cursor created by an -** active SQL statement is reading from it, or if it is page 1 of a database -** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)] -** interface flushes caches for all schemas - "main", "temp", and -** any [attached] databases. -** -** ^If this function needs to obtain extra database locks before dirty pages -** can be flushed to disk, it does so. ^If those locks cannot be obtained -** immediately and there is a busy-handler callback configured, it is invoked -** in the usual manner. ^If the required lock still cannot be obtained, then -** the database is skipped and an attempt made to flush any dirty pages -** belonging to the next (if any) database. ^If any databases are skipped -** because locks cannot be obtained, but no other error occurs, this -** function returns SQLITE_BUSY. -** -** ^If any other error occurs while flushing dirty pages to disk (for -** example an IO error or out-of-memory condition), then processing is -** abandoned and an SQLite [error code] is returned to the caller immediately. -** -** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK. -** -** ^This function does not set the database handle error code or message -** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions. - */ -// llgo:link (*Sqlite3).DbCacheflush C.sqlite3_db_cacheflush -func (recv_ *Sqlite3) DbCacheflush() c.Int { - return 0 -} - -/* -** CAPI3REF: Low-level system error code -** METHOD: sqlite3 -** -** ^Attempt to return the underlying operating system error code or error -** number that caused the most recent I/O error or failure to open a file. -** The return value is OS-dependent. For example, on unix systems, after -** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be -** called to get back the underlying "errno" that caused the problem, such -** as ENOSPC, EAUTH, EISDIR, and so forth. - */ -// llgo:link (*Sqlite3).SystemErrno C.sqlite3_system_errno -func (recv_ *Sqlite3) SystemErrno() c.Int { - return 0 -} - -/* -** CAPI3REF: Database Snapshot -** KEYWORDS: {snapshot} {sqlite3_snapshot} -** -** An instance of the snapshot object records the state of a [WAL mode] -** database for some specific point in history. -** -** In [WAL mode], multiple [database connections] that are open on the -** same database file can each be reading a different historical version -** of the database file. When a [database connection] begins a read -** transaction, that connection sees an unchanging copy of the database -** as it existed for the point in time when the transaction first started. -** Subsequent changes to the database from other connections are not seen -** by the reader until a new read transaction is started. -** -** The sqlite3_snapshot object records state information about an historical -** version of the database file so that it is possible to later open a new read -** transaction that sees that historical version of the database rather than -** the most recent version. - */ -type Snapshot struct { - Hidden [48]c.Char -} - -/* -** CAPI3REF: Serialize a database -** -** The sqlite3_serialize(D,S,P,F) interface returns a pointer to -** memory that is a serialization of the S database on -** [database connection] D. If S is a NULL pointer, the main database is used. -** If P is not a NULL pointer, then the size of the database in bytes -** is written into *P. -** -** For an ordinary on-disk database file, the serialization is just a -** copy of the disk file. For an in-memory database or a "TEMP" database, -** the serialization is the same sequence of bytes which would be written -** to disk if that database where backed up to disk. -** -** The usual case is that sqlite3_serialize() copies the serialization of -** the database into memory obtained from [sqlite3_malloc64()] and returns -** a pointer to that memory. The caller is responsible for freeing the -** returned value to avoid a memory leak. However, if the F argument -** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations -** are made, and the sqlite3_serialize() function will return a pointer -** to the contiguous memory representation of the database that SQLite -** is currently using for that database, or NULL if the no such contiguous -** memory representation of the database exists. A contiguous memory -** representation of the database will usually only exist if there has -** been a prior call to [sqlite3_deserialize(D,S,...)] with the same -** values of D and S. -** The size of the database is written into *P even if the -** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy -** of the database exists. -** -** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set, -** the returned buffer content will remain accessible and unchanged -** until either the next write operation on the connection or when -** the connection is closed, and applications must not modify the -** buffer. If the bit had been clear, the returned buffer will not -** be accessed by SQLite after the call. -** -** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the -** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory -** allocation error occurs. -** -** This interface is omitted if SQLite is compiled with the -** [SQLITE_OMIT_DESERIALIZE] option. - */ -// llgo:link (*Sqlite3).Serialize C.sqlite3_serialize -func (recv_ *Sqlite3) Serialize(zSchema *c.Char, piSize *Int64, mFlags c.Uint) *c.Char { - return nil -} - -/* -** CAPI3REF: Deserialize a database -** -** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the -** [database connection] D to disconnect from database S and then -** reopen S as an in-memory database based on the serialization contained -** in P. The serialized database P is N bytes in size. M is the size of -** the buffer P, which might be larger than N. If M is larger than N, and -** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is -** permitted to add content to the in-memory database as long as the total -** size does not exceed M bytes. -** -** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will -** invoke sqlite3_free() on the serialization buffer when the database -** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then -** SQLite will try to increase the buffer size using sqlite3_realloc64() -** if writes on the database cause it to grow larger than M bytes. -** -** Applications must not modify the buffer P or invalidate it before -** the database connection D is closed. -** -** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the -** database is currently in a read transaction or is involved in a backup -** operation. -** -** It is not possible to deserialized into the TEMP database. If the -** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the -** function returns SQLITE_ERROR. -** -** The deserialized database should not be in [WAL mode]. If the database -** is in WAL mode, then any attempt to use the database file will result -** in an [SQLITE_CANTOPEN] error. The application can set the -** [file format version numbers] (bytes 18 and 19) of the input database P -** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the -** database file into rollback mode and work around this limitation. -** -** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the -** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then -** [sqlite3_free()] is invoked on argument P prior to returning. -** -** This interface is omitted if SQLite is compiled with the -** [SQLITE_OMIT_DESERIALIZE] option. - */ -// llgo:link (*Sqlite3).Deserialize C.sqlite3_deserialize -func (recv_ *Sqlite3) Deserialize(zSchema *c.Char, pData *c.Char, szDb Int64, szBuf Int64, mFlags c.Uint) c.Int { - return 0 -} - -type RtreeGeometry struct { - PContext c.Pointer - NParam c.Int - AParam *RtreeDbl - PUser c.Pointer - XDelUser c.Pointer -} - -type RtreeQueryInfo struct { - PContext c.Pointer - NParam c.Int - AParam *RtreeDbl - PUser c.Pointer - XDelUser c.Pointer - ACoord *RtreeDbl - AnQueue *c.Uint - NCoord c.Int - ILevel c.Int - MxLevel c.Int - IRowid Int64 - RParentScore RtreeDbl - EParentWithin c.Int - EWithin c.Int - RScore RtreeDbl - ApSqlParam **Value -} -type RtreeDbl c.Double - -/* -** Register a geometry callback named zGeom that can be used as part of an -** R-Tree geometry query as follows: -** -** SELECT ... FROM WHERE MATCH $zGeom(... params ...) - */ -// llgo:link (*Sqlite3).RtreeGeometryCallback C.sqlite3_rtree_geometry_callback -func (recv_ *Sqlite3) RtreeGeometryCallback(zGeom *c.Char, xGeom func(*RtreeGeometry, c.Int, *RtreeDbl, *c.Int) c.Int, pContext c.Pointer) c.Int { - return 0 -} - -/* -** Register a 2nd-generation geometry callback named zScore that can be -** used as part of an R-Tree geometry query as follows: -** -** SELECT ... FROM WHERE MATCH $zQueryFunc(... params ...) - */ -// llgo:link (*Sqlite3).RtreeQueryCallback C.sqlite3_rtree_query_callback -func (recv_ *Sqlite3) RtreeQueryCallback(zQueryFunc *c.Char, xQueryFunc func(*RtreeQueryInfo) c.Int, pContext c.Pointer, xDestructor func(c.Pointer)) c.Int { - return 0 -} - -type Fts5ExtensionApi struct { - IVersion c.Int - XUserData c.Pointer - XColumnCount c.Pointer - XRowCount c.Pointer - XColumnTotalSize c.Pointer - XTokenize c.Pointer - XPhraseCount c.Pointer - XPhraseSize c.Pointer - XInstCount c.Pointer - XInst c.Pointer - XRowid c.Pointer - XColumnText c.Pointer - XColumnSize c.Pointer - XQueryPhrase c.Pointer - XSetAuxdata c.Pointer - XGetAuxdata c.Pointer - XPhraseFirst c.Pointer - XPhraseNext c.Pointer - XPhraseFirstColumn c.Pointer - XPhraseNextColumn c.Pointer - XQueryToken c.Pointer - XInstToken c.Pointer - XColumnLocale c.Pointer - XTokenizeV2 c.Pointer -} - -type Fts5Context struct { - Unused [8]uint8 -} - -type Fts5PhraseIter struct { - A *c.Char - B *c.Char -} - -// llgo:type C -type Fts5ExtensionFunction func(*Fts5ExtensionApi, *Fts5Context, *Context, c.Int, **Value) - -type Fts5Tokenizer struct { - Unused [8]uint8 -} - -type Fts5TokenizerV2 struct { - IVersion c.Int - XCreate c.Pointer - XDelete c.Pointer - XTokenize c.Pointer -} - -type Fts5Tokenizer__1 struct { - XCreate c.Pointer - XDelete c.Pointer - XTokenize c.Pointer -} - -type Fts5Api struct { - IVersion c.Int - XCreateTokenizer c.Pointer - XFindTokenizer c.Pointer - XCreateFunction c.Pointer - XCreateTokenizerV2 c.Pointer - XFindTokenizerV2 c.Pointer -} diff --git a/sqlite3/sqlite3_autogen_link.go b/sqlite3/sqlite3_autogen_link.go deleted file mode 100644 index 0b4f488c..00000000 --- a/sqlite3/sqlite3_autogen_link.go +++ /dev/null @@ -1,5 +0,0 @@ -package sqlite3 - -import _ "github.com/goplus/lib/c" - -const LLGoPackage string = "link: $(pkg-config --libs sqlite3);" diff --git a/sqlite3/sqlite3ext.go b/sqlite3/sqlite3ext.go deleted file mode 100644 index aac9c333..00000000 --- a/sqlite3/sqlite3ext.go +++ /dev/null @@ -1,9 +0,0 @@ -package sqlite3 - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// llgo:type C -type LoadextEntry func(*Sqlite3, **c.Char, *ApiRoutines) c.Int diff --git a/zlib/_demo/crc32demo/demo.go b/zlib/_demo/crc32demo/demo.go deleted file mode 100644 index 7615486c..00000000 --- a/zlib/_demo/crc32demo/demo.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import ( - "fmt" - "unsafe" - - "github.com/goplus/llpkg/zlib" -) - -func main() { - ul := zlib.ULong(0) - data := "Hello world" - res := ul.Crc32Z( - (*zlib.Bytef)(unsafe.Pointer(unsafe.StringData(data))), - zlib.ZSizeT(uintptr(len(data))), - ) - fmt.Printf("%08x\n", res) -} diff --git a/zlib/_demo/efficiency/efficiency.go b/zlib/_demo/efficiency/efficiency.go deleted file mode 100644 index 9bd8a57d..00000000 --- a/zlib/_demo/efficiency/efficiency.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/goplus/llpkg/zlib" - - "github.com/goplus/lib/c" -) - -func main() { - txt := []byte("zlib is a software library used for data compression. It was created by Jean-loup Gailly and Mark Adler and first released in 1995. zlib is designed to be a free, legally unencumbered—that is, not covered by any patents—alternative to the proprietary DEFLATE compression algorithm, which is often used in software applications for data compression.The library provides functions to compress and decompress data using the DEFLATE algorithm, which is a combination of the LZ77 algorithm and Huffman coding. zlib is notable for its versatility; it can be used in a wide range of applications, from web servers and web clients compressing HTTP data, to the compression of data for storage or transmission in various file formats, such as PNG, ZIP, and GZIP.") - txtLen := zlib.ULong(len(txt)) - - for level := 0; level <= 9; level++ { - cmpSize := zlib.ULongf(zlib.CompressBound(txtLen)) - cmpData := make([]byte, int(cmpSize)) - data := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData))) - source := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(txt))) - res := zlib.Compress2(data, &cmpSize, source, txtLen, c.Int(level)) - if res != zlib.OK { - c.Printf(c.Str("\nCompression failed at level %d: %d\n"), level, res) - continue - } - - c.Printf(c.Str("Compression level %d: Text length = %d, Compressed size = %d\n"), level, txtLen, cmpSize) - - ucmpSize := zlib.ULongf(txtLen) - ucmp := make([]byte, int(ucmpSize)) - ucmpData := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(ucmp))) - cmpSource := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData))) - - unRes := zlib.Uncompress(ucmpData, &ucmpSize, cmpSource, zlib.ULong(cmpSize)) - if unRes != zlib.OK { - c.Printf(c.Str("\nDecompression failed at level %d: %d\n"), level, unRes) - continue - } - } -} diff --git a/zlib/_demo/normal/normal.go b/zlib/_demo/normal/normal.go deleted file mode 100644 index e69eb2cb..00000000 --- a/zlib/_demo/normal/normal.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/goplus/llpkg/zlib" - - "github.com/goplus/lib/c" -) - -func main() { - txt := []byte("zlib is a software library used for data compression. It was created by Jean-loup Gailly and Mark Adler and first released in 1995. zlib is designed to be a free, legally unencumbered—that is, not covered by any patents—alternative to the proprietary DEFLATE compression algorithm, which is often used in software applications for data compression.The library provides functions to compress and decompress data using the DEFLATE algorithm, which is a combination of the LZ77 algorithm and Huffman coding. zlib is notable for its versatility; it can be used in a wide range of applications, from web servers and web clients compressing HTTP data, to the compression of data for storage or transmission in various file formats, such as PNG, ZIP, and GZIP.") - txtLen := zlib.ULong(len(txt)) - - cmpSize := zlib.ULongf(zlib.CompressBound(txtLen)) - cmpData := make([]byte, int(cmpSize)) - data := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData))) - txtData := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(txt))) - - res := zlib.Compress(data, &cmpSize, txtData, txtLen) - if res != zlib.OK { - c.Printf(c.Str("\nCompression failed: %d\n"), res) - return - } - - c.Printf(c.Str("Text length = %d, Compressed size = %d\n"), txtLen, cmpSize) - - ucmpSize := zlib.ULongf(txtLen) - ucmp := make([]byte, int(ucmpSize)) - ucmpPtr := (*zlib.Bytef)(unsafe.Pointer(unsafe.SliceData(ucmp))) - - unRes := zlib.Uncompress(ucmpPtr, &ucmpSize, data, zlib.ULong(cmpSize)) - c.Printf(c.Str("Decompression result = %d, Decompressed size %d\n"), unRes, ucmpSize) - - if unRes != zlib.OK { - c.Printf(c.Str("\nDecompression failed: %d\n"), unRes) - return - } - - c.Printf(c.Str("Decompressed data: \n")) - for i := 0; i < int(ucmpSize); i++ { - c.Printf(c.Str("%c"), ucmp[i]) - } -} diff --git a/zlib/go.mod b/zlib/go.mod deleted file mode 100644 index 46b9aa65..00000000 --- a/zlib/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/goplus/llpkg/zlib - -go 1.20 - -require github.com/goplus/lib v0.2.0 diff --git a/zlib/go.sum b/zlib/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/zlib/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/zlib/llcppg.cfg b/zlib/llcppg.cfg deleted file mode 100644 index acb218f3..00000000 --- a/zlib/llcppg.cfg +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "zlib", - "cflags": "$(pkg-config --cflags zlib)", - "libs": "$(pkg-config --libs zlib)", - "include": [ - "zlib.h", - "zconf.h" - ], - "trimPrefixes": ["Z_","ZLIB_", "zlib"], - "cplusplus": false, - "deps": ["c/os"], - "keepUnderScore": false, - "symMap":{ - "compress":"Compress", - "compress2":"Compress2", - "uncompress":"Uncompress", - "uncompress2":"Uncompress2", - "compressBound":"CompressBound" - } -} diff --git a/zlib/llcppg.pub b/zlib/llcppg.pub deleted file mode 100644 index a43151e2..00000000 --- a/zlib/llcppg.pub +++ /dev/null @@ -1,26 +0,0 @@ -Byte -Bytef -alloc_func AllocFunc -charf Charf -free_func FreeFunc -gzFile GzFile -gzFile_s GzFileS -gz_header GzHeader -gz_header_s GzHeaderS -gz_headerp GzHeaderp -in_func InFunc -internal_state InternalState -intf Intf -out_func OutFunc -uInt UInt -uIntf UIntf -uLong ULong -uLongf ULongf -voidp Voidp -voidpc Voidpc -voidpf Voidpf -z_crc_t ZCrcT -z_size_t ZSizeT -z_stream ZStream -z_stream_s ZStreamS -z_streamp ZStreamp \ No newline at end of file diff --git a/zlib/llpkg.cfg b/zlib/llpkg.cfg deleted file mode 100644 index dfdf09cc..00000000 --- a/zlib/llpkg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "upstream": { - "package": { - "name": "zlib", - "version": "1.3.1" - } - } -} \ No newline at end of file diff --git a/zlib/zconf.go b/zlib/zconf.go deleted file mode 100644 index 1a863118..00000000 --- a/zlib/zconf.go +++ /dev/null @@ -1,23 +0,0 @@ -package zlib - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const MAX_MEM_LEVEL = 9 -const MAX_WBITS = 15 - -type ZSizeT c.SizeT -type Byte c.Char -type UInt c.Uint -type ULong c.Ulong -type Bytef Byte -type Charf c.Char -type Intf c.Int -type UIntf UInt -type ULongf ULong -type Voidpc c.Pointer -type Voidpf c.Pointer -type Voidp c.Pointer -type ZCrcT c.Uint diff --git a/zlib/zlib.go b/zlib/zlib.go deleted file mode 100644 index 48a051de..00000000 --- a/zlib/zlib.go +++ /dev/null @@ -1,1518 +0,0 @@ -package zlib - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/os" - _ "unsafe" -) - -const VERSION = "1.3.1" -const VERNUM = 0x1310 -const VER_MAJOR = 1 -const VER_MINOR = 3 -const VER_REVISION = 1 -const VER_SUBREVISION = 0 -const NO_FLUSH = 0 -const PARTIAL_FLUSH = 1 -const SYNC_FLUSH = 2 -const FULL_FLUSH = 3 -const FINISH = 4 -const BLOCK = 5 -const TREES = 6 -const OK = 0 -const STREAM_END = 1 -const NEED_DICT = 2 -const NO_COMPRESSION = 0 -const BEST_SPEED = 1 -const BEST_COMPRESSION = 9 -const FILTERED = 1 -const HUFFMAN_ONLY = 2 -const RLE = 3 -const FIXED = 4 -const DEFAULT_STRATEGY = 0 -const BINARY = 0 -const TEXT = 1 -const UNKNOWN = 2 -const DEFLATED = 8 -const NULL = 0 - -// llgo:type C -type AllocFunc func(Voidpf, UInt, UInt) Voidpf - -// llgo:type C -type FreeFunc func(Voidpf, Voidpf) - -type InternalState struct { - Unused [8]uint8 -} - -type ZStreamS struct { - NextIn *Bytef - AvailIn UInt - TotalIn ULong - NextOut *Bytef - AvailOut UInt - TotalOut ULong - Msg *c.Char - State *InternalState - Zalloc AllocFunc - Zfree FreeFunc - Opaque Voidpf - DataType c.Int - Adler ULong - Reserved ULong -} -type ZStream ZStreamS -type ZStreamp *ZStream - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - -for more details on the meanings of these fields. -*/ -type GzHeaderS struct { - Text c.Int - Time ULong - Xflags c.Int - Os c.Int - Extra *Bytef - ExtraLen UInt - ExtraMax UInt - Name *Bytef - NameMax UInt - Comment *Bytef - CommMax UInt - Hcrc c.Int - Done c.Int -} -type GzHeader GzHeaderS -type GzHeaderp *GzHeader - -/* basic functions */ -//go:linkname Version C.zlibVersion -func Version() *c.Char - -/* -ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. total_in, total_out, adler, and msg are initialized. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ -//go:linkname Deflate C.deflate -func Deflate(strm ZStreamp, flush c.Int) c.Int - -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary. Some output may be provided even if - flush is zero. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 0), or after each call of deflate(). If deflate returns Z_OK and with - zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more output - in that case. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed - codes block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six when the flush marker begins, in order to avoid - repeated flush markers upon calling deflate() again when avail_out == 0. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this - function must be called again with Z_FINISH and more output space (updated - avail_out) but no more input data, until it returns with Z_STREAM_END or an - error. After deflate has returned Z_STREAM_END, the only possible operations - on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used in the first deflate call after deflateInit if all the - compression is to be done in a single step. In order to complete in one - call, avail_out must be at least the value returned by deflateBound (see - below). Then deflate is guaranteed to return Z_STREAM_END. If not enough - output space is provided, deflate will not return Z_STREAM_END, and it must - be called again as described above. - - deflate() sets strm->adler to the Adler-32 checksum of all input read - so far (that is, total_in bytes). If a gzip stream is being generated, then - strm->adler will be the CRC-32 checksum of the input read so far. (See - deflateInit2 below.) - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is - considered binary. This field is only for information purposes and does not - affect the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL or the state was inadvertently written over - by the application), or Z_BUF_ERROR if no progress is possible (for example - avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and - deflate() can be called again with more input and more output space to - continue compressing. -*/ -//go:linkname DeflateEnd C.deflateEnd -func DeflateEnd(strm ZStreamp) c.Int - -/* -ZEXTERN int ZEXPORT inflateInit(z_streamp strm); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. In the current version of inflate, the provided input is not - read or consumed. The allocation of a sliding window will be deferred to - the first call of inflate (if the decompression does not complete on the - first call). If zalloc and zfree are set to Z_NULL, inflateInit updates - them to use default allocation functions. total_in, total_out, adler, and - msg are initialized. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression. - Actual decompression will be done by inflate(). So next_in, and avail_in, - next_out, and avail_out are unused and unchanged. The current - implementation of inflateInit() does not process any header information -- - that is deferred until inflate() is called. -*/ -//go:linkname Inflate C.inflate -func Inflate(strm ZStreamp, flush c.Int) c.Int - -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), then next_in and avail_in are updated - accordingly, and processing will resume at this point for the next call of - inflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. If the - caller of inflate() does not provide both available input and available - output space, it is possible that there will be no progress made. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate returns Z_OK and with zero avail_out, it must be - called again after making room in the output buffer because there might be - more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed Adler-32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained unless inflateGetHeader() is used. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - produced so far. The CRC-32 is checked against the gzip trailer, as is the - uncompressed length, modulo 2^32. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value, in which case strm->msg points to a string with a more specific - error), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL, or the state was inadvertently written over - by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR - if no progress was possible or if there was not enough room in the output - buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is to be attempted. -*/ -//go:linkname InflateEnd C.inflateEnd -func InflateEnd(strm ZStreamp) c.Int - -/* -ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy); - - This is another version of deflateInit with more compression options. The - fields zalloc, zfree and opaque must be initialized before by the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - For the current implementation of deflate(), a windowBits value of 8 (a - window size of 256 bytes) is not supported. As a result, a request for 8 - will result in 9 (a 512-byte window). In that case, providing 8 to - inflateInit2() will result in an error when the zlib header with 9 is - checked against the initialization of inflate(). The remedy is to not use 8 - with deflateInit2() with this initialization, or at least in that case use 9 - with inflateInit2(). - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute a check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to the appropriate value, - if the operating system was determined at compile time. If a gzip stream is - being written, strm->adler is a CRC-32 instead of an Adler-32. - - For raw deflate or gzip encoding, a request for a 256-byte window is - rejected as invalid, since only the zlib header provides a means of - transmitting the window size to the decompressor. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ -//go:linkname DeflateSetDictionary C.deflateSetDictionary -func DeflateSetDictionary(strm ZStreamp, dictionary *Bytef, dictLength UInt) c.Int - -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the Adler-32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler-32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - Adler-32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ -//go:linkname DeflateGetDictionary C.deflateGetDictionary -func DeflateGetDictionary(strm ZStreamp, dictionary *Bytef, dictLength *UInt) c.Int - -/* - Returns the sliding dictionary being maintained by deflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If deflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similarly, if dictLength is Z_NULL, then it is not set. - - deflateGetDictionary() may return a length less than the window size, even - when more than the window size in input has been provided. It may return up - to 258 bytes less in that case, due to how zlib's implementation of deflate - manages the sliding window and lookahead for matches, where matches can be - up to 258 bytes long. If the application needs the last window-size bytes of - input, then that would need to be saved by the application outside of zlib. - - deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ -//go:linkname DeflateCopy C.deflateCopy -func DeflateCopy(dest ZStreamp, source ZStreamp) c.Int - -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ -//go:linkname DeflateReset C.deflateReset -func DeflateReset(strm ZStreamp) c.Int - -/* - This function is equivalent to deflateEnd followed by deflateInit, but - does not free and reallocate the internal compression state. The stream - will leave the compression level and any other attributes that may have been - set unchanged. total_in, total_out, adler, and msg are initialized. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ -//go:linkname DeflateParams C.deflateParams -func DeflateParams(strm ZStreamp, level c.Int, strategy c.Int) c.Int - -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2(). This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression approach (which is a function of the level) or the - strategy is changed, and if there have been any deflate() calls since the - state was initialized or reset, then the input available so far is - compressed with the old level and strategy using deflate(strm, Z_BLOCK). - There are three approaches for the compression levels 0, 1..3, and 4..9 - respectively. The new level and strategy will take effect at the next call - of deflate(). - - If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does - not have enough output space to complete, then the parameter change will not - take effect. In this case, deflateParams() can be called again with the - same parameters and more output space to try again. - - In order to assure a change in the parameters on the first try, the - deflate stream should be flushed using deflate() with Z_BLOCK or other flush - request until strm.avail_out is not zero, before calling deflateParams(). - Then no more input data should be provided before the deflateParams() call. - If this is done, the old level and strategy will be applied to the data - compressed before deflateParams(), and the new level and strategy will be - applied to the data compressed after deflateParams(). - - deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream - state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if - there was not enough output space to complete the compression of the - available input data before a change in the strategy or approach. Note that - in the case of a Z_BUF_ERROR, the parameters are not changed. A return - value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be - retried with more output space. -*/ -//go:linkname DeflateTune C.deflateTune -func DeflateTune(strm ZStreamp, good_length c.Int, max_lazy c.Int, nice_length c.Int, max_chain c.Int) c.Int - -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. -*/ -//go:linkname DeflateBound C.deflateBound -func DeflateBound(strm ZStreamp, sourceLen ULong) ULong - -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. -*/ -//go:linkname DeflatePending C.deflatePending -func DeflatePending(strm ZStreamp, pending *c.Uint, bits *c.Int) c.Int - -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are Z_NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ -//go:linkname DeflatePrime C.deflatePrime -func DeflatePrime(strm ZStreamp, bits c.Int, value c.Int) c.Int - -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ -//go:linkname DeflateSetHeader C.deflateSetHeader -func DeflateSetHeader(strm ZStreamp, head GzHeaderp) c.Int - -/* -ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, - int windowBits); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an Adler-32 or a CRC-32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will *not* automatically decode concatenated gzip members. - inflate() will return Z_STREAM_END at the end of the gzip member. The state - would need to be reset to continue decoding a subsequent gzip member. This - *must* be done if there is more data after a gzip member, in order for the - decompression to be compliant with the gzip standard (RFC 1952). - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ -//go:linkname InflateSetDictionary C.inflateSetDictionary -func InflateSetDictionary(strm ZStreamp, dictionary *Bytef, dictLength UInt) c.Int - -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler-32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler-32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ -//go:linkname InflateGetDictionary C.inflateGetDictionary -func InflateGetDictionary(strm ZStreamp, dictionary *Bytef, dictLength *UInt) c.Int - -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similarly, if dictLength is Z_NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ -//go:linkname InflateSync C.inflateSync -func InflateSync(strm ZStreamp) c.Int - -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current value of total_in - which indicates where valid compressed data was found. In the error case, - the application may repeatedly call inflateSync, providing more input each - time, until success or end of the input data. -*/ -//go:linkname InflateCopy C.inflateCopy -func InflateCopy(dest ZStreamp, source ZStreamp) c.Int - -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ -//go:linkname InflateReset C.inflateReset -func InflateReset(strm ZStreamp) c.Int - -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - total_in, total_out, adler, and msg are initialized. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ -//go:linkname InflateReset2 C.inflateReset2 -func InflateReset2(strm ZStreamp, windowBits c.Int) c.Int - -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. If the window size is changed, then the - memory allocated for the window is freed, and the window will be reallocated - by inflate() if needed. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL), or if - the windowBits parameter is invalid. -*/ -//go:linkname InflatePrime C.inflatePrime -func InflatePrime(strm ZStreamp, bits c.Int, value c.Int) c.Int - -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ -//go:linkname InflateMark C.inflateMark -func InflateMark(strm ZStreamp) c.Long - -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above, or -65536 if the provided - source stream state was inconsistent. -*/ -//go:linkname InflateGetHeader C.inflateGetHeader -func InflateGetHeader(strm ZStreamp, head GzHeaderp) c.Int - -// llgo:type C -type InFunc func(c.Pointer, **c.Char) c.Uint - -// llgo:type C -type OutFunc func(c.Pointer, *c.Char, c.Uint) c.Int - -//go:linkname InflateBack C.inflateBack -func InflateBack(strm ZStreamp, in InFunc, in_desc c.Pointer, out OutFunc, out_desc c.Pointer) c.Int - -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the default - behavior of inflate(), which expects a zlib header and trailer around the - deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero -- buf is ignored in that - case -- and inflateBack() will return a buffer error. inflateBack() will - call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. - out() should return zero on success, or non-zero on failure. If out() - returns non-zero, inflateBack() will return with an error. Neither in() nor - out() are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be Z_NULL only if in() returned an error. If - strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ -//go:linkname InflateBackEnd C.inflateBackEnd -func InflateBackEnd(strm ZStreamp) c.Int - -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ -//go:linkname CompileFlags C.zlibCompileFlags -func CompileFlags() ULong - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ -//go:linkname Compress C.compress -func Compress(dest *Bytef, destLen *ULongf, source *Bytef, sourceLen ULong) c.Int - -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. compress() is equivalent to compress2() with a level - parameter of Z_DEFAULT_COMPRESSION. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ -//go:linkname Compress2 C.compress2 -func Compress2(dest *Bytef, destLen *ULongf, source *Bytef, sourceLen ULong, level c.Int) c.Int - -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -//go:linkname CompressBound C.compressBound -func CompressBound(sourceLen ULong) ULong - -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ -//go:linkname Uncompress C.uncompress -func Uncompress(dest *Bytef, destLen *ULongf, source *Bytef, sourceLen ULong) c.Int - -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed data. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ -//go:linkname Uncompress2 C.uncompress2 -func Uncompress2(dest *Bytef, destLen *ULongf, source *Bytef, sourceLen *ULong) c.Int - -type GzFileS struct { - Have c.Uint - Next *c.Char - Pos os.OffT -} -type GzFile *GzFileS - -/* -ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); - - Open the gzip (.gz) file at path for reading and decompressing, or - compressing and writing. The mode parameter is as in fopen ("rb" or "wb") - but can also include a compression level ("wb9") or a strategy: 'f' for - filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", - 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression - as in "wb9F". (See the description of deflateInit2 for more information - about the strategy parameter.) 'T' will request transparent writing or - appending with no compression and not using the gzip format. - - "a" can be used instead of "w" to request that the gzip stream that will - be written be appended to the file. "+" will result in an error, since - reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ -//go:linkname Gzdopen C.gzdopen -func Gzdopen(fd c.Int, mode *c.Char) GzFile - -/* - Associate a gzFile with the file descriptor fd. File descriptors are - obtained from calls like open, dup, creat, pipe or fileno (if the file has - been previously opened with fopen). The mode parameter is as in gzopen. - - The next call of gzclose on the returned gzFile will also close the file - descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ -//go:linkname Gzbuffer C.gzbuffer -func Gzbuffer(file GzFile, size c.Uint) c.Int - -/* - Set the internal buffer size used by this library's functions for file to - size. The default buffer size is 8192 bytes. This function must be called - after gzopen() or gzdopen(), and before any other calls that read or write - the file. The buffer memory allocation is always deferred to the first read - or write. Three times that size in buffer space is allocated. A larger - buffer size of, for example, 64K or 128K bytes will noticeably increase the - speed of decompression (reading). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ -//go:linkname Gzsetparams C.gzsetparams -func Gzsetparams(file GzFile, level c.Int, strategy c.Int) c.Int - -/* - Dynamically update the compression level and strategy for file. See the - description of deflateInit2 for the meaning of these parameters. Previously - provided data is flushed before applying the parameter changes. - - gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not - opened for writing, Z_ERRNO if there is an error writing the flushed data, - or Z_MEM_ERROR if there is a memory allocation error. -*/ -//go:linkname Gzread C.gzread -func Gzread(file GzFile, buf Voidp, len c.Uint) c.Int - -/* - Read and decompress up to len uncompressed bytes from file into buf. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. If len is too large to fit in an int, - then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. -*/ -//go:linkname Gzfread C.gzfread -func Gzfread(buf Voidp, size ZSizeT, nitems ZSizeT, file GzFile) ZSizeT - -/* - Read and decompress up to nitems items of size size from file into buf, - otherwise operating as gzread() does. This duplicates the interface of - stdio's fread(), with size_t request and return types. If the library - defines size_t, then z_size_t is identical to size_t. If not, then z_size_t - is an unsigned integer type that can contain a pointer. - - gzfread() returns the number of full items read of size size, or zero if - the end of the file was reached and a full item could not be read, or if - there was an error. gzerror() must be consulted if zero is returned in - order to determine if there was an error. If the multiplication of size and - nitems overflows, i.e. the product does not fit in a z_size_t, then nothing - is read, zero is returned, and the error state is set to Z_STREAM_ERROR. - - In the event that the end of file is reached and only a partial item is - available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevertheless read into buf - and the end-of-file flag is set. The length of the partial item read is not - provided, but could be inferred from the result of gztell(). This behavior - is the same as the behavior of fread() implementations in common libraries, - but it prevents the direct use of gzfread() to read a concurrently written - file, resetting and retrying on end-of-file, when size is not 1. -*/ -//go:linkname Gzwrite C.gzwrite -func Gzwrite(file GzFile, buf Voidpc, len c.Uint) c.Int - -/* - Compress and write the len uncompressed bytes at buf to file. gzwrite - returns the number of uncompressed bytes written or 0 in case of error. -*/ -//go:linkname Gzfwrite C.gzfwrite -func Gzfwrite(buf Voidpc, size ZSizeT, nitems ZSizeT, file GzFile) ZSizeT - -/* - Compress and write nitems items of size size from buf to file, duplicating - the interface of stdio's fwrite(), with size_t request and return types. If - the library defines size_t, then z_size_t is identical to size_t. If not, - then z_size_t is an unsigned integer type that can contain a pointer. - - gzfwrite() returns the number of full items written of size size, or zero - if there was an error. If the multiplication of size and nitems overflows, - i.e. the product does not fit in a z_size_t, then nothing is written, zero - is returned, and the error state is set to Z_STREAM_ERROR. -*/ -//go:linkname Gzprintf C.gzprintf -func Gzprintf(file GzFile, format *c.Char, __llgo_va_list ...interface{}) c.Int - -/* - Convert, format, compress, and write the arguments (...) to file under - control of the string format, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or a negative zlib error code in case - of error. The number of uncompressed bytes written is limited to 8191, or - one less than the buffer size given to gzbuffer(). The caller should assure - that this limit is not exceeded. If it is exceeded, then gzprintf() will - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf(), - because the secure snprintf() or vsnprintf() functions were not available. - This can be determined using zlibCompileFlags(). -*/ -//go:linkname Gzputs C.gzputs -func Gzputs(file GzFile, s *c.Char) c.Int - -/* - Compress and write the given null-terminated string s to file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ -//go:linkname Gzgets C.gzgets -func Gzgets(file GzFile, buf *c.Char, len c.Int) *c.Char - -/* - Read and decompress bytes from file into buf, until len-1 characters are - read, or until a newline character is read and transferred to buf, or an - end-of-file condition is encountered. If any characters are read or if len - is one, the string is terminated with a null character. If no characters - are read due to an end-of-file or len is less than one, then the buffer is - left untouched. - - gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If there was an error, the contents at - buf are indeterminate. -*/ -//go:linkname Gzputc C.gzputc -func Gzputc(file GzFile, c c.Int) c.Int - -/* - Compress and write c, converted to an unsigned char, into file. gzputc - returns the value that was written, or -1 in case of error. -*/ -//go:linkname Gzgetc C.gzgetc -func Gzgetc(file GzFile) c.Int - -/* - Read and decompress one byte from file. gzgetc returns this byte or -1 - in case of end of file or error. This is implemented as a macro for speed. - As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file - points to has been clobbered or not. -*/ -//go:linkname Gzungetc C.gzungetc -func Gzungetc(c c.Int, file GzFile) c.Int - -/* - Push c back onto the stream for file to be read as the first character on - the next read. At least one character of push-back is always allowed. - gzungetc() returns the character pushed, or -1 on failure. gzungetc() will - fail if c is -1, and may fail if a character has been pushed but not read - yet. If gzungetc is used immediately after gzopen or gzdopen, at least the - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ -//go:linkname Gzflush C.gzflush -func Gzflush(file GzFile, flush c.Int) c.Int - -/* -ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, - z_off_t offset, int whence); - - Set the starting position to offset relative to whence for the next gzread - or gzwrite on file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ -//go:linkname Gzrewind C.gzrewind -func Gzrewind(file GzFile) c.Int - -/* -ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); - - Return the current compressed (actual) read or write offset of file. This - offset includes the count of bytes that precede the gzip stream, for example - when appending or when using gzdopen() for reading. When reading, the - offset does not include as yet unused buffered input. This information can - be used for a progress indicator. On error, gzoffset() returns -1. -*/ -//go:linkname Gzeof C.gzeof -func Gzeof(file GzFile) c.Int - -/* - Return true (1) if the end-of-file indicator for file has been set while - reading, false (0) otherwise. Note that the end-of-file indicator is set - only if the read tried to go past the end of the input, but came up short. - Therefore, just like feof(), gzeof() may return false even if there is no - more data to read, in the event that the last read request was for the exact - number of bytes remaining in the input file. This will happen if the input - file size is an exact multiple of the buffer size. - - If gzeof() returns true, then the read functions will return no more data, - unless the end-of-file indicator is reset by gzclearerr() and the input file - has grown since the previous end of file was detected. -*/ -//go:linkname Gzdirect C.gzdirect -func Gzdirect(file GzFile) c.Int - -/* - Return true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. - - If the input file is empty, gzdirect() will return true, since the input - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ -//go:linkname Gzclose C.gzclose -func Gzclose(file GzFile) c.Int - -/* - Flush all pending output for file, if necessary, close file and - deallocate the (de)compression state. Note that once file is closed, you - cannot call gzerror with file, since its structures have been deallocated. - gzclose must not be called more than once on the same file, just as free - must not be called more than once on the same allocation. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ -//go:linkname GzcloseR C.gzclose_r -func GzcloseR(file GzFile) c.Int - -//go:linkname GzcloseW C.gzclose_w -func GzcloseW(file GzFile) c.Int - -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ -//go:linkname Gzerror C.gzerror -func Gzerror(file GzFile, errnum *c.Int) *c.Char - -/* - Return the error message for the last error which occurred on file. - errnum is set to zlib error number. If an error occurred in the file system - and not in the compression library, errnum is set to Z_ERRNO and the - application may consult errno to get the exact error code. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ -//go:linkname Gzclearerr C.gzclearerr -func Gzclearerr(file GzFile) - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ -// llgo:link ULong.Adler32 C.adler32 -func (recv_ ULong) Adler32(buf *Bytef, len UInt) ULong { - return 0 -} - -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. An Adler-32 value is in the range of a 32-bit - unsigned integer. If buf is Z_NULL, this function returns the required - initial value for the checksum. - - An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed - much faster. - - Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ -// llgo:link ULong.Adler32Z C.adler32_z -func (recv_ ULong) Adler32Z(buf *Bytef, len ZSizeT) ULong { - return 0 -} - -/* -ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, - z_off_t len2); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ -// llgo:link ULong.Crc32 C.crc32 -func (recv_ ULong) Crc32(buf *Bytef, len UInt) ULong { - return 0 -} - -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. - If buf is Z_NULL, this function returns the required initial value for the - crc. Pre- and post-conditioning (one's complement) is performed within this - function so it shouldn't be done by the application. - - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ -// llgo:link ULong.Crc32Z C.crc32_z -func (recv_ ULong) Crc32Z(buf *Bytef, len ZSizeT) ULong { - return 0 -} - -/* -ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); - - Return the operator corresponding to length len2, to be used with - crc32_combine_op(). len2 must be non-negative. -*/ -// llgo:link ULong.Crc32CombineOp C.crc32_combine_op -func (recv_ ULong) Crc32CombineOp(crc2 ULong, op ULong) ULong { - return 0 -} - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -//go:linkname DeflateInit_ C.deflateInit_ -func DeflateInit_(strm ZStreamp, level c.Int, version *c.Char, stream_size c.Int) c.Int - -//go:linkname InflateInit_ C.inflateInit_ -func InflateInit_(strm ZStreamp, version *c.Char, stream_size c.Int) c.Int - -//go:linkname DeflateInit2_ C.deflateInit2_ -func DeflateInit2_(strm ZStreamp, level c.Int, method c.Int, windowBits c.Int, memLevel c.Int, strategy c.Int, version *c.Char, stream_size c.Int) c.Int - -//go:linkname InflateInit2_ C.inflateInit2_ -func InflateInit2_(strm ZStreamp, windowBits c.Int, version *c.Char, stream_size c.Int) c.Int - -//go:linkname InflateBackInit_ C.inflateBackInit_ -func InflateBackInit_(strm ZStreamp, windowBits c.Int, window *c.Char, version *c.Char, stream_size c.Int) c.Int - -//go:linkname Gzgetc_ C.gzgetc_ -func Gzgetc_(file GzFile) c.Int - -//go:linkname Gzopen C.gzopen -func Gzopen(*c.Char, *c.Char) GzFile - -//go:linkname Gzseek C.gzseek -func Gzseek(GzFile, os.OffT, c.Int) os.OffT - -//go:linkname Gztell C.gztell -func Gztell(GzFile) os.OffT - -//go:linkname Gzoffset C.gzoffset -func Gzoffset(GzFile) os.OffT - -// llgo:link ULong.Adler32Combine C.adler32_combine -func (recv_ ULong) Adler32Combine(ULong, os.OffT) ULong { - return 0 -} - -// llgo:link ULong.Crc32Combine C.crc32_combine -func (recv_ ULong) Crc32Combine(ULong, os.OffT) ULong { - return 0 -} - -//go:linkname Crc32CombineGen C.crc32_combine_gen -func Crc32CombineGen(os.OffT) ULong - -/* undocumented functions */ -//go:linkname ZError C.zError -func ZError(c.Int) *c.Char - -//go:linkname InflateSyncPoint C.inflateSyncPoint -func InflateSyncPoint(ZStreamp) c.Int - -//go:linkname GetCrcTable C.get_crc_table -func GetCrcTable() *ZCrcT - -//go:linkname InflateUndermine C.inflateUndermine -func InflateUndermine(ZStreamp, c.Int) c.Int - -//go:linkname InflateValidate C.inflateValidate -func InflateValidate(ZStreamp, c.Int) c.Int - -//go:linkname InflateCodesUsed C.inflateCodesUsed -func InflateCodesUsed(ZStreamp) c.Ulong - -//go:linkname InflateResetKeep C.inflateResetKeep -func InflateResetKeep(ZStreamp) c.Int - -//go:linkname DeflateResetKeep C.deflateResetKeep -func DeflateResetKeep(ZStreamp) c.Int - -//go:linkname Gzvprintf C.gzvprintf -func Gzvprintf(file GzFile, format *c.Char, va c.VaList) c.Int diff --git a/zlib/zlib_autogen_link.go b/zlib/zlib_autogen_link.go deleted file mode 100644 index d74d3ea0..00000000 --- a/zlib/zlib_autogen_link.go +++ /dev/null @@ -1,8 +0,0 @@ -package zlib - -import ( - _ "github.com/goplus/lib/c" - _ "github.com/goplus/lib/c/os" -) - -const LLGoPackage string = "link: $(pkg-config --libs zlib);" From c439bcc3175efdf5a5ad3c99e96879508a91f44f Mon Sep 17 00:00:00 2001 From: Askeladd <1351914167@qq.com> Date: Sun, 17 Aug 2025 18:19:29 +0800 Subject: [PATCH 53/88] release numpy@v0.1.0 for pre --- numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpyg.cfg | 8 + numpy/numpy.go | 27552 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 27567 insertions(+) create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..8ce9049a --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module github.com/PengPengPeng717/llpkg/numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..932c66b2 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,8 @@ +{ + "name": "numpy", + "libName": "numpy", + "libVersion": "2.3.2", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..e0674759 --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27552 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +//go:linkname Invert py.invert +func Invert(__llgo_va_list ...interface{}) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of ``arr``. This must match the +// dimension of ``arr``, but dimensions Ni and Nj only need to broadcast +// against ``arr``. +// axis : int or None, optional +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// .. versionchanged:: 2.3 +// The default value is now ``-1``. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// >>> import numpy as np +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> rng = np.random.default_rng() +// >>> A = rng.normal(size=(2,3,5)) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, NumPy scalar, or array +// Data type, NumPy scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 2.0 +// This function does not support Python scalars anymore and does not +// apply any value-based logic for 0-D arrays and NumPy scalars. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> import numpy as np +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +//go:linkname Equal py.equal +func Equal(__llgo_va_list ...interface{}) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.getbufsize() +// 8192 +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, -np.inf]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with np.errstate(invalid="ignore"): +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// np.float64(nan) +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez_compressed(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., +// ``savez_compressed(fn, x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for +// disallowing pickles include security (loading pickled data can execute +// arbitrary code) and portability (pickled objects may not be loadable +// on different Python installations, for example if the stored objects +// require libraries that are not available, and not all pickled data is +// compatible between different versions of Python). +// Default: True +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` +// object is returned. This is a dictionary-like object which can be queried +// for its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> import numpy as np +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(__llgo_va_list ...interface{}) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// +// Given a sequence of a polynomial's zeros: +// +// >>> import numpy as np +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(__llgo_va_list ...interface{}) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The row and column indices, respectively. The row indices are sorted +// in non-decreasing order, and the correspdonding column indices are +// strictly increasing for each row. +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Examples +// -------- +// >>> import numpy as np +// +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu1 +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Note that row indices (first array) are non-decreasing, and the corresponding +// column indices (second array) are strictly increasing for each row. +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> iu2 = np.triu_indices(4, 2) +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> import numpy as np +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> import numpy as np +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// np.float32(0.54999924) +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Computing the mean in timedelta64 is available: +// +// >>> b = np.array([1, 3], dtype="timedelta64[D]") +// >>> np.mean(b) +// np.timedelta64(2,'D') +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to zero or a positive integer. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=-1 (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=0 +// Only the memory bounds of a and b are checked. +// This is equivalent to using ``may_share_memory()``. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided( +// ... x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided( +// ... x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// .. deprecated:: 2.0 +// Use :func:`isin` instead of `in1d` for new code. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// Examples +// -------- +// >>> import numpy as np +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> import numpy as np +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import numpy as np +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Asin py.asin +func Asin(__llgo_va_list ...interface{}) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=int32) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> import numpy as np +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> import numpy as np +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Atan py.atan +func Atan(__llgo_va_list ...interface{}) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// +// .. versionchanged:: 2.0 +// The sign parameter can now be an integer type, previously +// types were floating-point types. +// +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string ``'1.21'`` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to ``'1.25'`` approximates printing of 1.25 which mainly means +// that numeric scalars are printed without their type information, e.g. +// as ``3.0`` rather than ``np.float64(3.0)``. +// +// If set to ``'2.1'``, shape information is not given when arrays are +// summarized (i.e., multiple elements replaced with ``...``). +// +// If set to ``'2.2'``, the transition to use scientific notation for +// printing ``np.float16`` and ``np.float32`` types may happen later or +// not at all for larger values. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionchanged:: 1.22.0 +// .. versionchanged:: 2.2 +// +// override_repr: callable, optional +// If set a passed function will be used for generating arrays' repr. +// Other options will be ignored. +// +// See Also +// -------- +// get_printoptions, printoptions, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> import numpy as np +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9], shape=(10,)) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` +// as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ], shape=(10,)) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Find the unique elements of an array, and counts, inverse, and indices. +// +// This function is an Array API compatible alternative to:: +// +// np.unique(x, return_index=True, return_inverse=True, +// return_counts=True, equal_nan=False, sorted=False) +// +// but returns a namedtuple for easier access to each output. +// +// .. note:: +// This function currently always returns a sorted result, however, +// this could change in any NumPy minor release. +// +// Parameters +// ---------- +// x : array_like +// Input array. It will be flattened if it is not already 1-D. +// +// Returns +// ------- +// out : namedtuple +// The result containing: +// +// * values - The unique elements of an input array. +// * indices - The first occurring indices for each unique element. +// * inverse_indices - The indices from the set of unique elements +// that reconstruct `x`. +// * counts - The corresponding counts for each unique element. +// +// See Also +// -------- +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = [1, 1, 2] +// >>> uniq = np.unique_all(x) +// >>> uniq.values +// array([1, 2]) +// >>> uniq.indices +// array([0, 2]) +// >>> uniq.inverse_indices +// array([0, 0, 1]) +// >>> uniq.counts +// array([2, 1]) +// +// +//go:linkname UniqueAll py.unique_all +func UniqueAll(x *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> rng = np.random.default_rng() +// >>> A = rng.normal(size=(3,4,5)) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. https://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (deg + 1, deg + 1) or (deg + 1, deg + 1, K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.exceptions.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `~exceptions.RankWarning` when the least-squares fit is +// badly conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import numpy as np +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.exceptions.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : {int, float}, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. See notes for details about use of `ddof`. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// mean : array like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this var function. +// +// .. versionadded:: 2.0.0 +// +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// There are several common variants of the array variance calculation. +// Assuming the input `a` is a one-dimensional NumPy array and ``mean`` is +// either provided as an argument or computed as ``a.mean()``, NumPy +// computes the variance of an array as:: +// +// N = len(a) +// d2 = abs(a - mean)**2 # abs is for complex `a` +// var = d2.sum() / (N - ddof) # note use of `ddof` +// +// Different values of the argument `ddof` are useful in different +// contexts. NumPy's default ``ddof=0`` corresponds with the expression: +// +// .. math:: +// +// \frac{\sum_i{|a_i - \bar{a}|^2 }}{N} +// +// which is sometimes called the "population variance" in the field of +// statistics because it applies the definition of variance to `a` as if `a` +// were a complete population of possible observations. +// +// Many other libraries define the variance of an array differently, e.g.: +// +// .. math:: +// +// \frac{\sum_i{|a_i - \bar{a}|^2}}{N - 1} +// +// In statistics, the resulting quantity is sometimes called the "sample +// variance" because if `a` is a random sample from a larger population, +// this calculation provides an unbiased estimate of the variance of the +// population. The use of :math:`N-1` in the denominator is often called +// "Bessel's correction" because it corrects for bias (toward lower values) +// in the variance estimate introduced when the sample mean of `a` is used +// in place of the true mean of the population. For this quantity, use +// ``ddof=1``. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// np.float32(0.20250003) +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// Using the mean keyword to save computation time: +// +// >>> import numpy as np +// >>> from timeit import timeit +// >>> +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> mean = np.mean(a, axis=1, keepdims=True) +// >>> +// >>> g = globals() +// >>> n = 10000 +// >>> t1 = timeit("var = np.var(a, axis=1, mean=mean)", globals=g, number=n) +// >>> t2 = timeit("var = np.var(a, axis=1)", globals=g, number=n) +// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') +// #doctest: +SKIP +// Percentage execution time saved 32% +// +// +// +//go:linkname Var py.var +func Var(__llgo_va_list ...interface{}) *py.Object +// +// Find the unique elements of `x` and indices to reconstruct `x`. +// +// This function is an Array API compatible alternative to:: +// +// np.unique(x, return_inverse=True, equal_nan=False, sorted=False) +// +// but returns a namedtuple for easier access to each output. +// +// .. note:: +// This function currently always returns a sorted result, however, +// this could change in any NumPy minor release. +// +// Parameters +// ---------- +// x : array_like +// Input array. It will be flattened if it is not already 1-D. +// +// Returns +// ------- +// out : namedtuple +// The result containing: +// +// * values - The unique elements of an input array. +// * inverse_indices - The indices from the set of unique elements +// that reconstruct `x`. +// +// See Also +// -------- +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = [1, 1, 2] +// >>> uniq = np.unique_inverse(x) +// >>> uniq.values +// array([1, 2]) +// >>> uniq.inverse_indices +// array([0, 0, 1]) +// +// +//go:linkname UniqueInverse py.unique_inverse +func UniqueInverse(x *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// `axis=None`, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The array of weights must be the same shape as `a` if no axis is +// specified, otherwise the weights must have dimensions and shape +// consistent with `a` along the specified axis. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// The calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// where the sum is over all included elements. +// The only constraint on the values of `weights` is that `sum(weights)` +// must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a general pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When `weights` does not have the same shape as `a`, and `axis=None`. +// ValueError +// When `weights` does not have dimensions and shape consistent with `a` +// along specified `axis`. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> import numpy as np +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// >>> data = np.arange(8).reshape((2, 2, 2)) +// >>> data +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.average(data, axis=(0, 1), weights=[[1./4, 3./4], [1., 1./2]]) +// array([3.4, 4.4]) +// >>> np.average(data, axis=0, weights=[[1./4, 3./4], [1., 1./2]]) +// Traceback (most recent call last): +// ... +// ValueError: Shape of weights must be consistent +// with shape of a along specified axis. +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, -np.inf]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description:: +// +// np.choose(a,c) == np.array([c[a[I]][I] for I in np.ndindex(a.shape)]) +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> import numpy as np +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> import numpy as np +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(__llgo_va_list ...interface{}) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Absolute py.absolute +func Absolute(x *py.Object, out *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), +// ... axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Gives a new shape to an array without changing its data. +// +// Parameters +// ---------- +// a : array_like +// Array to be reshaped. +// shape : int or tuple of ints +// The new shape should be compatible with the original shape. If +// an integer, then the result will be a 1-D array of that length. +// One shape dimension can be -1. In this case, the value is +// inferred from the length of the array and remaining dimensions. +// order : {'C', 'F', 'A'}, optional +// Read the elements of ``a`` using this index order, and place the +// elements into the reshaped array using this index order. 'C' +// means to read / write the elements using C-like index order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to read / write the +// elements using Fortran-like index order, with the first index +// changing fastest, and the last index changing slowest. Note that +// the 'C' and 'F' options take no account of the memory layout of +// the underlying array, and only refer to the order of indexing. +// 'A' means to read / write the elements in Fortran-like index +// order if ``a`` is Fortran *contiguous* in memory, C-like order +// otherwise. +// newshape : int or tuple of ints +// .. deprecated:: 2.1 +// Replaced by ``shape`` argument. Retained for backward +// compatibility. +// copy : bool, optional +// If ``True``, then the array data is copied. If ``None``, a copy will +// only be made if it's required by ``order``. For ``False`` it raises +// a ``ValueError`` if a copy cannot be avoided. Default: ``None``. +// +// Returns +// ------- +// reshaped_array : ndarray +// This will be a new view object if possible; otherwise, it will +// be a copy. Note there is no guarantee of the *memory layout* (C- or +// Fortran- contiguous) of the returned array. +// +// See Also +// -------- +// ndarray.reshape : Equivalent method. +// +// Notes +// ----- +// It is not always possible to change the shape of an array without copying +// the data. +// +// The ``order`` keyword gives the index ordering both for *fetching* +// the values from ``a``, and then *placing* the values into the output +// array. For example, let's say you have an array: +// +// >>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, shape *py.Object, order *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(__llgo_va_list ...interface{}) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values have the same data-type as the input. +// +// Parameters +// ---------- +// x : array_like +// An array to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// An array with the same dimensions and data-type as the input. +// If second argument is not supplied then a new array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value ``out`` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in +// the designated form. If the `width` value is insufficient, an error is +// raised. +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// >>> import numpy as np +// +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using +// the normal rules. Instead, leading axes of size 1 are inserted, +// to make ``block.ndim`` the same for all blocks. This is primarily useful +// for working with scalars, and means that code like ``np.block([v, 1])`` +// is valid, where ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. +// +// Notes +// ----- +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is *not* +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix: +// +// >>> import numpy as np +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack`: +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in place of `atleast_1d` and `atleast_2d`: +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the cube-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the +// cube root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - sign : str +// - formatter : dict of callables +// - floatmode : str +// - legacy : str or False +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> np.get_printoptions() +// {'edgeitems': 3, 'threshold': 1000, ..., 'override_repr': None} +// +// >>> np.get_printoptions()['linewidth'] +// 75 +// >>> np.set_printoptions(linewidth=100) +// >>> np.get_printoptions()['linewidth'] +// 100 +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, lexsort returns an array of integer indices +// that describes the sort order by multiple keys. The last key in the +// sequence is used for the primary sort order, ties are broken by the +// second-to-last key, and so on. +// +// Parameters +// ---------- +// keys : (k, m, n, ...) array-like +// The `k` keys to be sorted. The *last* key (e.g, the last +// row if `keys` is a 2D array) is the primary sort key. +// Each element of `keys` along the zeroth axis must be +// an array-like object of the same shape. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis +// of each sequence. Separate slices along `axis` sorted over +// independently; see last example. +// +// Returns +// ------- +// indices : (m, n, ...) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> import numpy as np +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort according to two numerical keys, first by elements +// of ``a``, then breaking ties according to elements of ``b``: +// +// >>> a = [1, 5, 1, 4, 3, 4, 4] # First sequence +// >>> b = [9, 4, 0, 4, 0, 2, 1] # Second sequence +// >>> ind = np.lexsort((b, a)) # Sort by `a`, then by `b` +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// >>> [(a[i], b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Compare against `argsort`, which would sort each key independently. +// +// >>> np.argsort((b, a), kind='stable') +// array([[2, 4, 6, 5, 1, 3, 0], +// [0, 2, 4, 3, 5, 6, 1]]) +// +// To sort lexicographically with `argsort`, we would need to provide a +// structured array. +// +// >>> x = np.array([(ai, bi) for ai, bi in zip(a, b)], +// ... dtype = np.dtype([('x', int), ('y', int)])) +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// The zeroth axis of `keys` always corresponds with the sequence of keys, +// so 2D arrays are treated just like other sequences of keys. +// +// >>> arr = np.asarray([b, a]) +// >>> ind2 = np.lexsort(arr) +// >>> np.testing.assert_equal(ind2, ind) +// +// Accordingly, the `axis` parameter refers to an axis of *each* key, not of +// the `keys` argument itself. For instance, the array ``arr`` is treated as +// a sequence of two 1-D keys, so specifying ``axis=0`` is equivalent to +// using the default axis, ``axis=-1``. +// +// >>> np.testing.assert_equal(np.lexsort(arr, axis=0), +// ... np.lexsort(arr, axis=-1)) +// +// For higher-dimensional arrays, the axis parameter begins to matter. The +// resulting array has the same shape as each key, and the values are what +// we would expect if `lexsort` were performed on corresponding slices +// of the keys independently. For instance, +// +// >>> x = [[1, 2, 3, 4], +// ... [4, 3, 2, 1], +// ... [2, 1, 4, 3]] +// >>> y = [[2, 2, 1, 1], +// ... [1, 2, 1, 2], +// ... [1, 1, 2, 1]] +// >>> np.lexsort((x, y), axis=1) +// array([[2, 3, 0, 1], +// [2, 0, 3, 1], +// [1, 0, 3, 2]]) +// +// Each row of the result is what we would expect if we were to perform +// `lexsort` on the corresponding row of the keys: +// +// >>> for i in range(3): +// ... print(np.lexsort((x[i], y[i]))) +// [2 3 0 1] +// [2 0 3 1] +// [1 0 3 2] +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(__llgo_va_list ...interface{}) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// Parameters +// ---------- +// arrays : sequence of ndarrays +// Each array must have the same shape. In the case of a single ndarray +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// unstack : Split an array into a tuple of sub-arrays along an axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> rng = np.random.default_rng() +// >>> arrays = [rng.normal(size=(3,4)) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. In the case of a single +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// +// Copies an array to a specified data type. +// +// This function is an Array API compatible alternative to +// `numpy.ndarray.astype`. +// +// Parameters +// ---------- +// x : ndarray +// Input NumPy array to cast. ``array_likes`` are explicitly not +// supported here. +// dtype : dtype +// Data type of the result. +// copy : bool, optional +// Specifies whether to copy an array when the specified dtype matches +// the data type of the input array ``x``. If ``True``, a newly allocated +// array must always be returned. If ``False`` and the specified dtype +// matches the data type of the input array, the input array must be +// returned; otherwise, a newly allocated array must be returned. +// Defaults to ``True``. +// device : str, optional +// The device on which to place the returned array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.1.0 +// +// Returns +// ------- +// out : ndarray +// An array having the specified data type. +// +// See Also +// -------- +// ndarray.astype +// +// Examples +// -------- +// >>> import numpy as np +// >>> arr = np.array([1, 2, 3]); arr +// array([1, 2, 3]) +// >>> np.astype(arr, np.float64) +// array([1., 2., 3.]) +// +// Non-copy case: +// +// >>> arr = np.array([1, 2, 3]) +// >>> arr_noncpy = np.astype(arr, arr.dtype, copy=False) +// >>> np.shares_memory(arr, arr_noncpy) +// True +// +// +// +//go:linkname Astype py.astype +func Astype(x *py.Object, dtype *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return element-wise quotient and remainder simultaneously. +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None, *, +// device=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// Unlike other array creation functions (e.g. `zeros_like`, `ones_like`, +// `full_like`), `empty_like` does not initialize the values of the array, +// and may therefore be marginally faster. However, the values stored in the +// newly allocated array are arbitrary. For reproducible behavior, be sure +// to set each element of the array before reading. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// sorted : bool, optional +// If True, the unique elements are sorted. Elements may be sorted in +// practice even if ``sorted=False``, but this could change without +// notice. +// +// .. versionadded:: 2.3 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// sort : Return a sorted copy of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged:: 1.21 +// Like np.sort, NaN will sort to the end of the values. +// For complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// .. versionchanged:: 2.0 +// For multi-dimensional inputs, ``unique_inverse`` is reshaped +// such that the input can be reconstructed using +// ``np.take(unique, unique_inverse, axis=axis)``. The result is +// now not 1-dimensional when ``axis=None``. +// +// Note that in NumPy 2.0.0 a higher dimensional array was returned also +// when ``axis`` was not ``None``. This was reverted, but +// ``inverse.reshape(-1)`` can be used to ensure compatibility with both +// versions. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsinh` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Asinh py.asinh +func Asinh(__llgo_va_list ...interface{}) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> import numpy as np +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// *args : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : tuple of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// (array([[1, 2, 3], +// [1, 2, 3]]), +// array([[4, 4, 4], +// [5, 5, 5]])) +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), +// array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// with magnitudes much smaller than one (see Notes). +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : array_like +// The relative tolerance parameter (see Notes). +// atol : array_like +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True.:: +// +// absolute(a - b) <= (atol + rtol * absolute(b)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The default value of `atol` is not appropriate when the reference value +// `b` has magnitude smaller than one. For example, it is unlikely that +// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet +// ``allclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure +// to select `atol` for the use case at hand, especially for defining the +// threshold below which a non-zero value in `a` will be considered "close" +// to a very small or zero value in `b`. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Atanh py.atanh +func Atanh(__llgo_va_list ...interface{}) *py.Object +// empty(shape, dtype=float, order='C', *, device=None, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// Notes +// ----- +// Unlike other array creation functions (e.g. `zeros`, `ones`, `full`), +// `empty` does not initialize the values of the array, and may therefore be +// marginally faster. However, the values stored in the newly allocated array +// are arbitrary. For reproducible behavior, be sure to set each element of +// the array before reading. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '`. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(__llgo_va_list ...interface{}) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Examples +// -------- +// >>> import numpy as np +// +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> orig_settings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// >>> old_settings = np.seterr(**orig_settings) # restore original +// >>> old_handler = np.seterrcall(None) # restore original +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(-np.inf) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +//go:linkname Remainder py.remainder +func Remainder(__llgo_va_list ...interface{}) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns ``x / abs(x)``, the +// generalization of the above (and ``0 if x==0``). +// +// .. versionchanged:: 2.0.0 +// Definition of complex sign changed to follow the Array API standard. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here, :math:`x/|x|`, is the more common +// and useful one, but is different from the one used in numpy prior to +// version 2.0, :math:`x/\sqrt{x*x}`, which is equivalent to +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign([3-4j, 8j]) +// array([0.6-0.8j, 0. +1.j ]) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// linalg.cross : An Array API compatible variation of ``np.cross``, +// which accepts (arrays of) 3-element vectors only. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// Supports full broadcasting of the inputs. +// +// Dimension-2 input arrays were deprecated in 2.0.0. If you do need this +// functionality, you can use:: +// +// def cross2d(x, y): +// return x[..., 0] * y[..., 1] - x[..., 1] * y[..., 0] +// +// Examples +// -------- +// Vector cross-product. +// +// >>> import numpy as np +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// cumulative_prod : Array API compatible alternative for ``cumprod``. +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(__llgo_va_list ...interface{}) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> import numpy as np +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. In the case of a single +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einsum: +// Similar verbose interface is provided by the +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// The `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` +// :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` +// :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, +// :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, +// :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` +// produces a view of ``a`` with no changes. A further example +// ``np.einsum('ij,jk', a, b)`` describes traditional matrix multiplication +// and is equivalent to :py:func:`np.matmul(a,b) `. +// Repeated subscript labels in one operand take the diagonal. +// For example, ``np.einsum('ii', a)`` is equivalent to +// :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a) ` +// if ``a`` is a 1-D array, and ``np.einsum('ii->i', a)`` +// is like :py:func:`np.diag(a) ` if ``a`` is a square 2-D array. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// ``np.einsum('...i->...', a)`` is like +// :py:func:`np.sum(a, axis=-1) ` for array ``a`` of any shape. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts and +// operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands +// this can greatly increase the computational efficiency at the cost of +// a larger memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive +// search. For iterative calculations it may be advisable to calculate +// the optimal path once and reuse that path by supplying it as an argument. +// An example is given below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done +// with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing +// the 'optimal' path and repeatedly applying it, using an `einsum_path` +// insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, +// ... optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, +// ... optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(subscripts *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and +// the ``bins`` argument to `histogram`. Some key differences: +// +// +------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +====================================+===============+===================+ +// | PEP 3141 numeric objects | ``True`` | ``True`` | +// | (including builtins) | | | +// +------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other | ``False`` | ``False`` | +// | sequence objects | | | +// +------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> np.isscalar(3.1) +// True +// +// >>> np.isscalar(np.array(3.1)) +// False +// +// >>> np.isscalar([3.1]) +// False +// +// >>> np.isscalar(False) +// True +// +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// >>> import numpy as np +// +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : {int, float}, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// mean : array_like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this std function. +// +// .. versionadded:: 2.0.0 +// +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> import numpy as np +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> import numpy as np +// +// >>> orig_handler = np.seterrcall(err_handler) +// >>> orig_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(orig_handler) +// +// >>> np.seterr(**orig_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(orig_handler) +// +// >>> np.seterr(**orig_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(func_ *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// copy : bool, optional +// If ``True``, then the object is copied. If ``None`` then the object is +// copied only if needed, i.e. if ``__array__`` returns a copy, if obj +// is a nested sequence, or if a copy is needed to satisfy any of +// the other requirements (``dtype``, ``order``, etc.). +// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. +// Default: ``None``. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of ``a``. No copy is performed if the input +// is already an ndarray with matching dtype and order. If ``a`` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> import numpy as np +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.shares_memory(np.asarray(a, dtype=np.float32), a) +// True +// >>> np.shares_memory(np.asarray(a, dtype=np.float64), a) +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. If this is a tuple of ints, the maximum is selected over +// multiple axes, instead of a single axis or all the axes as before. +// +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.nan +// >>> np.max(b) +// np.float64(nan) +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(__llgo_va_list ...interface{}) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero imaginary part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// >>> import numpy as np +// +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts [1]_: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline v` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// scipy.signal.correlate : uses FFT which has superior performance +// on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes +// correlation may be defined differently. Another common definition is [1]_: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) +// because it does not use the FFT to compute the convolution; in that case, +// `scipy.signal.correlate` might be preferable. +// +// References +// ---------- +// .. [1] Wikipedia, "Cross-correlation", +// https://en.wikipedia.org/wiki/Cross-correlation +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +//go:linkname Matmul py.matmul +func Matmul(__llgo_va_list ...interface{}) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.nan +// >>> np.min(b) +// np.float64(nan) +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> import numpy as np +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a :exc:`RuntimeWarning` (via the Python `warnings` +// module). +// - raise: Raise a :exc:`FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> import numpy as np +// >>> orig_settings = np.seterr(all='ignore') # seterr to known value +// >>> np.int16(32000) * np.int16(3) +// np.int16(30464) +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// np.int16(30464) +// >>> np.seterr(**orig_settings) # restore original +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// This function passes the imaginary and real parts of the argument to +// `arctan2` to compute the result; consequently, it follows the convention +// of `arctan2` when the magnitude of the argument is zero. See example. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// >>> np.angle([0., -0., complex(0., -0.), complex(-0., -0.)]) # convention +// array([ 0. , 3.14159265, -0. , -3.14159265]) +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the percentile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// See the notes for more details. +// +// .. versionadded:: 2.0.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// The behavior of `numpy.percentile` with percentage `q` is +// that of `numpy.quantile` with argument ``q/100``. +// For more information, please see `numpy.quantile`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will +// use the method chosen to calculate the optimal bin width and +// consequently the number of bins (see the Notes section for more detail +// on the estimators) from the data that falls within the requested range. +// While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Minimum bin width between the 'sturges' and 'fd' estimators. +// Provides good all-around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (minimum bin width of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Additionally, if the data is of integer dtype, then the binwidth will never +// be less than 1. +// +// Examples +// -------- +// >>> import numpy as np +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// .. versionchanged:: 2.0 +// The scope of setting the buffer is tied to the `numpy.errstate` +// context. Exiting a ``with errstate():`` will also restore the bufsize. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// Returns +// ------- +// bufsize : int +// Previous size of ufunc buffer in bytes. +// +// Examples +// -------- +// When exiting a `numpy.errstate` context manager the bufsize is restored: +// +// >>> import numpy as np +// >>> with np.errstate(): +// ... np.setbufsize(4096) +// ... print(np.getbufsize()) +// ... +// 8192 +// 4096 +// >>> np.getbufsize() +// 8192 +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// >>> import numpy as np +// +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> np.array_equal([1, 2], [1, 2]) +// True +// +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// +// >>> np.array_equal([1, 2], [1, 4]) +// False +// +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// np.float64(nan) +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsinh` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// +// busday_offset( +// dates, +// offsets, +// roll='raise', +// weekmask='1111100', +// holidays=None, +// busdaycal=None, +// out=None +// ) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> import numpy as np +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// np.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// np.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// np.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// np.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// np.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// np.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// np.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// np.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// vecdot : Vector dot product of two arrays. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> import numpy as np +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// np.uint8(255) +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Return a tuple of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be used with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// Returns +// ------- +// X1, X2,..., XN : tuple of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// :ref:`how-to-index` +// +// Examples +// -------- +// >>> import numpy as np +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// values ``a[i, ..., i]`` with indices ``i`` all identical. This function +// modifies the input array in-place without returning a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled in-place. +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size +// not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> import numpy as np +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> rng = np.random.default_rng() +// >>> A = rng.normal(size=(2,3,5)) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or tuple of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// (array([[1]]), array([[1, 2]]), array([[1, 2]])) +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> import numpy as np +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// `trapz` is deprecated in NumPy 2.0. +// +// Please use `trapezoid` instead, or one of the numerical integration +// functions in `scipy.integrate`. +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(__llgo_va_list ...interface{}) *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for +// disallowing pickles include security (loading pickled data can execute +// arbitrary code) and portability (pickled objects may not be loadable +// on different Python installations, for example if the stored objects +// require libraries that are not available, and not all pickled data is +// compatible between different versions of Python). +// Default: True +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` +// object is returned. This is a dictionary-like object which can be queried +// for its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or tuple of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array and partially sorts it in such a way that +// the value of the element in k-th position is in the position it would be +// in a sorted array. In the output array, all elements smaller than the k-th +// element are located to the left of this element and all equal or greater +// are located to its right. The ordering of the elements in the two +// partitions on the either side of the k-th element in the output array is +// undefined. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// The sort order of ``np.nan`` is bigger than ``np.inf``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) # may vary +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// +// Find the unique elements and counts of an input array `x`. +// +// This function is an Array API compatible alternative to:: +// +// np.unique(x, return_counts=True, equal_nan=False, sorted=False) +// +// but returns a namedtuple for easier access to each output. +// +// .. note:: +// This function currently always returns a sorted result, however, +// this could change in any NumPy minor release. +// +// Parameters +// ---------- +// x : array_like +// Input array. It will be flattened if it is not already 1-D. +// +// Returns +// ------- +// out : namedtuple +// The result containing: +// +// * values - The unique elements of an input array. +// * counts - The corresponding counts for each unique element. +// +// See Also +// -------- +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = [1, 1, 2] +// >>> uniq = np.unique_counts(x) +// >>> uniq.values +// array([1, 2]) +// >>> uniq.counts +// array([2, 1]) +// +// +//go:linkname UniqueCounts py.unique_counts +func UniqueCounts(x *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// +// The defining property of the antiderivative: +// +// >>> import numpy as np +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> import numpy as np +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or tuple of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// (array([1]), array([3, 4])) +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Examples +// -------- +// >>> import numpy as np +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// The returned indices are not guaranteed to be sorted according to +// the values. Furthermore, the default selection algorithm ``introselect`` +// is unstable, and hence the returned indices are not guaranteed +// to be the earliest/latest occurrence of the element. +// +// `argpartition` works for real/complex inputs with nan values, +// see `partition` for notes on the enhanced sort order and +// different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> import numpy as np +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) # may vary +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) # may vary +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) # may vary +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> # below is the same as np.partition(x, kth=1) +// >>> np.take_along_axis(x, index_array, axis=-1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// .. versionadded:: 2.0.0 +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapezoid : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// >>> import numpy as np +// +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapezoid([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapezoid([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapezoid([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapezoid([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapezoid(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapezoid(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapezoid`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapezoid(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapezoid(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapezoid py.trapezoid +func Trapezoid(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> import numpy as np +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// +// is_busday( +// dates, +// weekmask='1111100', +// holidays=None, +// busdaycal=None, +// out=None +// ) +// +// Calculates which of the given dates are valid days, and which are not. +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> import numpy as np +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(__llgo_va_list ...interface{}) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// >>> import numpy as np +// +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> import numpy as np +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// vecdot : Vector dot product of two arrays. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Returns an array with axes transposed. +// +// For a 1-D array, this returns an unchanged view of the original array, as a +// transposed vector is simply the same vector. +// To convert a 1-D array into a 2-D column vector, an additional dimension +// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does +// ``a[:, np.newaxis]``. +// For a 2-D array, this is the standard matrix transpose. +// For an n-D array, if axes are given, their order indicates how the +// axes are permuted (see Examples). If axes are not provided, then +// ``transpose(a).shape == a.shape[::-1]``. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axes : tuple or list of ints, optional +// If specified, it must be a tuple or list which contains a permutation +// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative +// indices can also be used to specify axes. The i-th axis of the returned +// array will correspond to the axis numbered ``axes[i]`` of the input. +// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses +// the order of the axes. +// +// Returns +// ------- +// p : ndarray +// `a` with its axes permuted. A view is returned whenever possible. +// +// See Also +// -------- +// ndarray.transpose : Equivalent method. +// moveaxis : Move axes of an array to new positions. +// argsort : Return the indices that would sort an array. +// +// Notes +// ----- +// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors +// when using the `axes` keyword argument. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) +// >>> np.transpose(a, (-1, 0, -2)).shape +// (5, 3, 4) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` +// for more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// cumulative_sum : Array API compatible alternative for ``cumsum``. +// sum : Sum array elements. +// trapezoid : Integration of array values using composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(__llgo_va_list ...interface{}) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// >>> import numpy as np +// +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Pow py.pow +func Pow(__llgo_va_list ...interface{}) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response. +// +// .. plot:: +// :include-source: +// +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.hanning(51) +// plt.plot(window) +// plt.title("Hann window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() +// +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// with np.errstate(divide='ignore', invalid='ignore'): +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of the Hann window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Examples +// -------- +// >>> import numpy as np +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Arccosh py.arccosh +func Arccosh(x *py.Object, out *py.Object) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// >>> import numpy as np +// +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647], dtype=int32) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truth value of (x1 > x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// +// See Also +// -------- +// greater_equal, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.greater([4,2],[2,2]) +// array([ True, False]) +// +// The ``>`` operator can be used as a shorthand for ``np.greater`` on +// ndarrays. +// +// >>> a = np.array([4, 2]) +// >>> b = np.array([2, 2]) +// >>> a > b +// array([ True, False]) +// +//go:linkname Greater py.greater +func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, respectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// linalg.outer : An Array API compatible variation of ``np.outer``, +// which accepts 1-dimensional inputs only. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> import numpy as np +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response. +// +// .. plot:: +// :include-source: +// +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.blackman(51) +// plt.plot(window) +// plt.title("Blackman window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() # doctest: +SKIP +// +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// with np.errstate(divide='ignore', invalid='ignore'): +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Blackman window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(__llgo_va_list ...interface{}) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// This function is an Array API compatible alternative to `numpy.cumprod`. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. The default +// (None) is only allowed for one-dimensional arrays. For arrays +// with more than one dimension ``axis`` is required. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If ``dtype`` is not specified, it +// defaults to the dtype of ``x``, unless ``x`` has an integer dtype +// with a precision less than that of the default platform integer. +// In that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// include_initial : bool, optional +// Boolean indicating whether to include the initial value (ones) as +// the first value in the output. With ``include_initial=True`` +// the shape of the output is different than the shape of the input. +// Default: ``False``. +// +// Returns +// ------- +// cumulative_prod_along_axis : ndarray +// A new array holding the result is returned unless ``out`` is +// specified, in which case a reference to ``out`` is returned. The +// result has the same shape as ``x`` if ``include_initial=False``. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> np.cumulative_prod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([1, 2, 3, 4, 5, 6]) +// >>> np.cumulative_prod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of ``b``: +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumulative_prod(b, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of ``b``: +// +// >>> np.cumulative_prod(b, axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname CumulativeProd py.cumulative_prod +func CumulativeProd(x *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// >>> a = np.array([1, 2], dtype=int) +// >>> c = np.append(a, []) +// >>> c +// array([1., 2.]) +// >>> c.dtype +// float64 +// +// Default dtype for empty ndarrays is `float64` thus making the output of dtype +// `float64` when appended with dtype `int64` +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// >>> import numpy as np +// +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or +// a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', +// end with a Z to indicate UTC time. If 'local', convert to the local +// timezone first, and suffix with a +-#### timezone offset. If a tzinfo +// object, then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +//go:linkname Log1p py.log1p +func Log1p(__llgo_va_list ...interface{}) *py.Object +//go:linkname Nextafter py.nextafter +func Nextafter(__llgo_va_list ...interface{}) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy may need to use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``setuptools``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using +// that is likely preferred for build systems other than ``setuptools``:: +// +// $ numpy-config --cflags +// -I/path/to/site-packages/numpy/_core/include +// +// # Or rely on pkg-config: +// $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir) +// $ pkg-config --cflags +// -I/path/to/site-packages/numpy/_core/include +// +// Examples +// -------- +// >>> np.get_include() +// '.../site-packages/numpy/core/include' # may vary +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname BitwiseRightShift py.bitwise_right_shift +func BitwiseRightShift(__llgo_va_list ...interface{}) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), +// array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), +// array([[12., 13., 14., 15.]]), +// array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), +// array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. If this +// is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// .. versionchanged:: 2.0 +// Before NumPy 2.0, ``any`` did not return booleans for object dtype +// input arrays. +// This behavior is still available via ``np.logical_or.reduce``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False, True ], +// ... [False, False, False]], axis=0) +// array([ True, False, True]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any([[np.nan], [np.inf]], axis=1, keepdims=True) +// array([[ True], +// [ True]]) +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> a = np.array([[1, 0, 0], +// ... [0, 0, 1], +// ... [0, 0, 0]]) +// >>> np.any(a, axis=0) +// array([ True, False, True]) +// >>> np.any(a, axis=1) +// array([ True, True, False]) +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// >>> import numpy as np +// +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. In the case of a single +// array_like input, it will be treated as a sequence of arrays; i.e., +// each element along the zeroth axis is treated as a separate array. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays +// horizontally (column-wise). +// unstack : Split an array into a tuple of sub-arrays along an axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int, array-like of ints or bools +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> import numpy as np +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this +// many digits. If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// device : str, optional +// The device on which to place the created array. Default: None. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response. +// +// .. plot:: +// :include-source: +// +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.hamming(51) +// plt.plot(window) +// plt.title("Hamming window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() +// +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Hamming window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Matvec py.matvec +func Matvec(__llgo_va_list ...interface{}) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> import numpy as np +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isneginf(-np.inf) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Inverse hyperbolic cosine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// arccosh : ndarray +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// +// cosh, arcsinh, sinh, arctanh, tanh +// +// Notes +// ----- +// `arccosh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `cosh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in +// ``[0, inf]``. +// +// For real-valued input data types, `arccosh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccosh` is a complex analytical function that +// has a branch cut `[-inf, 1]` and is continuous from above on it. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arccosh +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arccosh([np.e, 10.0]) +// array([ 1.65745445, 2.99322285]) +// >>> np.arccosh(1) +// 0.0 +// +//go:linkname Acosh py.acosh +func Acosh(__llgo_va_list ...interface{}) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> import numpy as np +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='>> import numpy as np +// >>> np.unique_values([1, 1, 2]) +// array([1, 2]) # may vary +// +// +// +//go:linkname UniqueValues py.unique_values +func UniqueValues(x *py.Object) *py.Object +// bitwise_count(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Computes the number of 1-bits in the absolute value of ``x``. +// Analogous to the builtin `int.bit_count` or ``popcount`` in C++. +// +// Parameters +// ---------- +// x : array_like, unsigned int +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding number of 1-bits in the input. +// Returns uint8 for all integer types +// This is a scalar if `x` is a scalar. +// +// References +// ---------- +// .. [1] https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel +// +// .. [2] Wikipedia, "Hamming weight", +// https://en.wikipedia.org/wiki/Hamming_weight +// +// .. [3] http://aggregate.ee.engr.uky.edu/MAGIC/#Population%20Count%20(Ones%20Count) +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.bitwise_count(1023) +// np.uint8(10) +// >>> a = np.array([2**i - 1 for i in range(16)]) +// >>> np.bitwise_count(a) +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], +// dtype=uint8) +// +//go:linkname BitwiseCount py.bitwise_count +func BitwiseCount(x *py.Object, out *py.Object) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import numpy as np +// +// >>> import matplotlib.pyplot as plt +// >>> import numpy as np +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +//go:linkname Rint py.rint +func Rint(__llgo_va_list ...interface{}) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// ddof : {int, float}, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. See Notes for details about use of `ddof`. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// mean : array_like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this std function. +// +// .. versionadded:: 2.0.0 +// +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// There are several common variants of the array standard deviation +// calculation. Assuming the input `a` is a one-dimensional NumPy array +// and ``mean`` is either provided as an argument or computed as +// ``a.mean()``, NumPy computes the standard deviation of an array as:: +// +// N = len(a) +// d2 = abs(a - mean)**2 # abs is for complex `a` +// var = d2.sum() / (N - ddof) # note use of `ddof` +// std = var**0.5 +// +// Different values of the argument `ddof` are useful in different +// contexts. NumPy's default ``ddof=0`` corresponds with the expression: +// +// .. math:: +// +// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N}} +// +// which is sometimes called the "population standard deviation" in the field +// of statistics because it applies the definition of standard deviation to +// `a` as if `a` were a complete population of possible observations. +// +// Many other libraries define the standard deviation of an array +// differently, e.g.: +// +// .. math:: +// +// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N - 1}} +// +// In statistics, the resulting quantity is sometimes called the "sample +// standard deviation" because if `a` is a random sample from a larger +// population, this calculation provides the square root of an unbiased +// estimate of the variance of the population. The use of :math:`N-1` in the +// denominator is often called "Bessel's correction" because it corrects for +// bias (toward lower values) in the variance estimate introduced when the +// sample mean of `a` is used in place of the true mean of the population. +// The resulting estimate of the standard deviation is still biased, but less +// than it would have been without the correction. For this quantity, use +// ``ddof=1``. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the standard deviation is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// np.float32(0.45000005) +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// Using the mean keyword to save computation time: +// +// >>> import numpy as np +// >>> from timeit import timeit +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> mean = np.mean(a, axis=1, keepdims=True) +// >>> +// >>> g = globals() +// >>> n = 10000 +// >>> t1 = timeit("std = np.std(a, axis=1, mean=mean)", globals=g, number=n) +// >>> t2 = timeit("std = np.std(a, axis=1)", globals=g, number=n) +// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') +// #doctest: +SKIP +// Percentage execution time saved 30% +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object +// +// busday_count( +// begindates, +// enddates, +// weekmask='1111100', +// holidays=[], +// busdaycal=None, +// out=None +// ) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> import numpy as np +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// concatenate( +// (a1, a2, ...), +// axis=0, +// out=None, +// dtype=None, +// casting="same_kind" +// ) +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// For a description of the options, please see :term:`casting`. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concat py.concat +func Concat(__llgo_va_list ...interface{}) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) # doctest: +SKIP +// array([nan, 1., 1.]) +// RuntimeWarning: invalid value encountered in divide +// +// >>> oldsettings = np.seterr(all='warn', invalid='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'warn', 'invalid': 'raise'} +// >>> np.arange(3.) / np.arange(3.) +// Traceback (most recent call last): +// ... +// FloatingPointError: invalid value encountered in divide +// >>> oldsettings = np.seterr(**oldsettings) # restore original +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +//go:linkname Logaddexp py.logaddexp +func Logaddexp(__llgo_va_list ...interface{}) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, +// in general, the actual implementation will vary with data type. +// The 'mergesort' option is retained for backwards compatibility. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// stable : bool, optional +// Sort stability. If ``True``, the returned array will maintain +// the relative order of ``a`` values which compare as equal. +// If ``False`` or ``None``, this is not guaranteed. Internally, +// this option selects ``kind='stable'``. Default: ``None``. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// For performance, ``sort`` makes a temporary copy if needed to make the data +// `contiguous `_ +// in memory along the sort axis. For even better performance and reduced +// memory consumption, ensure that the array is already contiguous along the +// sort axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// quicksort has been changed to: +// `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt +// `_ +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. +// Radix sort is an O(n) sort instead of O(n log n). +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '`. +// +// Returns +// ------- +// angle : ndarray +// The angle of the ray intersecting the unit circle at the given +// `x`-coordinate in radians [0, pi]. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// cos, arctan, arcsin, emath.arccos +// +// Notes +// ----- +// `arccos` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``cos(z) = x``. The convention is to return +// the angle `z` whose real part lies in `[0, pi]`. +// +// For real-valued input data types, `arccos` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytic function that +// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse `cos` is also known as `acos` or cos^-1. +// +// References +// ---------- +// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> import numpy as np +// +// We expect the arccos of 1 to be 0, and of -1 to be pi: +// +// >>> np.arccos([1, -1]) +// array([ 0. , 3.14159265]) +// +// Plot arccos: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-1, 1, num=100) +// >>> plt.plot(x, np.arccos(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Acos py.acos +func Acos(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> import numpy as np +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// vecdot(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) +// +// Vector dot product of two arrays. +// +// Let :math:`\mathbf{a}` be a vector in `x1` and :math:`\mathbf{b}` be +// a corresponding vector in `x2`. The dot product is defined as: +// +// .. math:: +// \mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} \overline{a_i}b_i +// +// where the sum is over the last dimension (unless `axis` is specified) and +// where :math:`\overline{a_i}` denotes the complex conjugate if :math:`a_i` +// is complex and the identity otherwise. +// +// .. versionadded:: 2.0.0 +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// the broadcasted shape of `x1` and `x2` with the last axis removed. +// If not provided or None, a freshly-allocated array is used. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The vector dot product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : same but flattens arguments first +// matmul : Matrix-matrix product. +// vecmat : Vector-matrix product. +// matvec : Matrix-vector product. +// einsum : Einstein summation convention. +// +// Examples +// -------- +// >>> import numpy as np +// +// Get the projected size along a given normal for an array of vectors. +// +// >>> v = np.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]]) +// >>> n = np.array([0., 0.6, 0.8]) +// >>> np.vecdot(v, n) +// array([ 3., 8., 10.]) +// +//go:linkname Vecdot py.vecdot +func Vecdot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// from_dlpack(x, /, *, device=None, copy=None) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a view of the input +// object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// device : device, optional +// Device on which to place the created array. Default: ``None``. +// Must be ``"cpu"`` if passed which may allow importing an array +// that is not already CPU available. +// copy : bool, optional +// Boolean indicating whether or not to copy the input. If ``True``, +// the copy will be made. If ``False``, the function will never copy, +// and will raise ``BufferError`` in case a copy is deemed necessary. +// Passing it requests a copy from the exporter who may or may not +// implement the capability. +// If ``None``, the function will reuse the existing memory buffer if +// possible and copy otherwise. Default: ``None``. +// +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch # doctest: +SKIP +// >>> x = torch.arange(10) # doctest: +SKIP +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) # doctest: +SKIP +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truth value of (x1 < x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> import numpy as np +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2, 5, 4]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.bytes_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// Please note that the ``dtype`` of `weights` will also become the +// ``dtype`` of the returned accumulator (`hist`), so it must be +// large enough to hold accumulated values as well. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. If `weights` are given, +// ``hist.dtype`` will be taken from `weights`. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points. +// +// .. plot:: +// :include-source: +// +// import matplotlib.pyplot as plt +// import numpy as np +// +// rng = np.random.RandomState(10) # deterministic random data +// a = np.hstack((rng.normal(size=1000), +// rng.normal(loc=5, scale=2, size=1000))) +// plt.hist(a, bins='auto') # arguments are passed to np.histogram +// plt.title("Histogram with 'auto' bins") +// plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename, file handle or pathlib.Path +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, ``fmt='%.4e'``, resulting in numbers formatted +// like ``' (%s+%sj)' % (fmt, fmt)`` +// * a full string specifying every real and imaginary part, e.g. +// ``' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'`` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. ``['%.3e + %.3ej', '(%.15e%+.15ej)']`` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// header : str, optional +// String that will be written at the beginning of the file. +// footer : str, optional +// String that will be written at the end of the file. +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(__llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Numerical positive, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// +// Split an array into a sequence of arrays along the given axis. +// +// The ``axis`` parameter specifies the dimension along which the array will +// be split. For example, if ``axis=0`` (the default) it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// The result is a tuple of arrays split along ``axis``. +// +// .. versionadded:: 2.1.0 +// +// Parameters +// ---------- +// x : ndarray +// The array to be unstacked. +// axis : int, optional +// Axis along which the array will be split. Default: ``0``. +// +// Returns +// ------- +// unstacked : tuple of ndarrays +// The unstacked arrays. +// +// See Also +// -------- +// stack : Join a sequence of arrays along a new axis. +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Notes +// ----- +// ``unstack`` serves as the reverse operation of :py:func:`stack`, i.e., +// ``stack(unstack(x, axis=axis), axis=axis) == x``. +// +// This function is equivalent to ``tuple(np.moveaxis(x, axis, 0))``, since +// iterating on an array iterates along the first axis. +// +// Examples +// -------- +// >>> arr = np.arange(24).reshape((2, 3, 4)) +// >>> np.unstack(arr) +// (array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]), +// array([[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]])) +// >>> np.unstack(arr, axis=1) +// (array([[ 0, 1, 2, 3], +// [12, 13, 14, 15]]), +// array([[ 4, 5, 6, 7], +// [16, 17, 18, 19]]), +// array([[ 8, 9, 10, 11], +// [20, 21, 22, 23]])) +// >>> arr2 = np.stack(np.unstack(arr, axis=1), axis=1) +// >>> arr2.shape +// (2, 3, 4) +// >>> np.all(arr == arr2) +// np.True_ +// +// +// +//go:linkname Unstack py.unstack +func Unstack(x *py.Object) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// +// .. versionchanged:: 2.0 +// The sign parameter can now be an integer type, previously +// types were floating-point types. +// +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// This function is an Array API compatible alternative to `numpy.cumsum`. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is only allowed for one-dimensional arrays. For arrays +// with more than one dimension ``axis`` is required. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If ``dtype`` is not specified, it defaults +// to the dtype of ``x``, unless ``x`` has an integer dtype with +// a precision less than that of the default platform integer. +// In that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` +// for more details. +// include_initial : bool, optional +// Boolean indicating whether to include the initial value (zeros) as +// the first value in the output. With ``include_initial=True`` +// the shape of the output is different than the shape of the input. +// Default: ``False``. +// +// Returns +// ------- +// cumulative_sum_along_axis : ndarray +// A new array holding the result is returned unless ``out`` is +// specified, in which case a reference to ``out`` is returned. The +// result has the same shape as ``x`` if ``include_initial=False``. +// +// See Also +// -------- +// sum : Sum array elements. +// trapezoid : Integration of array values using composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumulative_sum(a)[-1]`` may not be equal to ``sum(a)`` for +// floating-point values since ``sum`` may use a pairwise summation routine, +// reducing the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 4, 5, 6]) +// >>> a +// array([1, 2, 3, 4, 5, 6]) +// >>> np.cumulative_sum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumulative_sum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumulative_sum(b,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumulative_sum(b,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumulative_sum(c)[-1]`` may not be equal to ``sum(c)`` +// +// >>> c = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> np.cumulative_sum(c)[-1] +// 1000000.0050045159 +// >>> c.sum() +// 1000000.0050000029 +// +// +// +//go:linkname CumulativeSum py.cumulative_sum +func CumulativeSum(x *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Examples +// -------- +// >>> import numpy as np +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype +// +// Examples +// -------- +// >>> import numpy as np +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python +// `bisect.bisect_left` (``side='left'``) and `bisect.bisect_right` +// (``side='right'``) functions, which is also vectorized +// in the `v` argument. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.searchsorted([11,12,13,14,15], 13) +// 2 +// >>> np.searchsorted([11,12,13,14,15], 13, side='right') +// 3 +// >>> np.searchsorted([11,12,13,14,15], [-10, 20, 12, 13]) +// array([0, 5, 1, 2]) +// +// When `sorter` is used, the returned indices refer to the sorted +// array of `a` and not `a` itself: +// +// >>> a = np.array([40, 10, 20, 30]) +// >>> sorter = np.argsort(a) +// >>> sorter +// array([1, 2, 3, 0]) # Indices that would sort the array 'a' +// >>> result = np.searchsorted(a, 25, sorter=sorter) +// >>> result +// 2 +// >>> a[sorter[result]] +// 30 # The element at index 2 of the sorted array is 30. +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Add arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be added. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// add : ndarray or scalar +// The sum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` + `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.add(1.0, 4.0) +// 5.0 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.add(x1, x2) +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 + x2 +// array([[ 0., 2., 4.], +// [ 3., 5., 7.], +// [ 6., 8., 10.]]) +// +//go:linkname Add py.add +func Add(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// stable : bool, optional +// Sort stability. If ``True``, the returned array will maintain +// the relative order of ``a`` values which compare as equal. +// If ``False`` or ``None``, this is not guaranteed. Internally, +// this option selects ``kind='stable'``. Default: ``None``. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> import numpy as np +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.1.0 +// +// copy : bool, optional +// If ``True``, then the object is copied. If ``None`` then the object is +// copied only if needed, i.e. if ``__array__`` returns a copy, if obj +// is a nested sequence, or if a copy is needed to satisfy any of +// the other requirements (``dtype``, ``order``, etc.). +// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. +// Default: ``None``. +// +// .. versionadded:: 2.1.0 +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> import numpy as np +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// +// Consider four points in different quadrants: +// +// >>> import numpy as np +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Atan2 py.atan2 +func Atan2(__llgo_va_list ...interface{}) *py.Object +// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the truth value of (x1 >= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : bool or ndarray of bool +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, less_equal, equal, not_equal +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) +// array([ True, True, False]) +// +// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` +// on ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a >= b +// array([ True, True, False]) +// +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Determine if a provided dtype is of a specified data type ``kind``. +// +// This function only supports built-in NumPy's data types. +// Third-party dtypes are not yet supported. +// +// Parameters +// ---------- +// dtype : dtype +// The input dtype. +// kind : dtype or str or tuple of dtypes/strs. +// dtype or dtype kind. Allowed dtype kinds are: +// * ``'bool'`` : boolean kind +// * ``'signed integer'`` : signed integer data types +// * ``'unsigned integer'`` : unsigned integer data types +// * ``'integral'`` : integer data types +// * ``'real floating'`` : real-valued floating-point data types +// * ``'complex floating'`` : complex floating-point data types +// * ``'numeric'`` : numeric data types +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// issubdtype +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isdtype(np.float32, np.float64) +// False +// >>> np.isdtype(np.float32, "real floating") +// True +// >>> np.isdtype(np.complex128, ("real floating", "complex floating")) +// True +// +// +// +//go:linkname Isdtype py.isdtype +func Isdtype(dtype *py.Object, kind *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// >>> import numpy as np +// +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(-np.inf) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// +// Consider four points in different quadrants: +// +// >>> import numpy as np +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If ``True`` (default), then the array data is copied. If ``None``, +// a copy will only be made if ``__array__`` returns a copy, if obj is +// a nested sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). Note that any copy of +// the data is shallow, i.e., for arrays with object dtype, the new +// array will point to the same objects. See Examples for `ndarray.copy`. +// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. +// Default: ``True``. +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=None`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// copy: Return an array copy of the given object. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3], dtype=int32) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.asmatrix('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.asmatrix('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// with magnitudes much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : array_like +// The relative tolerance parameter (see Notes). +// atol : array_like +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent.:: +// +// absolute(a - b) <= (atol + rtol * absolute(b)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. +// +// The default value of `atol` is not appropriate when the reference value +// `b` has magnitude smaller than one. For example, it is unlikely that +// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet +// ``isclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure +// to select `atol` for the use case at hand, especially for defining the +// threshold below which a non-zero value in `a` will be considered "close" +// to a very small or zero value in `b`. +// +// `isclose` is not defined for non-numeric data types. +// :class:`bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, device=None, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// device : str, optional +// The device on which to place the created array. Default: ``None``. +// For Array-API interoperability only, so must be ``"cpu"`` if passed. +// +// .. versionadded:: 2.0.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function [1]_ is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// References +// ---------- +// .. [1] Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname Log10 py.log10 +func Log10(__llgo_va_list ...interface{}) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(__llgo_va_list ...interface{}) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete. If you only want to check if an array is Fortran +// contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> import numpy as np +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. If this +// is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` +// for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// .. versionchanged:: 2.0 +// Before NumPy 2.0, ``all`` did not return booleans for object dtype +// input arrays. +// This behavior is still available via ``np.logical_and.reduce``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Compute tensor dot product along specified axes. +// +// Given two tensors, `a` and `b`, and an array_like object containing +// two array_like objects, ``(a_axes, b_axes)``, sum the products of +// `a`'s and `b`'s elements (components) over the axes specified by +// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative +// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions +// of `a` and the first ``N`` dimensions of `b` are summed over. +// +// Parameters +// ---------- +// a, b : array_like +// Tensors to "dot". +// +// axes : int or (2,) array_like +// * integer_like +// If an int N, sum over the last N axes of `a` and the first N axes +// of `b` in order. The sizes of the corresponding axes must match. +// * (2,) array_like +// Or, a list of axes to be summed over, first sequence applying to `a`, +// second to `b`. Both elements array_like must be of the same length. +// +// Returns +// ------- +// output : ndarray +// The tensor dot product of the input. +// +// See Also +// -------- +// dot, einsum +// +// Notes +// ----- +// Three common use cases are: +// * ``axes = 0`` : tensor product :math:`a\otimes b` +// * ``axes = 1`` : tensor dot product :math:`a\cdot b` +// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` +// +// When `axes` is integer_like, the sequence of axes for evaluation +// will be: from the -Nth axis to the -1th axis in `a`, +// and from the 0th axis to (N-1)th axis in `b`. +// For example, ``axes = 2`` is the equal to +// ``axes = [[-2, -1], [0, 1]]``. +// When N-1 is smaller than 0, or when -N is larger than -1, +// the element of `a` and `b` are defined as the `axes`. +// +// When there is more than one axis to sum over - and they are not the last +// (first) axes of `a` (`b`) - the argument `axes` should consist of +// two sequences of the same length, with the first axis to sum over given +// first in both sequences, the second axis second, and so forth. +// The calculation can be referred to ``numpy.einsum``. +// +// The shape of the result consists of the non-contracted axes of the +// first tensor, followed by the non-contracted axes of the second. +// +// Examples +// -------- +// An example on integer_like: +// +// >>> a_0 = np.array([[1, 2], [3, 4]]) +// >>> b_0 = np.array([[5, 6], [7, 8]]) +// >>> c_0 = np.tensordot(a_0, b_0, axes=0) +// >>> c_0.shape +// (2, 2, 2, 2) +// >>> c_0 +// array([[[[ 5, 6], +// [ 7, 8]], +// [[10, 12], +// [14, 16]]], +// [[[15, 18], +// [21, 24]], +// [[20, 24], +// [28, 32]]]]) +// +// An example on array_like: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// A slower but equivalent way of computing the same... +// +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// vecmat(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) +// +// Vector-matrix dot product of two arrays. +// +// Given a vector (or stack of vector) :math:`\mathbf{v}` in ``x1`` and +// a matrix (or stack of matrices) :math:`\mathbf{A}` in ``x2``, the +// vector-matrix product is defined as: +// +// .. math:: +// \mathbf{b} \cdot \mathbf{A} = \sum_{i=0}^{n-1} \overline{v_i}A_{ij} +// +// where the sum is over the last dimension of ``x1`` and the one-but-last +// dimensions in ``x2`` (unless `axes` is specified) and where +// :math:`\overline{v_i}` denotes the complex conjugate if :math:`v` +// is complex and the identity otherwise. (For a non-conjugated vector-matrix +// product, use ``np.matvec(x2.mT, x1)``.) +// +// .. versionadded:: 2.2.0 +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// the broadcasted shape of ``x1`` and ``x2`` with the summation axis +// removed. If not provided or None, a freshly-allocated array is used. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The vector-matrix product of the inputs. +// +// Raises +// ------ +// ValueError +// If the last dimensions of ``x1`` and the one-but-last dimension of +// ``x2`` are not the same size. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vecdot : Vector-vector product. +// matvec : Matrix-vector product. +// matmul : Matrix-matrix product. +// einsum : Einstein summation convention. +// +// Examples +// -------- +// Project a vector along X and Y. +// +// >>> v = np.array([0., 4., 2.]) +// >>> a = np.array([[1., 0., 0.], +// ... [0., 1., 0.], +// ... [0., 0., 0.]]) +// >>> np.vecmat(v, a) +// array([ 0., 4., 0.]) +// +//go:linkname Vecmat py.vecmat +func Vecmat(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `element` and `test_elements`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `element` plus the max-min value of `test_elements`. +// `assume_unique` has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `element` and `test_elements`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// Notes +// ----- +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(test_elements)) > +// (log10(max(test_elements)-min(test_elements)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// Examples +// -------- +// >>> import numpy as np +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. If both ``a_min`` and ``a_max`` are ``None``, +// the elements of the returned array stay the same. Both are broadcasted +// against ``a``. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// min, max : array_like or None +// Array API compatible alternatives for ``a_min`` and ``a_max`` +// arguments. Either ``a_min`` and ``a_max`` or ``min`` and ``max`` +// can be passed at the same time. Default: ``None``. +// +// .. versionadded:: 2.1.0 +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib). +// +// .. plot:: +// :include-source: +// +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.bartlett(51) +// plt.plot(window) +// plt.title("Bartlett window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// with np.errstate(divide='ignore', invalid='ignore'): +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Bartlett window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes +// specified in the axis parameter. +// Default: 1. (see Examples below). +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// Returns +// ------- +// gradient : ndarray or tuple of ndarray +// A tuple of ndarrays (or a single ndarray if there is only one +// dimension) corresponding to the derivatives of f with respect +// to each dimension. Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> import numpy as np +// >>> f = np.array([1, 2, 4, 7, 11, 16]) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.]) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]])) +// (array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), +// array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])) +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), dx, y) +// (array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), +// array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])) +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// The `varargs` argument defines the spacing between sample points in the +// input array. It can take two forms: +// +// 1. An array, specifying coordinates, which may be unevenly spaced: +// +// >>> x = np.array([0., 2., 3., 6., 8.]) +// >>> y = x ** 2 +// >>> np.gradient(y, x, edge_order=2) +// array([ 0., 4., 6., 12., 16.]) +// +// 2. A scalar, representing the fixed sample distance: +// +// >>> dx = 2 +// >>> x = np.array([0., 2., 4., 6., 8.]) +// >>> y = x ** 2 +// >>> np.gradient(y, dx, edge_order=2) +// array([ 0., 4., 8., 12., 16.]) +// +// It's possible to provide different data for spacing along each dimension. +// The number of arguments must match the number of dimensions in the input +// data. +// +// >>> dx = 2 +// >>> dy = 3 +// >>> x = np.arange(0, 6, dx) +// >>> y = np.arange(0, 9, dy) +// >>> xs, ys = np.meshgrid(x, y) +// >>> zs = xs + 2 * ys +// >>> np.gradient(zs, dy, dx) # Passing two scalars +// (array([[2., 2., 2.], +// [2., 2., 2.], +// [2., 2., 2.]]), +// array([[1., 1., 1.], +// [1., 1., 1.], +// [1., 1., 1.]])) +// +// Mixing scalars and arrays is also allowed: +// +// >>> np.gradient(zs, y, dx) # Passing one array and one scalar +// (array([[2., 2., 2.], +// [2., 2., 2.], +// [2., 2., 2.]]), +// array([[1., 1., 1.], +// [1., 1., 1.], +// [1., 1., 1.]])) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default, +// axis=None, will compute the median along a flattened version of +// the array. If a sequence of axes, the array is first flattened +// along the given axes, then the median is computed along the +// resulting flattened axis. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// np.float64(3.5) +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> np.median(a, axis=(0, 1)) +// np.float64(3.5) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// np.float64(3.5) +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> import numpy as np +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities of the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// The recommended options, numbered as they appear in [1]_, are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. For backward compatibility +// with previous versions of NumPy, the following discontinuous variations +// of the default 'linear' (7.) option are available: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// See Notes for details. +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the quantile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// See the notes for more details. +// +// .. versionadded:: 2.0.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis +// of the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a sample `a` from an underlying distribution, `quantile` provides a +// nonparametric estimate of the inverse cumulative distribution function. +// +// By default, this is done by interpolating between adjacent elements in +// ``y``, a sorted copy of `a`:: +// +// (1-g)*y[j] + g*y[j+1] +// +// where the index ``j`` and coefficient ``g`` are the integral and +// fractional components of ``q * (n-1)``, and ``n`` is the number of +// elements in the sample. +// +// This is a special case of Equation 1 of H&F [1]_. More generally, +// +// - ``j = (q*n + m - 1) // 1``, and +// - ``g = (q*n + m - 1) % 1``, +// +// where ``m`` may be defined according to several different conventions. +// The preferred convention may be selected using the ``method`` parameter: +// +// =============================== =============== =============== +// ``method`` number in H&F ``m`` +// =============================== =============== =============== +// ``interpolated_inverted_cdf`` 4 ``0`` +// ``hazen`` 5 ``1/2`` +// ``weibull`` 6 ``q`` +// ``linear`` (default) 7 ``1 - q`` +// ``median_unbiased`` 8 ``q/3 + 1/3`` +// ``normal_unbiased`` 9 ``q/4 + 3/8`` +// =============================== =============== =============== +// +// Note that indices ``j`` and ``j + 1`` are clipped to the range ``0`` to +// ``n - 1`` when the results of the formula would be outside the allowed +// range of non-negative indices. The ``- 1`` in the formulas for ``j`` and +// ``g`` accounts for Python's 0-based indexing. +// +// The table above includes only the estimators from H&F that are continuous +// functions of probability `q` (estimators 4-9). NumPy also provides the +// three discontinuous estimators from H&F (estimators 1-3), where ``j`` is +// defined as above, ``m`` is defined as follows, and ``g`` is a function +// of the real-valued ``index = q*n + m - 1`` and ``j``. +// +// 1. ``inverted_cdf``: ``m = 0`` and ``g = int(index - j > 0)`` +// 2. ``averaged_inverted_cdf``: ``m = 0`` and +// ``g = (1 + int(index - j > 0)) / 2`` +// 3. ``closest_observation``: ``m = -1/2`` and +// ``g = 1 - int((index == j) & (j%2 == 1))`` +// +// For backward compatibility with previous versions of NumPy, `quantile` +// provides four additional discontinuous estimators. Like +// ``method='linear'``, all have ``m = 1 - q`` so that ``j = q*(n-1) // 1``, +// but ``g`` is defined as follows. +// +// - ``lower``: ``g = 0`` +// - ``midpoint``: ``g = 0.5`` +// - ``higher``: ``g = 1`` +// - ``nearest``: ``g = (q*(n-1) % 1) > 0.5`` +// +// **Weighted quantiles:** +// More formally, the quantile at probability level :math:`q` of a cumulative +// distribution function :math:`F(y)=P(Y \leq y)` with probability measure +// :math:`P` is defined as any number :math:`x` that fulfills the +// *coverage conditions* +// +// .. math:: P(Y < x) \leq q \quad\text{and}\quad P(Y \leq x) \geq q +// +// with random variable :math:`Y\sim P`. +// Sample quantiles, the result of `quantile`, provide nonparametric +// estimation of the underlying population counterparts, represented by the +// unknown :math:`F`, given a data vector `a` of length ``n``. +// +// Some of the estimators above arise when one considers :math:`F` as the +// empirical distribution function of the data, i.e. +// :math:`F(y) = \frac{1}{n} \sum_i 1_{a_i \leq y}`. +// Then, different methods correspond to different choices of :math:`x` that +// fulfill the above coverage conditions. Methods that follow this approach +// are ``inverted_cdf`` and ``averaged_inverted_cdf``. +// +// For weighted quantiles, the coverage conditions still hold. The +// empirical cumulative distribution is simply replaced by its weighted +// version, i.e. +// :math:`P(Y \leq t) = \frac{1}{\sum_i w_i} \sum_i w_i 1_{x_i \leq t}`. +// Only ``method="inverted_cdf"`` supports weights. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as ``a.shape`` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as ``a.shape``. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), +// ... axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> import numpy as np +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import numpy as np +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response. +// +// .. plot:: +// :include-source: +// +// import matplotlib.pyplot as plt +// from numpy.fft import fft, fftshift +// window = np.kaiser(51, 14) +// plt.plot(window) +// plt.title("Kaiser window") +// plt.ylabel("Amplitude") +// plt.xlabel("Sample") +// plt.show() +// +// plt.figure() +// A = fft(window, 2048) / 25.5 +// mag = np.abs(fftshift(A)) +// freq = np.linspace(-0.5, 0.5, len(A)) +// response = 20 * np.log10(mag) +// response = np.clip(response, -100, 100) +// plt.plot(freq, response) +// plt.title("Frequency response of Kaiser window") +// plt.ylabel("Magnitude [dB]") +// plt.xlabel("Normalized frequency [cycles per sample]") +// plt.axis('tight') +// plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// Remove values along a dimension which are zero along all other. +// +// Parameters +// ---------- +// filt : array_like +// Input array. +// trim : {"fb", "f", "b"}, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. By default, zeros are trimmed on both sides. +// Front and back refer to the edges of a dimension, with "front" referring +// to the side with the lowest index 0, and "back" referring to the highest +// index (or index -1). +// axis : int or sequence, optional +// If None, `filt` is cropped such that the smallest bounding box is +// returned that still contains all values which are not zero. +// If an axis is specified, `filt` will be sliced in that dimension only +// on the sides specified by `trim`. The remaining area will be the +// smallest that still contains all values wich are not zero. +// +// .. versionadded:: 2.2.0 +// +// Returns +// ------- +// trimmed : ndarray or sequence +// The result of trimming the input. The number of dimensions and the +// input data type are preserved. +// +// Notes +// ----- +// For all-zero arrays, the first axis is trimmed first. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, trim='b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// Multiple dimensions are supported. +// +// >>> b = np.array([[0, 0, 2, 3, 0, 0], +// ... [0, 1, 0, 3, 0, 0], +// ... [0, 0, 0, 0, 0, 0]]) +// >>> np.trim_zeros(b) +// array([[0, 2, 3], +// [1, 0, 3]]) +// +// >>> np.trim_zeros(b, axis=-1) +// array([[0, 2, 3], +// [1, 0, 3], +// [0, 0, 0]]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object, axis *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : tuple of ndarrays +// A tuple of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> import numpy as np +// >>> rng = np.random.default_rng() +// >>> r = rng.normal(size=(100,3)) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the quantile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// +// .. versionadded:: 2.0.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// The behavior of `numpy.nanquantile` is the same as that of +// `numpy.quantile` (ignoring nan values). +// For more information, please see `numpy.quantile`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// np.float64(nan) +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// >>> import numpy as np +// +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The `vdot` function handles complex numbers differently than `dot`: +// if the first argument is complex, it is replaced by its complex conjugate +// in the dot product calculation. `vdot` also handles multidimensional +// arrays differently than `dot`: it does not perform a matrix product, but +// flattens the arguments to 1-D arrays before taking a vector dot product. +// +// Consequently, when the arguments are 2-D arrays of the same shape, this +// function effectively returns their +// `Frobenius inner product `_ +// (also known as the *trace inner product* or the *standard inner product* +// on a vector space of matrices). +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// >>> import numpy as np +// +// Convert a list into an array. If all elements are finite, then +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, -np.inf]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the percentile according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. +// Only `method="inverted_cdf"` supports weights. +// +// .. versionadded:: 2.0.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// The behavior of `numpy.nanpercentile` with percentage `q` is that of +// `numpy.quantile` with argument ``q/100`` (ignoring nan values). +// For more information, please see `numpy.quantile`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// np.float64(nan) +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : {int, float}, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// mean : array_like, optional +// Provide the mean to prevent its recalculation. The mean should have +// a shape as if it was calculated with ``keepdims=True``. +// The axis for the calculation of the mean should be the same as used in +// the call to this var function. +// +// .. versionadded:: 2.0.0 +// +// correction : {int, float}, optional +// Array API compatible name for the ``ddof`` parameter. Only one of them +// can be provided at the same time. +// +// .. versionadded:: 2.0.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// *args : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +//go:linkname RightShift py.right_shift +func RightShift(__llgo_va_list ...interface{}) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` +// for more details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// >>> import numpy as np +// +// Define the signum function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> import numpy as np +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// np.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `numpy.digitize` is implemented in terms of `numpy.searchsorted`. +// This means that a binary search is used to bin the values, which scales +// much better for larger number of bins than the previous linear search. +// It also removes the requirement for the input array to be 1-dimensional. +// +// For monotonically *increasing* `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> import numpy as np +// +// Beginning with an array of integers from 0 to 5 (inclusive), +// elements less than ``3`` are negated, elements greater than ``3`` +// are squared, and elements not meeting either of these conditions +// (exactly ``3``) are replaced with a `default` value of ``42``. +// +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [-x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, -1, -2, 42, 16, 25]) +// +// When multiple conditions are satisfied, the first one encountered in +// `condlist` is used. +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> import numpy as np +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(__llgo_va_list ...interface{}) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value:: +// +// p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1] +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the bit-wise NOT of the absolute value is +// returned. In a two's-complement system, this operation effectively flips +// all the bits, resulting in a representation that corresponds to the +// negative of the input plus one. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range :math:`-2^{N-1}` to +// :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// ``numpy.bitwise_not`` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> import numpy as np +// +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// np.uint8(242) +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// np.uint16(65522) +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types, the result is the bit-wise NOT of +// the unsigned type, interpreted as a signed integer: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseInvert py.bitwise_invert +func BitwiseInvert(__llgo_va_list ...interface{}) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `numpy.int8`, `numpy.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// >>> import numpy as np +// +// Create a 4 by 4 array +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname BitwiseLeftShift py.bitwise_left_shift +func BitwiseLeftShift(__llgo_va_list ...interface{}) *py.Object +// +// concatenate( +// (a1, a2, ...), +// axis=0, +// out=None, +// dtype=None, +// casting="same_kind" +// ) +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// For a description of the options, please see :term:`casting`. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Transposes a matrix (or a stack of matrices) ``x``. +// +// This function is Array API compatible. +// +// Parameters +// ---------- +// x : array_like +// Input array having shape (..., M, N) and whose two innermost +// dimensions form ``MxN`` matrices. +// +// Returns +// ------- +// out : ndarray +// An array containing the transpose for each matrix and having shape +// (..., N, M). +// +// See Also +// -------- +// transpose : Generic transpose method. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.matrix_transpose([[1, 2], [3, 4]]) +// array([[1, 3], +// [2, 4]]) +// +// >>> np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) +// array([[[1, 3], +// [2, 4]], +// [[5, 7], +// [6, 8]]]) +// +// +// +//go:linkname MatrixTranspose py.matrix_transpose +func MatrixTranspose(__llgo_va_list ...interface{}) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. If +// axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// add: ``numpy.add.reduce`` equivalent function. +// cumsum : Cumulative sum of array elements. +// trapezoid : Integration of array values using composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// np.int32(1) +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// np.int8(-128) +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(__llgo_va_list ...interface{}) *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int, array-like of ints or bools +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionchanged:: 2.1.2 +// Boolean indices are now treated as a mask of elements to insert, +// rather than being cast to the integers 0 and 1. +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. This is because of the difference between basic +// and advanced :ref:`indexing `. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.arange(6).reshape(3, 2) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.insert(a, 1, 6) +// array([0, 6, 1, 2, 3, 4, 5]) +// >>> np.insert(a, 1, 6, axis=1) +// array([[0, 6, 1], +// [2, 6, 3], +// [4, 6, 5]]) +// +// Difference between sequence and scalars, +// showing how ``obj=[1]`` behaves different from ``obj=1``: +// +// >>> np.insert(a, [1], [[7],[8],[9]], axis=1) +// array([[0, 7, 1], +// [2, 8, 3], +// [4, 9, 5]]) +// >>> np.insert(a, 1, [[7],[8],[9]], axis=1) +// array([[0, 7, 8, 9, 1], +// [2, 7, 8, 9, 3], +// [4, 7, 8, 9, 5]]) +// >>> np.array_equal(np.insert(a, 1, [7, 8, 9], axis=1), +// ... np.insert(a, [1], [[7],[8],[9]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([0, 1, 2, 3, 4, 5]) +// >>> np.insert(b, [2, 2], [6, 7]) +// array([0, 1, 6, 7, 2, 3, 4, 5]) +// +// >>> np.insert(b, slice(2, 4), [7, 8]) +// array([0, 1, 7, 2, 8, 3, 4, 5]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([0, 1, 7, 0, 2, 3, 4, 5]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> import numpy as np +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the bit-wise NOT of the absolute value is +// returned. In a two's-complement system, this operation effectively flips +// all the bits, resulting in a representation that corresponds to the +// negative of the input plus one. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range :math:`-2^{N-1}` to +// :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// ``numpy.bitwise_not`` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> import numpy as np +// +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// np.uint8(242) +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// np.uint16(65522) +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types, the result is the bit-wise NOT of +// the unsigned type, interpreted as a signed integer: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator ``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python's `math.remainder` and C's ``remainder``, which +// compute the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. Any content before the comment delimiter is +// discarded. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field +// names in a structured dtype. If `names` is None, the names of the +// dtype fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` +// is a file object. The special value 'bytes' enables backward +// compatibility workarounds that ensure that you receive byte arrays +// when possible and passes latin1 encoded strings to converters. +// Override this value to receive unicode arrays and pass strings +// as input to converters. If set to None the system default is used. +// The default value is 'bytes'. +// +// .. versionchanged:: 2.0 +// Before NumPy 2, the default was ``'bytes'`` for Python 2 +// compatibility. The default is now ``None``. +// +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When variables are named (either by a flexible dtype or with a `names` +// sequence), there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// * Custom converters may receive unexpected values due to dtype +// discovery. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO("1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, 'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO("11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, 'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is None. +// +// .. versionchanged:: 2.0 +// Before NumPy 2, the default was ``'bytes'`` for Python 2 +// compatibility. The default is now ``None``. +// +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> import numpy as np +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith("-") else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats, such as hex values: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Or a format where the ``-`` sign comes after the number: +// +// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") +// >>> conv = lambda x: -float(x[:-1]) if x.endswith("-") else float(x) +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +//go:linkname Log py.log +func Log(__llgo_va_list ...interface{}) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// >>> import numpy as np +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// >>> import numpy as np +// +// Create a 4 by 4 array +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(-np.inf) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> import numpy as np +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +//go:linkname Log2 py.log2 +func Log2(__llgo_va_list ...interface{}) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Examples +// -------- +// >>> import numpy as np +// +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by prepending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The row and column indices, respectively. The row indices are sorted +// in non-decreasing order, and the correspdonding column indices are +// strictly increasing for each row. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Examples +// -------- +// >>> import numpy as np +// +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il1 +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Note that row indices (first array) are non-decreasing, and the corresponding +// column indices (second array) are strictly increasing for each row. +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> il2 = np.tril_indices(4, 2) +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// +// Returns an array with axes transposed. +// +// For a 1-D array, this returns an unchanged view of the original array, as a +// transposed vector is simply the same vector. +// To convert a 1-D array into a 2-D column vector, an additional dimension +// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does +// ``a[:, np.newaxis]``. +// For a 2-D array, this is the standard matrix transpose. +// For an n-D array, if axes are given, their order indicates how the +// axes are permuted (see Examples). If axes are not provided, then +// ``transpose(a).shape == a.shape[::-1]``. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axes : tuple or list of ints, optional +// If specified, it must be a tuple or list which contains a permutation +// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative +// indices can also be used to specify axes. The i-th axis of the returned +// array will correspond to the axis numbered ``axes[i]`` of the input. +// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses +// the order of the axes. +// +// Returns +// ------- +// p : ndarray +// `a` with its axes permuted. A view is returned whenever possible. +// +// See Also +// -------- +// ndarray.transpose : Equivalent method. +// moveaxis : Move axes of an array to new positions. +// argsort : Return the indices that would sort an array. +// +// Notes +// ----- +// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors +// when using the `axes` keyword argument. +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) +// >>> np.transpose(a, (-1, 0, -2)).shape +// (5, 3, 4) +// +// +// +//go:linkname PermuteDims py.permute_dims +func PermuteDims(a *py.Object, axes *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// The copy made of the data is shallow, i.e., for arrays with object dtype, +// the new array will point to the same objects. +// See Examples from `ndarray.copy`. +// +// Examples +// -------- +// >>> import numpy as np +// +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> import numpy as np +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, +// a ``.npy`` extension will be appended to the filename if it does not +// already have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for +// disallowing pickles include security (loading pickled data can execute +// arbitrary code) and portability (pickled objects may not be loadable +// on different Python installations, for example if the stored objects +// require libraries that are not available, and not all pickled data is +// compatible between different versions of Python). +// Default: True +// fix_imports : bool, optional +// The `fix_imports` flag is deprecated and has no effect. +// +// .. deprecated:: 2.1 +// This flag is ignored since NumPy 1.17 and was only needed to +// support loading in Python 2 some files written in Python 3. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> import numpy as np +// +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(__llgo_va_list ...interface{}) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> import numpy as np +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> import numpy as np +// >>> A = np.asmatrix('1 1; 1 1') +// >>> B = np.asmatrix('2 2; 2 2') +// >>> C = np.asmatrix('3 4; 5 6') +// >>> D = np.asmatrix('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> import numpy as np +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object From bcc7e7963e76101199935c8811b05d61f49e4b1d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Fri, 22 Aug 2025 17:37:08 +0800 Subject: [PATCH 54/88] veri --- .github/workflows/verification.yml | 81 +++++++++++++++++------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index c4021ab1..edcc3ea5 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -34,20 +34,28 @@ jobs: with: repository: '1351914167/llgo' path: .llgo - ref: presentation + ref: get_pip - name: Check out LLPyg uses: actions/checkout@v4 with: repository: 'toaction/llpyg' path: .llpyg - ref: presentation + ref: feat/v1 - name: Set up Go uses: actions/setup-go@v4 with: go-version: 1.24.x - name: Set up Tool run: | - go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest + git clone https://github.com/PengPengPeng717/llpkgstore.git + cd llpkgstore + git checkout 8_21 + # 临时修改 go.mod 中的模块路径 + sed -i 's|module github.com/goplus/llpkgstore|module github.com/PengPengPeng717/llpkgstore|' go.mod + go install -v ./cmd/llpkgstore + # - name: Set up Tool + # run: | + # go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@8_21 - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | @@ -55,27 +63,27 @@ jobs: brew link --force libffi echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH echo "$(brew --prefix lld@${{matrix.llvm}})/bin" >> $GITHUB_PATH - - name: Install dependencies - if: startsWith(matrix.os, 'ubuntu') - run: | - sudo apt-get update - echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{matrix.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-get install -y llvm-${{matrix.llvm}}-dev \ - clang-${{matrix.llvm}} \ - libclang-${{matrix.llvm}}-dev \ - lld-${{matrix.llvm}} \ - libunwind-${{matrix.llvm}}-dev \ - libc++-${{matrix.llvm}}-dev \ - pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev - echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH - - name: Pre setup Python and Conan - if: startsWith(matrix.os, 'ubuntu') - run: | - sudo apt install -y python3 python3-pip - python3 -m pip install --upgrade pip - # python3 -m pip install conan pydump - # go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 + # - name: Install dependencies + # if: startsWith(matrix.os, 'ubuntu') + # run: | + # sudo apt-get update + # echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{matrix.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list + # wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + # sudo apt-get install -y llvm-${{matrix.llvm}}-dev \ + # clang-${{matrix.llvm}} \ + # libclang-${{matrix.llvm}}-dev \ + # lld-${{matrix.llvm}} \ + # libunwind-${{matrix.llvm}}-dev \ + # libc++-${{matrix.llvm}}-dev \ + # pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev + # echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH + # - name: Pre setup Python and Conan + # if: startsWith(matrix.os, 'ubuntu') + # run: | + # sudo apt install -y python3 python3-pip + # python3 -m pip install --upgrade pip + # # python3 -m pip install conan pydump + # # go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 - name: Pre setup Python and Conan if: startsWith(matrix.os, 'macos') run: | @@ -87,9 +95,12 @@ jobs: - name: Setup LLGo working-directory: .llgo run: | - ./install.sh - export LLGO_ROOT=$(pwd) + go install -v ./cmd/... + export LLGO_ROOT=$PWD echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + # ./install.sh + # export LLGO_ROOT=$(pwd) + # echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV # https://github.com/goplus/llgo/issues/1135 echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV - name: Set up Python environment @@ -147,15 +158,15 @@ jobs: # Test llpyg with numpy as per guide llpyg numpy echo "llpyg generation completed successfully" - # - name: Verification & Prebuilt - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} - # run: llpkgstore verification - # - name: Run demotest process - # env: - # LLPKG_PATH: ${{ env.LLPKG_PATH }} - # run: llpkgstore demotest + - name: Verification & Prebuilt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || 'numpy/llpkg.cfg numpy/llpyg.cfg' }} + run: llpkgstore verification + - name: Run demotest process + env: + LLPKG_PATH: ${{ env.LLPKG_PATH }} + run: llpkgstore demotest - name: Create Git tag run: | echo "Creating Git tag: numpy/v0.1.0" From d0ec5281ec56d3b8996c541ddab3a3cfa91369b8 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Fri, 22 Aug 2025 17:46:54 +0800 Subject: [PATCH 55/88] no_numpy --- numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpyg.cfg | 8 - numpy/numpy.go | 27552 ---------------------------------------------- 4 files changed, 27567 deletions(-) delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index 8ce9049a..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/PengPengPeng717/llpkg/numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 932c66b2..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "libVersion": "2.3.2", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index e0674759..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27552 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -//go:linkname Invert py.invert -func Invert(__llgo_va_list ...interface{}) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of ``arr``. This must match the -// dimension of ``arr``, but dimensions Ni and Nj only need to broadcast -// against ``arr``. -// axis : int or None, optional -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// .. versionchanged:: 2.3 -// The default value is now ``-1``. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// >>> import numpy as np -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> rng = np.random.default_rng() -// >>> A = rng.normal(size=(2,3,5)) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, NumPy scalar, or array -// Data type, NumPy scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 2.0 -// This function does not support Python scalars anymore and does not -// apply any value-based logic for 0-D arrays and NumPy scalars. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> import numpy as np -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -//go:linkname Equal py.equal -func Equal(__llgo_va_list ...interface{}) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.getbufsize() -// 8192 -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, -np.inf]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with np.errstate(invalid="ignore"): -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// np.float64(nan) -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez_compressed(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., -// ``savez_compressed(fn, x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for -// disallowing pickles include security (loading pickled data can execute -// arbitrary code) and portability (pickled objects may not be loadable -// on different Python installations, for example if the stored objects -// require libraries that are not available, and not all pickled data is -// compatible between different versions of Python). -// Default: True -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` -// object is returned. This is a dictionary-like object which can be queried -// for its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> import numpy as np -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(__llgo_va_list ...interface{}) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// -// Given a sequence of a polynomial's zeros: -// -// >>> import numpy as np -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(__llgo_va_list ...interface{}) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The row and column indices, respectively. The row indices are sorted -// in non-decreasing order, and the correspdonding column indices are -// strictly increasing for each row. -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Examples -// -------- -// >>> import numpy as np -// -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu1 -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Note that row indices (first array) are non-decreasing, and the corresponding -// column indices (second array) are strictly increasing for each row. -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> iu2 = np.triu_indices(4, 2) -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> import numpy as np -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> import numpy as np -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// np.float32(0.54999924) -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Computing the mean in timedelta64 is available: -// -// >>> b = np.array([1, 3], dtype="timedelta64[D]") -// >>> np.mean(b) -// np.timedelta64(2,'D') -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to zero or a positive integer. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=-1 (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=0 -// Only the memory bounds of a and b are checked. -// This is equivalent to using ``may_share_memory()``. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided( -// ... x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided( -// ... x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// .. deprecated:: 2.0 -// Use :func:`isin` instead of `in1d` for new code. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// Examples -// -------- -// >>> import numpy as np -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> import numpy as np -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import numpy as np -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Asin py.asin -func Asin(__llgo_va_list ...interface{}) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=int32) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> import numpy as np -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> import numpy as np -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Atan py.atan -func Atan(__llgo_va_list ...interface{}) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// -// .. versionchanged:: 2.0 -// The sign parameter can now be an integer type, previously -// types were floating-point types. -// -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string ``'1.21'`` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to ``'1.25'`` approximates printing of 1.25 which mainly means -// that numeric scalars are printed without their type information, e.g. -// as ``3.0`` rather than ``np.float64(3.0)``. -// -// If set to ``'2.1'``, shape information is not given when arrays are -// summarized (i.e., multiple elements replaced with ``...``). -// -// If set to ``'2.2'``, the transition to use scientific notation for -// printing ``np.float16`` and ``np.float32`` types may happen later or -// not at all for larger values. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionchanged:: 1.22.0 -// .. versionchanged:: 2.2 -// -// override_repr: callable, optional -// If set a passed function will be used for generating arrays' repr. -// Other options will be ignored. -// -// See Also -// -------- -// get_printoptions, printoptions, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> import numpy as np -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9], shape=(10,)) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` -// as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ], shape=(10,)) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Find the unique elements of an array, and counts, inverse, and indices. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, return_index=True, return_inverse=True, -// return_counts=True, equal_nan=False, sorted=False) -// -// but returns a namedtuple for easier access to each output. -// -// .. note:: -// This function currently always returns a sorted result, however, -// this could change in any NumPy minor release. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : namedtuple -// The result containing: -// -// * values - The unique elements of an input array. -// * indices - The first occurring indices for each unique element. -// * inverse_indices - The indices from the set of unique elements -// that reconstruct `x`. -// * counts - The corresponding counts for each unique element. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = [1, 1, 2] -// >>> uniq = np.unique_all(x) -// >>> uniq.values -// array([1, 2]) -// >>> uniq.indices -// array([0, 2]) -// >>> uniq.inverse_indices -// array([0, 0, 1]) -// >>> uniq.counts -// array([2, 1]) -// -// -//go:linkname UniqueAll py.unique_all -func UniqueAll(x *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> rng = np.random.default_rng() -// >>> A = rng.normal(size=(3,4,5)) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. https://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (deg + 1, deg + 1) or (deg + 1, deg + 1, K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.exceptions.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `~exceptions.RankWarning` when the least-squares fit is -// badly conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import numpy as np -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.exceptions.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : {int, float}, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. See notes for details about use of `ddof`. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// mean : array like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this var function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// There are several common variants of the array variance calculation. -// Assuming the input `a` is a one-dimensional NumPy array and ``mean`` is -// either provided as an argument or computed as ``a.mean()``, NumPy -// computes the variance of an array as:: -// -// N = len(a) -// d2 = abs(a - mean)**2 # abs is for complex `a` -// var = d2.sum() / (N - ddof) # note use of `ddof` -// -// Different values of the argument `ddof` are useful in different -// contexts. NumPy's default ``ddof=0`` corresponds with the expression: -// -// .. math:: -// -// \frac{\sum_i{|a_i - \bar{a}|^2 }}{N} -// -// which is sometimes called the "population variance" in the field of -// statistics because it applies the definition of variance to `a` as if `a` -// were a complete population of possible observations. -// -// Many other libraries define the variance of an array differently, e.g.: -// -// .. math:: -// -// \frac{\sum_i{|a_i - \bar{a}|^2}}{N - 1} -// -// In statistics, the resulting quantity is sometimes called the "sample -// variance" because if `a` is a random sample from a larger population, -// this calculation provides an unbiased estimate of the variance of the -// population. The use of :math:`N-1` in the denominator is often called -// "Bessel's correction" because it corrects for bias (toward lower values) -// in the variance estimate introduced when the sample mean of `a` is used -// in place of the true mean of the population. For this quantity, use -// ``ddof=1``. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// np.float32(0.20250003) -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// Using the mean keyword to save computation time: -// -// >>> import numpy as np -// >>> from timeit import timeit -// >>> -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> mean = np.mean(a, axis=1, keepdims=True) -// >>> -// >>> g = globals() -// >>> n = 10000 -// >>> t1 = timeit("var = np.var(a, axis=1, mean=mean)", globals=g, number=n) -// >>> t2 = timeit("var = np.var(a, axis=1)", globals=g, number=n) -// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') -// #doctest: +SKIP -// Percentage execution time saved 32% -// -// -// -//go:linkname Var py.var -func Var(__llgo_va_list ...interface{}) *py.Object -// -// Find the unique elements of `x` and indices to reconstruct `x`. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, return_inverse=True, equal_nan=False, sorted=False) -// -// but returns a namedtuple for easier access to each output. -// -// .. note:: -// This function currently always returns a sorted result, however, -// this could change in any NumPy minor release. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : namedtuple -// The result containing: -// -// * values - The unique elements of an input array. -// * inverse_indices - The indices from the set of unique elements -// that reconstruct `x`. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = [1, 1, 2] -// >>> uniq = np.unique_inverse(x) -// >>> uniq.values -// array([1, 2]) -// >>> uniq.inverse_indices -// array([0, 0, 1]) -// -// -//go:linkname UniqueInverse py.unique_inverse -func UniqueInverse(x *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// `axis=None`, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The array of weights must be the same shape as `a` if no axis is -// specified, otherwise the weights must have dimensions and shape -// consistent with `a` along the specified axis. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// The calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// where the sum is over all included elements. -// The only constraint on the values of `weights` is that `sum(weights)` -// must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a general pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When `weights` does not have the same shape as `a`, and `axis=None`. -// ValueError -// When `weights` does not have dimensions and shape consistent with `a` -// along specified `axis`. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> import numpy as np -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// >>> data = np.arange(8).reshape((2, 2, 2)) -// >>> data -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.average(data, axis=(0, 1), weights=[[1./4, 3./4], [1., 1./2]]) -// array([3.4, 4.4]) -// >>> np.average(data, axis=0, weights=[[1./4, 3./4], [1., 1./2]]) -// Traceback (most recent call last): -// ... -// ValueError: Shape of weights must be consistent -// with shape of a along specified axis. -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, -np.inf]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description:: -// -// np.choose(a,c) == np.array([c[a[I]][I] for I in np.ndindex(a.shape)]) -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> import numpy as np -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> import numpy as np -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(__llgo_va_list ...interface{}) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Absolute py.absolute -func Absolute(x *py.Object, out *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), -// ... axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Gives a new shape to an array without changing its data. -// -// Parameters -// ---------- -// a : array_like -// Array to be reshaped. -// shape : int or tuple of ints -// The new shape should be compatible with the original shape. If -// an integer, then the result will be a 1-D array of that length. -// One shape dimension can be -1. In this case, the value is -// inferred from the length of the array and remaining dimensions. -// order : {'C', 'F', 'A'}, optional -// Read the elements of ``a`` using this index order, and place the -// elements into the reshaped array using this index order. 'C' -// means to read / write the elements using C-like index order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to read / write the -// elements using Fortran-like index order, with the first index -// changing fastest, and the last index changing slowest. Note that -// the 'C' and 'F' options take no account of the memory layout of -// the underlying array, and only refer to the order of indexing. -// 'A' means to read / write the elements in Fortran-like index -// order if ``a`` is Fortran *contiguous* in memory, C-like order -// otherwise. -// newshape : int or tuple of ints -// .. deprecated:: 2.1 -// Replaced by ``shape`` argument. Retained for backward -// compatibility. -// copy : bool, optional -// If ``True``, then the array data is copied. If ``None``, a copy will -// only be made if it's required by ``order``. For ``False`` it raises -// a ``ValueError`` if a copy cannot be avoided. Default: ``None``. -// -// Returns -// ------- -// reshaped_array : ndarray -// This will be a new view object if possible; otherwise, it will -// be a copy. Note there is no guarantee of the *memory layout* (C- or -// Fortran- contiguous) of the returned array. -// -// See Also -// -------- -// ndarray.reshape : Equivalent method. -// -// Notes -// ----- -// It is not always possible to change the shape of an array without copying -// the data. -// -// The ``order`` keyword gives the index ordering both for *fetching* -// the values from ``a``, and then *placing* the values into the output -// array. For example, let's say you have an array: -// -// >>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, shape *py.Object, order *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(__llgo_va_list ...interface{}) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values have the same data-type as the input. -// -// Parameters -// ---------- -// x : array_like -// An array to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// An array with the same dimensions and data-type as the input. -// If second argument is not supplied then a new array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value ``out`` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in -// the designated form. If the `width` value is insufficient, an error is -// raised. -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// >>> import numpy as np -// -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using -// the normal rules. Instead, leading axes of size 1 are inserted, -// to make ``block.ndim`` the same for all blocks. This is primarily useful -// for working with scalars, and means that code like ``np.block([v, 1])`` -// is valid, where ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Notes -// ----- -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is *not* -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix: -// -// >>> import numpy as np -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack`: -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in place of `atleast_1d` and `atleast_2d`: -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the cube-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the -// cube root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - sign : str -// - formatter : dict of callables -// - floatmode : str -// - legacy : str or False -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> np.get_printoptions() -// {'edgeitems': 3, 'threshold': 1000, ..., 'override_repr': None} -// -// >>> np.get_printoptions()['linewidth'] -// 75 -// >>> np.set_printoptions(linewidth=100) -// >>> np.get_printoptions()['linewidth'] -// 100 -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, lexsort returns an array of integer indices -// that describes the sort order by multiple keys. The last key in the -// sequence is used for the primary sort order, ties are broken by the -// second-to-last key, and so on. -// -// Parameters -// ---------- -// keys : (k, m, n, ...) array-like -// The `k` keys to be sorted. The *last* key (e.g, the last -// row if `keys` is a 2D array) is the primary sort key. -// Each element of `keys` along the zeroth axis must be -// an array-like object of the same shape. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis -// of each sequence. Separate slices along `axis` sorted over -// independently; see last example. -// -// Returns -// ------- -// indices : (m, n, ...) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> import numpy as np -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort according to two numerical keys, first by elements -// of ``a``, then breaking ties according to elements of ``b``: -// -// >>> a = [1, 5, 1, 4, 3, 4, 4] # First sequence -// >>> b = [9, 4, 0, 4, 0, 2, 1] # Second sequence -// >>> ind = np.lexsort((b, a)) # Sort by `a`, then by `b` -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// >>> [(a[i], b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Compare against `argsort`, which would sort each key independently. -// -// >>> np.argsort((b, a), kind='stable') -// array([[2, 4, 6, 5, 1, 3, 0], -// [0, 2, 4, 3, 5, 6, 1]]) -// -// To sort lexicographically with `argsort`, we would need to provide a -// structured array. -// -// >>> x = np.array([(ai, bi) for ai, bi in zip(a, b)], -// ... dtype = np.dtype([('x', int), ('y', int)])) -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// The zeroth axis of `keys` always corresponds with the sequence of keys, -// so 2D arrays are treated just like other sequences of keys. -// -// >>> arr = np.asarray([b, a]) -// >>> ind2 = np.lexsort(arr) -// >>> np.testing.assert_equal(ind2, ind) -// -// Accordingly, the `axis` parameter refers to an axis of *each* key, not of -// the `keys` argument itself. For instance, the array ``arr`` is treated as -// a sequence of two 1-D keys, so specifying ``axis=0`` is equivalent to -// using the default axis, ``axis=-1``. -// -// >>> np.testing.assert_equal(np.lexsort(arr, axis=0), -// ... np.lexsort(arr, axis=-1)) -// -// For higher-dimensional arrays, the axis parameter begins to matter. The -// resulting array has the same shape as each key, and the values are what -// we would expect if `lexsort` were performed on corresponding slices -// of the keys independently. For instance, -// -// >>> x = [[1, 2, 3, 4], -// ... [4, 3, 2, 1], -// ... [2, 1, 4, 3]] -// >>> y = [[2, 2, 1, 1], -// ... [1, 2, 1, 2], -// ... [1, 1, 2, 1]] -// >>> np.lexsort((x, y), axis=1) -// array([[2, 3, 0, 1], -// [2, 0, 3, 1], -// [1, 0, 3, 2]]) -// -// Each row of the result is what we would expect if we were to perform -// `lexsort` on the corresponding row of the keys: -// -// >>> for i in range(3): -// ... print(np.lexsort((x[i], y[i]))) -// [2 3 0 1] -// [2 0 3 1] -// [1 0 3 2] -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(__llgo_va_list ...interface{}) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// Parameters -// ---------- -// arrays : sequence of ndarrays -// Each array must have the same shape. In the case of a single ndarray -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> rng = np.random.default_rng() -// >>> arrays = [rng.normal(size=(3,4)) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. In the case of a single -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// -// Copies an array to a specified data type. -// -// This function is an Array API compatible alternative to -// `numpy.ndarray.astype`. -// -// Parameters -// ---------- -// x : ndarray -// Input NumPy array to cast. ``array_likes`` are explicitly not -// supported here. -// dtype : dtype -// Data type of the result. -// copy : bool, optional -// Specifies whether to copy an array when the specified dtype matches -// the data type of the input array ``x``. If ``True``, a newly allocated -// array must always be returned. If ``False`` and the specified dtype -// matches the data type of the input array, the input array must be -// returned; otherwise, a newly allocated array must be returned. -// Defaults to ``True``. -// device : str, optional -// The device on which to place the returned array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.1.0 -// -// Returns -// ------- -// out : ndarray -// An array having the specified data type. -// -// See Also -// -------- -// ndarray.astype -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([1, 2, 3]); arr -// array([1, 2, 3]) -// >>> np.astype(arr, np.float64) -// array([1., 2., 3.]) -// -// Non-copy case: -// -// >>> arr = np.array([1, 2, 3]) -// >>> arr_noncpy = np.astype(arr, arr.dtype, copy=False) -// >>> np.shares_memory(arr, arr_noncpy) -// True -// -// -// -//go:linkname Astype py.astype -func Astype(x *py.Object, dtype *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return element-wise quotient and remainder simultaneously. -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None, *, -// device=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// Unlike other array creation functions (e.g. `zeros_like`, `ones_like`, -// `full_like`), `empty_like` does not initialize the values of the array, -// and may therefore be marginally faster. However, the values stored in the -// newly allocated array are arbitrary. For reproducible behavior, be sure -// to set each element of the array before reading. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// sorted : bool, optional -// If True, the unique elements are sorted. Elements may be sorted in -// practice even if ``sorted=False``, but this could change without -// notice. -// -// .. versionadded:: 2.3 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// sort : Return a sorted copy of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged:: 1.21 -// Like np.sort, NaN will sort to the end of the values. -// For complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// .. versionchanged:: 2.0 -// For multi-dimensional inputs, ``unique_inverse`` is reshaped -// such that the input can be reconstructed using -// ``np.take(unique, unique_inverse, axis=axis)``. The result is -// now not 1-dimensional when ``axis=None``. -// -// Note that in NumPy 2.0.0 a higher dimensional array was returned also -// when ``axis`` was not ``None``. This was reverted, but -// ``inverse.reshape(-1)`` can be used to ensure compatibility with both -// versions. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsinh` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Asinh py.asinh -func Asinh(__llgo_va_list ...interface{}) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> import numpy as np -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// *args : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : tuple of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// (array([[1, 2, 3], -// [1, 2, 3]]), -// array([[4, 4, 4], -// [5, 5, 5]])) -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), -// array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// with magnitudes much smaller than one (see Notes). -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : array_like -// The relative tolerance parameter (see Notes). -// atol : array_like -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True.:: -// -// absolute(a - b) <= (atol + rtol * absolute(b)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The default value of `atol` is not appropriate when the reference value -// `b` has magnitude smaller than one. For example, it is unlikely that -// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet -// ``allclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure -// to select `atol` for the use case at hand, especially for defining the -// threshold below which a non-zero value in `a` will be considered "close" -// to a very small or zero value in `b`. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Atanh py.atanh -func Atanh(__llgo_va_list ...interface{}) *py.Object -// empty(shape, dtype=float, order='C', *, device=None, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// Notes -// ----- -// Unlike other array creation functions (e.g. `zeros`, `ones`, `full`), -// `empty` does not initialize the values of the array, and may therefore be -// marginally faster. However, the values stored in the newly allocated array -// are arbitrary. For reproducible behavior, be sure to set each element of -// the array before reading. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '`. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(__llgo_va_list ...interface{}) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Examples -// -------- -// >>> import numpy as np -// -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> orig_settings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// >>> old_settings = np.seterr(**orig_settings) # restore original -// >>> old_handler = np.seterrcall(None) # restore original -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(-np.inf) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -//go:linkname Remainder py.remainder -func Remainder(__llgo_va_list ...interface{}) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns ``x / abs(x)``, the -// generalization of the above (and ``0 if x==0``). -// -// .. versionchanged:: 2.0.0 -// Definition of complex sign changed to follow the Array API standard. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here, :math:`x/|x|`, is the more common -// and useful one, but is different from the one used in numpy prior to -// version 2.0, :math:`x/\sqrt{x*x}`, which is equivalent to -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign([3-4j, 8j]) -// array([0.6-0.8j, 0. +1.j ]) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// linalg.cross : An Array API compatible variation of ``np.cross``, -// which accepts (arrays of) 3-element vectors only. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// Supports full broadcasting of the inputs. -// -// Dimension-2 input arrays were deprecated in 2.0.0. If you do need this -// functionality, you can use:: -// -// def cross2d(x, y): -// return x[..., 0] * y[..., 1] - x[..., 1] * y[..., 0] -// -// Examples -// -------- -// Vector cross-product. -// -// >>> import numpy as np -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// cumulative_prod : Array API compatible alternative for ``cumprod``. -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(__llgo_va_list ...interface{}) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> import numpy as np -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. In the case of a single -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einsum: -// Similar verbose interface is provided by the -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// The `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` -// :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` -// :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, -// :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, -// :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` -// produces a view of ``a`` with no changes. A further example -// ``np.einsum('ij,jk', a, b)`` describes traditional matrix multiplication -// and is equivalent to :py:func:`np.matmul(a,b) `. -// Repeated subscript labels in one operand take the diagonal. -// For example, ``np.einsum('ii', a)`` is equivalent to -// :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a) ` -// if ``a`` is a 1-D array, and ``np.einsum('ii->i', a)`` -// is like :py:func:`np.diag(a) ` if ``a`` is a square 2-D array. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// ``np.einsum('...i->...', a)`` is like -// :py:func:`np.sum(a, axis=-1) ` for array ``a`` of any shape. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts and -// operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands -// this can greatly increase the computational efficiency at the cost of -// a larger memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive -// search. For iterative calculations it may be advisable to calculate -// the optimal path once and reuse that path by supplying it as an argument. -// An example is given below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done -// with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing -// the 'optimal' path and repeatedly applying it, using an `einsum_path` -// insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, -// ... optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, -// ... optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(subscripts *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and -// the ``bins`` argument to `histogram`. Some key differences: -// -// +------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +====================================+===============+===================+ -// | PEP 3141 numeric objects | ``True`` | ``True`` | -// | (including builtins) | | | -// +------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other | ``False`` | ``False`` | -// | sequence objects | | | -// +------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> np.isscalar(3.1) -// True -// -// >>> np.isscalar(np.array(3.1)) -// False -// -// >>> np.isscalar([3.1]) -// False -// -// >>> np.isscalar(False) -// True -// -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// >>> import numpy as np -// -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : {int, float}, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// mean : array_like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this std function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> import numpy as np -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> import numpy as np -// -// >>> orig_handler = np.seterrcall(err_handler) -// >>> orig_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(orig_handler) -// -// >>> np.seterr(**orig_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(orig_handler) -// -// >>> np.seterr(**orig_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(func_ *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// copy : bool, optional -// If ``True``, then the object is copied. If ``None`` then the object is -// copied only if needed, i.e. if ``__array__`` returns a copy, if obj -// is a nested sequence, or if a copy is needed to satisfy any of -// the other requirements (``dtype``, ``order``, etc.). -// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. -// Default: ``None``. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of ``a``. No copy is performed if the input -// is already an ndarray with matching dtype and order. If ``a`` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> import numpy as np -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.shares_memory(np.asarray(a, dtype=np.float32), a) -// True -// >>> np.shares_memory(np.asarray(a, dtype=np.float64), a) -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. If this is a tuple of ints, the maximum is selected over -// multiple axes, instead of a single axis or all the axes as before. -// -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.nan -// >>> np.max(b) -// np.float64(nan) -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(__llgo_va_list ...interface{}) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero imaginary part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// >>> import numpy as np -// -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts [1]_: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline v` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// scipy.signal.correlate : uses FFT which has superior performance -// on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes -// correlation may be defined differently. Another common definition is [1]_: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) -// because it does not use the FFT to compute the convolution; in that case, -// `scipy.signal.correlate` might be preferable. -// -// References -// ---------- -// .. [1] Wikipedia, "Cross-correlation", -// https://en.wikipedia.org/wiki/Cross-correlation -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -//go:linkname Matmul py.matmul -func Matmul(__llgo_va_list ...interface{}) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.nan -// >>> np.min(b) -// np.float64(nan) -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> import numpy as np -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a :exc:`RuntimeWarning` (via the Python `warnings` -// module). -// - raise: Raise a :exc:`FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> import numpy as np -// >>> orig_settings = np.seterr(all='ignore') # seterr to known value -// >>> np.int16(32000) * np.int16(3) -// np.int16(30464) -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// np.int16(30464) -// >>> np.seterr(**orig_settings) # restore original -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// This function passes the imaginary and real parts of the argument to -// `arctan2` to compute the result; consequently, it follows the convention -// of `arctan2` when the magnitude of the argument is zero. See example. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// >>> np.angle([0., -0., complex(0., -0.), complex(-0., -0.)]) # convention -// array([ 0. , 3.14159265, -0. , -3.14159265]) -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the percentile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// See the notes for more details. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// The behavior of `numpy.percentile` with percentage `q` is -// that of `numpy.quantile` with argument ``q/100``. -// For more information, please see `numpy.quantile`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will -// use the method chosen to calculate the optimal bin width and -// consequently the number of bins (see the Notes section for more detail -// on the estimators) from the data that falls within the requested range. -// While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Minimum bin width between the 'sturges' and 'fd' estimators. -// Provides good all-around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (minimum bin width of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Additionally, if the data is of integer dtype, then the binwidth will never -// be less than 1. -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, range_ *py.Object, weights *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// .. versionchanged:: 2.0 -// The scope of setting the buffer is tied to the `numpy.errstate` -// context. Exiting a ``with errstate():`` will also restore the bufsize. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// Returns -// ------- -// bufsize : int -// Previous size of ufunc buffer in bytes. -// -// Examples -// -------- -// When exiting a `numpy.errstate` context manager the bufsize is restored: -// -// >>> import numpy as np -// >>> with np.errstate(): -// ... np.setbufsize(4096) -// ... print(np.getbufsize()) -// ... -// 8192 -// 4096 -// >>> np.getbufsize() -// 8192 -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// >>> import numpy as np -// -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> np.array_equal([1, 2], [1, 2]) -// True -// -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// -// >>> np.array_equal([1, 2], [1, 4]) -// False -// -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// np.float64(nan) -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsinh` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// -// busday_offset( -// dates, -// offsets, -// roll='raise', -// weekmask='1111100', -// holidays=None, -// busdaycal=None, -// out=None -// ) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> import numpy as np -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// np.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// np.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// np.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// np.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// np.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// np.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// np.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// np.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// vecdot : Vector dot product of two arrays. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> import numpy as np -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// np.uint8(255) -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Return a tuple of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be used with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// Returns -// ------- -// X1, X2,..., XN : tuple of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// :ref:`how-to-index` -// -// Examples -// -------- -// >>> import numpy as np -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// values ``a[i, ..., i]`` with indices ``i`` all identical. This function -// modifies the input array in-place without returning a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled in-place. -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size -// not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> import numpy as np -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> rng = np.random.default_rng() -// >>> A = rng.normal(size=(2,3,5)) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or tuple of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// (array([[1]]), array([[1, 2]]), array([[1, 2]])) -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> import numpy as np -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// `trapz` is deprecated in NumPy 2.0. -// -// Please use `trapezoid` instead, or one of the numerical integration -// functions in `scipy.integrate`. -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(__llgo_va_list ...interface{}) *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for -// disallowing pickles include security (loading pickled data can execute -// arbitrary code) and portability (pickled objects may not be loadable -// on different Python installations, for example if the stored objects -// require libraries that are not available, and not all pickled data is -// compatible between different versions of Python). -// Default: True -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile` -// object is returned. This is a dictionary-like object which can be queried -// for its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or tuple of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array and partially sorts it in such a way that -// the value of the element in k-th position is in the position it would be -// in a sorted array. In the output array, all elements smaller than the k-th -// element are located to the left of this element and all equal or greater -// are located to its right. The ordering of the elements in the two -// partitions on the either side of the k-th element in the output array is -// undefined. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// The sort order of ``np.nan`` is bigger than ``np.inf``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) # may vary -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// -// Find the unique elements and counts of an input array `x`. -// -// This function is an Array API compatible alternative to:: -// -// np.unique(x, return_counts=True, equal_nan=False, sorted=False) -// -// but returns a namedtuple for easier access to each output. -// -// .. note:: -// This function currently always returns a sorted result, however, -// this could change in any NumPy minor release. -// -// Parameters -// ---------- -// x : array_like -// Input array. It will be flattened if it is not already 1-D. -// -// Returns -// ------- -// out : namedtuple -// The result containing: -// -// * values - The unique elements of an input array. -// * counts - The corresponding counts for each unique element. -// -// See Also -// -------- -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = [1, 1, 2] -// >>> uniq = np.unique_counts(x) -// >>> uniq.values -// array([1, 2]) -// >>> uniq.counts -// array([2, 1]) -// -// -//go:linkname UniqueCounts py.unique_counts -func UniqueCounts(x *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// -// The defining property of the antiderivative: -// -// >>> import numpy as np -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> import numpy as np -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or tuple of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// (array([1]), array([3, 4])) -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Examples -// -------- -// >>> import numpy as np -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// The returned indices are not guaranteed to be sorted according to -// the values. Furthermore, the default selection algorithm ``introselect`` -// is unstable, and hence the returned indices are not guaranteed -// to be the earliest/latest occurrence of the element. -// -// `argpartition` works for real/complex inputs with nan values, -// see `partition` for notes on the enhanced sort order and -// different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> import numpy as np -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) # may vary -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) # may vary -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) # may vary -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> # below is the same as np.partition(x, kth=1) -// >>> np.take_along_axis(x, index_array, axis=-1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// .. versionadded:: 2.0.0 -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapezoid : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// >>> import numpy as np -// -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapezoid([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapezoid([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapezoid([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapezoid([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapezoid(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapezoid(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapezoid`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapezoid(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapezoid(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapezoid py.trapezoid -func Trapezoid(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> import numpy as np -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// -// is_busday( -// dates, -// weekmask='1111100', -// holidays=None, -// busdaycal=None, -// out=None -// ) -// -// Calculates which of the given dates are valid days, and which are not. -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> import numpy as np -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(__llgo_va_list ...interface{}) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// >>> import numpy as np -// -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> import numpy as np -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// vecdot : Vector dot product of two arrays. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Returns an array with axes transposed. -// -// For a 1-D array, this returns an unchanged view of the original array, as a -// transposed vector is simply the same vector. -// To convert a 1-D array into a 2-D column vector, an additional dimension -// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does -// ``a[:, np.newaxis]``. -// For a 2-D array, this is the standard matrix transpose. -// For an n-D array, if axes are given, their order indicates how the -// axes are permuted (see Examples). If axes are not provided, then -// ``transpose(a).shape == a.shape[::-1]``. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axes : tuple or list of ints, optional -// If specified, it must be a tuple or list which contains a permutation -// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative -// indices can also be used to specify axes. The i-th axis of the returned -// array will correspond to the axis numbered ``axes[i]`` of the input. -// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses -// the order of the axes. -// -// Returns -// ------- -// p : ndarray -// `a` with its axes permuted. A view is returned whenever possible. -// -// See Also -// -------- -// ndarray.transpose : Equivalent method. -// moveaxis : Move axes of an array to new positions. -// argsort : Return the indices that would sort an array. -// -// Notes -// ----- -// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors -// when using the `axes` keyword argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) -// >>> np.transpose(a, (-1, 0, -2)).shape -// (5, 3, 4) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` -// for more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// cumulative_sum : Array API compatible alternative for ``cumsum``. -// sum : Sum array elements. -// trapezoid : Integration of array values using composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(__llgo_va_list ...interface{}) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// >>> import numpy as np -// -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Pow py.pow -func Pow(__llgo_va_list ...interface{}) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.hanning(51) -// plt.plot(window) -// plt.title("Hann window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// with np.errstate(divide='ignore', invalid='ignore'): -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of the Hann window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Arccosh py.arccosh -func Arccosh(x *py.Object, out *py.Object) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// >>> import numpy as np -// -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647], dtype=int32) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 > x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// -// See Also -// -------- -// greater_equal, less, less_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.greater([4,2],[2,2]) -// array([ True, False]) -// -// The ``>`` operator can be used as a shorthand for ``np.greater`` on -// ndarrays. -// -// >>> a = np.array([4, 2]) -// >>> b = np.array([2, 2]) -// >>> a > b -// array([ True, False]) -// -//go:linkname Greater py.greater -func Greater(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, respectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// linalg.outer : An Array API compatible variation of ``np.outer``, -// which accepts 1-dimensional inputs only. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> import numpy as np -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.blackman(51) -// plt.plot(window) -// plt.title("Blackman window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() # doctest: +SKIP -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// with np.errstate(divide='ignore', invalid='ignore'): -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Blackman window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(__llgo_va_list ...interface{}) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// This function is an Array API compatible alternative to `numpy.cumprod`. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. The default -// (None) is only allowed for one-dimensional arrays. For arrays -// with more than one dimension ``axis`` is required. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If ``dtype`` is not specified, it -// defaults to the dtype of ``x``, unless ``x`` has an integer dtype -// with a precision less than that of the default platform integer. -// In that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// include_initial : bool, optional -// Boolean indicating whether to include the initial value (ones) as -// the first value in the output. With ``include_initial=True`` -// the shape of the output is different than the shape of the input. -// Default: ``False``. -// -// Returns -// ------- -// cumulative_prod_along_axis : ndarray -// A new array holding the result is returned unless ``out`` is -// specified, in which case a reference to ``out`` is returned. The -// result has the same shape as ``x`` if ``include_initial=False``. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> np.cumulative_prod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([1, 2, 3, 4, 5, 6]) -// >>> np.cumulative_prod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of ``b``: -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumulative_prod(b, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of ``b``: -// -// >>> np.cumulative_prod(b, axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname CumulativeProd py.cumulative_prod -func CumulativeProd(x *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// >>> a = np.array([1, 2], dtype=int) -// >>> c = np.append(a, []) -// >>> c -// array([1., 2.]) -// >>> c.dtype -// float64 -// -// Default dtype for empty ndarrays is `float64` thus making the output of dtype -// `float64` when appended with dtype `int64` -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// >>> import numpy as np -// -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or -// a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', -// end with a Z to indicate UTC time. If 'local', convert to the local -// timezone first, and suffix with a +-#### timezone offset. If a tzinfo -// object, then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -//go:linkname Log1p py.log1p -func Log1p(__llgo_va_list ...interface{}) *py.Object -//go:linkname Nextafter py.nextafter -func Nextafter(__llgo_va_list ...interface{}) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy may need to use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``setuptools``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using -// that is likely preferred for build systems other than ``setuptools``:: -// -// $ numpy-config --cflags -// -I/path/to/site-packages/numpy/_core/include -// -// # Or rely on pkg-config: -// $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir) -// $ pkg-config --cflags -// -I/path/to/site-packages/numpy/_core/include -// -// Examples -// -------- -// >>> np.get_include() -// '.../site-packages/numpy/core/include' # may vary -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname BitwiseRightShift py.bitwise_right_shift -func BitwiseRightShift(__llgo_va_list ...interface{}) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), -// array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), -// array([[12., 13., 14., 15.]]), -// array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), -// array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. If this -// is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// .. versionchanged:: 2.0 -// Before NumPy 2.0, ``any`` did not return booleans for object dtype -// input arrays. -// This behavior is still available via ``np.logical_or.reduce``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False, True ], -// ... [False, False, False]], axis=0) -// array([ True, False, True]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any([[np.nan], [np.inf]], axis=1, keepdims=True) -// array([[ True], -// [ True]]) -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> a = np.array([[1, 0, 0], -// ... [0, 0, 1], -// ... [0, 0, 0]]) -// >>> np.any(a, axis=0) -// array([ True, False, True]) -// >>> np.any(a, axis=1) -// array([ True, True, False]) -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// >>> import numpy as np -// -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. In the case of a single -// array_like input, it will be treated as a sequence of arrays; i.e., -// each element along the zeroth axis is treated as a separate array. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays -// horizontally (column-wise). -// unstack : Split an array into a tuple of sub-arrays along an axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int, array-like of ints or bools -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this -// many digits. If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// device : str, optional -// The device on which to place the created array. Default: None. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(a *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.hamming(51) -// plt.plot(window) -// plt.title("Hamming window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Hamming window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -//go:linkname Matvec py.matvec -func Matvec(__llgo_va_list ...interface{}) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> import numpy as np -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isneginf(-np.inf) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Inverse hyperbolic cosine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// arccosh : ndarray -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// -// cosh, arcsinh, sinh, arctanh, tanh -// -// Notes -// ----- -// `arccosh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `cosh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in ``[-pi, pi]`` and the real part in -// ``[0, inf]``. -// -// For real-valued input data types, `arccosh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccosh` is a complex analytical function that -// has a branch cut `[-inf, 1]` and is continuous from above on it. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arccosh -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arccosh([np.e, 10.0]) -// array([ 1.65745445, 2.99322285]) -// >>> np.arccosh(1) -// 0.0 -// -//go:linkname Acosh py.acosh -func Acosh(__llgo_va_list ...interface{}) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> import numpy as np -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='>> import numpy as np -// >>> np.unique_values([1, 1, 2]) -// array([1, 2]) # may vary -// -// -// -//go:linkname UniqueValues py.unique_values -func UniqueValues(x *py.Object) *py.Object -// bitwise_count(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Computes the number of 1-bits in the absolute value of ``x``. -// Analogous to the builtin `int.bit_count` or ``popcount`` in C++. -// -// Parameters -// ---------- -// x : array_like, unsigned int -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding number of 1-bits in the input. -// Returns uint8 for all integer types -// This is a scalar if `x` is a scalar. -// -// References -// ---------- -// .. [1] https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel -// -// .. [2] Wikipedia, "Hamming weight", -// https://en.wikipedia.org/wiki/Hamming_weight -// -// .. [3] http://aggregate.ee.engr.uky.edu/MAGIC/#Population%20Count%20(Ones%20Count) -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.bitwise_count(1023) -// np.uint8(10) -// >>> a = np.array([2**i - 1 for i in range(16)]) -// >>> np.bitwise_count(a) -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], -// dtype=uint8) -// -//go:linkname BitwiseCount py.bitwise_count -func BitwiseCount(x *py.Object, out *py.Object) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import numpy as np -// -// >>> import matplotlib.pyplot as plt -// >>> import numpy as np -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -//go:linkname Rint py.rint -func Rint(__llgo_va_list ...interface{}) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// ddof : {int, float}, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. See Notes for details about use of `ddof`. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// mean : array_like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this std function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// There are several common variants of the array standard deviation -// calculation. Assuming the input `a` is a one-dimensional NumPy array -// and ``mean`` is either provided as an argument or computed as -// ``a.mean()``, NumPy computes the standard deviation of an array as:: -// -// N = len(a) -// d2 = abs(a - mean)**2 # abs is for complex `a` -// var = d2.sum() / (N - ddof) # note use of `ddof` -// std = var**0.5 -// -// Different values of the argument `ddof` are useful in different -// contexts. NumPy's default ``ddof=0`` corresponds with the expression: -// -// .. math:: -// -// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N}} -// -// which is sometimes called the "population standard deviation" in the field -// of statistics because it applies the definition of standard deviation to -// `a` as if `a` were a complete population of possible observations. -// -// Many other libraries define the standard deviation of an array -// differently, e.g.: -// -// .. math:: -// -// \sqrt{\frac{\sum_i{|a_i - \bar{a}|^2 }}{N - 1}} -// -// In statistics, the resulting quantity is sometimes called the "sample -// standard deviation" because if `a` is a random sample from a larger -// population, this calculation provides the square root of an unbiased -// estimate of the variance of the population. The use of :math:`N-1` in the -// denominator is often called "Bessel's correction" because it corrects for -// bias (toward lower values) in the variance estimate introduced when the -// sample mean of `a` is used in place of the true mean of the population. -// The resulting estimate of the standard deviation is still biased, but less -// than it would have been without the correction. For this quantity, use -// ``ddof=1``. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the standard deviation is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// np.float32(0.45000005) -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// Using the mean keyword to save computation time: -// -// >>> import numpy as np -// >>> from timeit import timeit -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> mean = np.mean(a, axis=1, keepdims=True) -// >>> -// >>> g = globals() -// >>> n = 10000 -// >>> t1 = timeit("std = np.std(a, axis=1, mean=mean)", globals=g, number=n) -// >>> t2 = timeit("std = np.std(a, axis=1)", globals=g, number=n) -// >>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%') -// #doctest: +SKIP -// Percentage execution time saved 30% -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(file *py.Object, regexp *py.Object, dtype *py.Object, encoding *py.Object) *py.Object -// -// busday_count( -// begindates, -// enddates, -// weekmask='1111100', -// holidays=[], -// busdaycal=None, -// out=None -// ) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> import numpy as np -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// concatenate( -// (a1, a2, ...), -// axis=0, -// out=None, -// dtype=None, -// casting="same_kind" -// ) -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// For a description of the options, please see :term:`casting`. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concat py.concat -func Concat(__llgo_va_list ...interface{}) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) # doctest: +SKIP -// array([nan, 1., 1.]) -// RuntimeWarning: invalid value encountered in divide -// -// >>> oldsettings = np.seterr(all='warn', invalid='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'warn', 'invalid': 'raise'} -// >>> np.arange(3.) / np.arange(3.) -// Traceback (most recent call last): -// ... -// FloatingPointError: invalid value encountered in divide -// >>> oldsettings = np.seterr(**oldsettings) # restore original -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -//go:linkname Logaddexp py.logaddexp -func Logaddexp(__llgo_va_list ...interface{}) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, -// in general, the actual implementation will vary with data type. -// The 'mergesort' option is retained for backwards compatibility. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// stable : bool, optional -// Sort stability. If ``True``, the returned array will maintain -// the relative order of ``a`` values which compare as equal. -// If ``False`` or ``None``, this is not guaranteed. Internally, -// this option selects ``kind='stable'``. Default: ``None``. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// For performance, ``sort`` makes a temporary copy if needed to make the data -// `contiguous `_ -// in memory along the sort axis. For even better performance and reduced -// memory consumption, ensure that the array is already contiguous along the -// sort axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// quicksort has been changed to: -// `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt -// `_ -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. -// Radix sort is an O(n) sort instead of O(n log n). -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '`. -// -// Returns -// ------- -// angle : ndarray -// The angle of the ray intersecting the unit circle at the given -// `x`-coordinate in radians [0, pi]. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// cos, arctan, arcsin, emath.arccos -// -// Notes -// ----- -// `arccos` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``cos(z) = x``. The convention is to return -// the angle `z` whose real part lies in `[0, pi]`. -// -// For real-valued input data types, `arccos` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytic function that -// has branch cuts ``[-inf, -1]`` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse `cos` is also known as `acos` or cos^-1. -// -// References -// ---------- -// M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> import numpy as np -// -// We expect the arccos of 1 to be 0, and of -1 to be pi: -// -// >>> np.arccos([1, -1]) -// array([ 0. , 3.14159265]) -// -// Plot arccos: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-1, 1, num=100) -// >>> plt.plot(x, np.arccos(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Acos py.acos -func Acos(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> import numpy as np -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// vecdot(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) -// -// Vector dot product of two arrays. -// -// Let :math:`\mathbf{a}` be a vector in `x1` and :math:`\mathbf{b}` be -// a corresponding vector in `x2`. The dot product is defined as: -// -// .. math:: -// \mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} \overline{a_i}b_i -// -// where the sum is over the last dimension (unless `axis` is specified) and -// where :math:`\overline{a_i}` denotes the complex conjugate if :math:`a_i` -// is complex and the identity otherwise. -// -// .. versionadded:: 2.0.0 -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// the broadcasted shape of `x1` and `x2` with the last axis removed. -// If not provided or None, a freshly-allocated array is used. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The vector dot product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : same but flattens arguments first -// matmul : Matrix-matrix product. -// vecmat : Vector-matrix product. -// matvec : Matrix-vector product. -// einsum : Einstein summation convention. -// -// Examples -// -------- -// >>> import numpy as np -// -// Get the projected size along a given normal for an array of vectors. -// -// >>> v = np.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]]) -// >>> n = np.array([0., 0.6, 0.8]) -// >>> np.vecdot(v, n) -// array([ 3., 8., 10.]) -// -//go:linkname Vecdot py.vecdot -func Vecdot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// from_dlpack(x, /, *, device=None, copy=None) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a view of the input -// object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// device : device, optional -// Device on which to place the created array. Default: ``None``. -// Must be ``"cpu"`` if passed which may allow importing an array -// that is not already CPU available. -// copy : bool, optional -// Boolean indicating whether or not to copy the input. If ``True``, -// the copy will be made. If ``False``, the function will never copy, -// and will raise ``BufferError`` in case a copy is deemed necessary. -// Passing it requests a copy from the exporter who may or may not -// implement the capability. -// If ``None``, the function will reuse the existing memory buffer if -// possible and copy otherwise. Default: ``None``. -// -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch # doctest: +SKIP -// >>> x = torch.arange(10) # doctest: +SKIP -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) # doctest: +SKIP -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 < x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2, 5, 4]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.bytes_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// Please note that the ``dtype`` of `weights` will also become the -// ``dtype`` of the returned accumulator (`hist`), so it must be -// large enough to hold accumulated values as well. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. If `weights` are given, -// ``hist.dtype`` will be taken from `weights`. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// import numpy as np -// -// rng = np.random.RandomState(10) # deterministic random data -// a = np.hstack((rng.normal(size=1000), -// rng.normal(loc=5, scale=2, size=1000))) -// plt.hist(a, bins='auto') # arguments are passed to np.histogram -// plt.title("Histogram with 'auto' bins") -// plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename, file handle or pathlib.Path -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, ``fmt='%.4e'``, resulting in numbers formatted -// like ``' (%s+%sj)' % (fmt, fmt)`` -// * a full string specifying every real and imaginary part, e.g. -// ``' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'`` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. ``['%.3e + %.3ej', '(%.15e%+.15ej)']`` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// header : str, optional -// String that will be written at the beginning of the file. -// footer : str, optional -// String that will be written at the end of the file. -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(__llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Numerical positive, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// -// Split an array into a sequence of arrays along the given axis. -// -// The ``axis`` parameter specifies the dimension along which the array will -// be split. For example, if ``axis=0`` (the default) it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// The result is a tuple of arrays split along ``axis``. -// -// .. versionadded:: 2.1.0 -// -// Parameters -// ---------- -// x : ndarray -// The array to be unstacked. -// axis : int, optional -// Axis along which the array will be split. Default: ``0``. -// -// Returns -// ------- -// unstacked : tuple of ndarrays -// The unstacked arrays. -// -// See Also -// -------- -// stack : Join a sequence of arrays along a new axis. -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Notes -// ----- -// ``unstack`` serves as the reverse operation of :py:func:`stack`, i.e., -// ``stack(unstack(x, axis=axis), axis=axis) == x``. -// -// This function is equivalent to ``tuple(np.moveaxis(x, axis, 0))``, since -// iterating on an array iterates along the first axis. -// -// Examples -// -------- -// >>> arr = np.arange(24).reshape((2, 3, 4)) -// >>> np.unstack(arr) -// (array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]), -// array([[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]])) -// >>> np.unstack(arr, axis=1) -// (array([[ 0, 1, 2, 3], -// [12, 13, 14, 15]]), -// array([[ 4, 5, 6, 7], -// [16, 17, 18, 19]]), -// array([[ 8, 9, 10, 11], -// [20, 21, 22, 23]])) -// >>> arr2 = np.stack(np.unstack(arr, axis=1), axis=1) -// >>> arr2.shape -// (2, 3, 4) -// >>> np.all(arr == arr2) -// np.True_ -// -// -// -//go:linkname Unstack py.unstack -func Unstack(x *py.Object) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// -// .. versionchanged:: 2.0 -// The sign parameter can now be an integer type, previously -// types were floating-point types. -// -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string ``'1.13'`` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// This function is an Array API compatible alternative to `numpy.cumsum`. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is only allowed for one-dimensional arrays. For arrays -// with more than one dimension ``axis`` is required. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If ``dtype`` is not specified, it defaults -// to the dtype of ``x``, unless ``x`` has an integer dtype with -// a precision less than that of the default platform integer. -// In that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` -// for more details. -// include_initial : bool, optional -// Boolean indicating whether to include the initial value (zeros) as -// the first value in the output. With ``include_initial=True`` -// the shape of the output is different than the shape of the input. -// Default: ``False``. -// -// Returns -// ------- -// cumulative_sum_along_axis : ndarray -// A new array holding the result is returned unless ``out`` is -// specified, in which case a reference to ``out`` is returned. The -// result has the same shape as ``x`` if ``include_initial=False``. -// -// See Also -// -------- -// sum : Sum array elements. -// trapezoid : Integration of array values using composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumulative_sum(a)[-1]`` may not be equal to ``sum(a)`` for -// floating-point values since ``sum`` may use a pairwise summation routine, -// reducing the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 4, 5, 6]) -// >>> a -// array([1, 2, 3, 4, 5, 6]) -// >>> np.cumulative_sum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumulative_sum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumulative_sum(b,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumulative_sum(b,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumulative_sum(c)[-1]`` may not be equal to ``sum(c)`` -// -// >>> c = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> np.cumulative_sum(c)[-1] -// 1000000.0050045159 -// >>> c.sum() -// 1000000.0050000029 -// -// -// -//go:linkname CumulativeSum py.cumulative_sum -func CumulativeSum(x *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(func_ *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype -// -// Examples -// -------- -// >>> import numpy as np -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python -// `bisect.bisect_left` (``side='left'``) and `bisect.bisect_right` -// (``side='right'``) functions, which is also vectorized -// in the `v` argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.searchsorted([11,12,13,14,15], 13) -// 2 -// >>> np.searchsorted([11,12,13,14,15], 13, side='right') -// 3 -// >>> np.searchsorted([11,12,13,14,15], [-10, 20, 12, 13]) -// array([0, 5, 1, 2]) -// -// When `sorter` is used, the returned indices refer to the sorted -// array of `a` and not `a` itself: -// -// >>> a = np.array([40, 10, 20, 30]) -// >>> sorter = np.argsort(a) -// >>> sorter -// array([1, 2, 3, 0]) # Indices that would sort the array 'a' -// >>> result = np.searchsorted(a, 25, sorter=sorter) -// >>> result -// 2 -// >>> a[sorter[result]] -// 30 # The element at index 2 of the sorted array is 30. -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Add arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be added. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// add : ndarray or scalar -// The sum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` + `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.add(1.0, 4.0) -// 5.0 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.add(x1, x2) -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -// The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 + x2 -// array([[ 0., 2., 4.], -// [ 3., 5., 7.], -// [ 6., 8., 10.]]) -// -//go:linkname Add py.add -func Add(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// stable : bool, optional -// Sort stability. If ``True``, the returned array will maintain -// the relative order of ``a`` values which compare as equal. -// If ``False`` or ``None``, this is not guaranteed. Internally, -// this option selects ``kind='stable'``. Default: ``None``. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> import numpy as np -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, device=None, copy=None, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.1.0 -// -// copy : bool, optional -// If ``True``, then the object is copied. If ``None`` then the object is -// copied only if needed, i.e. if ``__array__`` returns a copy, if obj -// is a nested sequence, or if a copy is needed to satisfy any of -// the other requirements (``dtype``, ``order``, etc.). -// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. -// Default: ``None``. -// -// .. versionadded:: 2.1.0 -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> import numpy as np -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1., 2), (3., 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// -// Consider four points in different quadrants: -// -// >>> import numpy as np -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Atan2 py.atan2 -func Atan2(__llgo_va_list ...interface{}) *py.Object -// greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the truth value of (x1 >= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : bool or ndarray of bool -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, less_equal, equal, not_equal -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.greater_equal([4, 2, 1], [2, 2, 2]) -// array([ True, True, False]) -// -// The ``>=`` operator can be used as a shorthand for ``np.greater_equal`` -// on ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a >= b -// array([ True, True, False]) -// -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Determine if a provided dtype is of a specified data type ``kind``. -// -// This function only supports built-in NumPy's data types. -// Third-party dtypes are not yet supported. -// -// Parameters -// ---------- -// dtype : dtype -// The input dtype. -// kind : dtype or str or tuple of dtypes/strs. -// dtype or dtype kind. Allowed dtype kinds are: -// * ``'bool'`` : boolean kind -// * ``'signed integer'`` : signed integer data types -// * ``'unsigned integer'`` : unsigned integer data types -// * ``'integral'`` : integer data types -// * ``'real floating'`` : real-valued floating-point data types -// * ``'complex floating'`` : complex floating-point data types -// * ``'numeric'`` : numeric data types -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// issubdtype -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isdtype(np.float32, np.float64) -// False -// >>> np.isdtype(np.float32, "real floating") -// True -// >>> np.isdtype(np.complex128, ("real floating", "complex floating")) -// True -// -// -// -//go:linkname Isdtype py.isdtype -func Isdtype(dtype *py.Object, kind *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// >>> import numpy as np -// -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(-np.inf) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// -// Consider four points in different quadrants: -// -// >>> import numpy as np -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If ``True`` (default), then the array data is copied. If ``None``, -// a copy will only be made if ``__array__`` returns a copy, if obj is -// a nested sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). Note that any copy of -// the data is shallow, i.e., for arrays with object dtype, the new -// array will point to the same objects. See Examples for `ndarray.copy`. -// For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. -// Default: ``True``. -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=None`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// copy: Return an array copy of the given object. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3], dtype=int32) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.asmatrix('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.asmatrix('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// with magnitudes much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : array_like -// The relative tolerance parameter (see Notes). -// atol : array_like -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent.:: -// -// absolute(a - b) <= (atol + rtol * absolute(b)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. -// -// The default value of `atol` is not appropriate when the reference value -// `b` has magnitude smaller than one. For example, it is unlikely that -// ``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet -// ``isclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure -// to select `atol` for the use case at hand, especially for defining the -// threshold below which a non-zero value in `a` will be considered "close" -// to a very small or zero value in `b`. -// -// `isclose` is not defined for non-numeric data types. -// :class:`bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, device=None, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// device : str, optional -// The device on which to place the created array. Default: ``None``. -// For Array-API interoperability only, so must be ``"cpu"`` if passed. -// -// .. versionadded:: 2.0.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function [1]_ is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// References -// ---------- -// .. [1] Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -//go:linkname Log10 py.log10 -func Log10(__llgo_va_list ...interface{}) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(__llgo_va_list ...interface{}) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete. If you only want to check if an array is Fortran -// contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> import numpy as np -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. If this -// is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` -// for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// .. versionchanged:: 2.0 -// Before NumPy 2.0, ``all`` did not return booleans for object dtype -// input arrays. -// This behavior is still available via ``np.logical_and.reduce``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Compute tensor dot product along specified axes. -// -// Given two tensors, `a` and `b`, and an array_like object containing -// two array_like objects, ``(a_axes, b_axes)``, sum the products of -// `a`'s and `b`'s elements (components) over the axes specified by -// ``a_axes`` and ``b_axes``. The third argument can be a single non-negative -// integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions -// of `a` and the first ``N`` dimensions of `b` are summed over. -// -// Parameters -// ---------- -// a, b : array_like -// Tensors to "dot". -// -// axes : int or (2,) array_like -// * integer_like -// If an int N, sum over the last N axes of `a` and the first N axes -// of `b` in order. The sizes of the corresponding axes must match. -// * (2,) array_like -// Or, a list of axes to be summed over, first sequence applying to `a`, -// second to `b`. Both elements array_like must be of the same length. -// -// Returns -// ------- -// output : ndarray -// The tensor dot product of the input. -// -// See Also -// -------- -// dot, einsum -// -// Notes -// ----- -// Three common use cases are: -// * ``axes = 0`` : tensor product :math:`a\otimes b` -// * ``axes = 1`` : tensor dot product :math:`a\cdot b` -// * ``axes = 2`` : (default) tensor double contraction :math:`a:b` -// -// When `axes` is integer_like, the sequence of axes for evaluation -// will be: from the -Nth axis to the -1th axis in `a`, -// and from the 0th axis to (N-1)th axis in `b`. -// For example, ``axes = 2`` is the equal to -// ``axes = [[-2, -1], [0, 1]]``. -// When N-1 is smaller than 0, or when -N is larger than -1, -// the element of `a` and `b` are defined as the `axes`. -// -// When there is more than one axis to sum over - and they are not the last -// (first) axes of `a` (`b`) - the argument `axes` should consist of -// two sequences of the same length, with the first axis to sum over given -// first in both sequences, the second axis second, and so forth. -// The calculation can be referred to ``numpy.einsum``. -// -// The shape of the result consists of the non-contracted axes of the -// first tensor, followed by the non-contracted axes of the second. -// -// Examples -// -------- -// An example on integer_like: -// -// >>> a_0 = np.array([[1, 2], [3, 4]]) -// >>> b_0 = np.array([[5, 6], [7, 8]]) -// >>> c_0 = np.tensordot(a_0, b_0, axes=0) -// >>> c_0.shape -// (2, 2, 2, 2) -// >>> c_0 -// array([[[[ 5, 6], -// [ 7, 8]], -// [[10, 12], -// [14, 16]]], -// [[[15, 18], -// [21, 24]], -// [[20, 24], -// [28, 32]]]]) -// -// An example on array_like: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// A slower but equivalent way of computing the same... -// -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// vecmat(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis]) -// -// Vector-matrix dot product of two arrays. -// -// Given a vector (or stack of vector) :math:`\mathbf{v}` in ``x1`` and -// a matrix (or stack of matrices) :math:`\mathbf{A}` in ``x2``, the -// vector-matrix product is defined as: -// -// .. math:: -// \mathbf{b} \cdot \mathbf{A} = \sum_{i=0}^{n-1} \overline{v_i}A_{ij} -// -// where the sum is over the last dimension of ``x1`` and the one-but-last -// dimensions in ``x2`` (unless `axes` is specified) and where -// :math:`\overline{v_i}` denotes the complex conjugate if :math:`v` -// is complex and the identity otherwise. (For a non-conjugated vector-matrix -// product, use ``np.matvec(x2.mT, x1)``.) -// -// .. versionadded:: 2.2.0 -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// the broadcasted shape of ``x1`` and ``x2`` with the summation axis -// removed. If not provided or None, a freshly-allocated array is used. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The vector-matrix product of the inputs. -// -// Raises -// ------ -// ValueError -// If the last dimensions of ``x1`` and the one-but-last dimension of -// ``x2`` are not the same size. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vecdot : Vector-vector product. -// matvec : Matrix-vector product. -// matmul : Matrix-matrix product. -// einsum : Einstein summation convention. -// -// Examples -// -------- -// Project a vector along X and Y. -// -// >>> v = np.array([0., 4., 2.]) -// >>> a = np.array([[1., 0., 0.], -// ... [0., 1., 0.], -// ... [0., 0., 0.]]) -// >>> np.vecmat(v, a) -// array([ 0., 4., 0.]) -// -//go:linkname Vecmat py.vecmat -func Vecmat(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `element` and `test_elements`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `element` plus the max-min value of `test_elements`. -// `assume_unique` has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `element` and `test_elements`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// Notes -// ----- -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(test_elements)) > -// (log10(max(test_elements)-min(test_elements)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// Examples -// -------- -// >>> import numpy as np -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. If both ``a_min`` and ``a_max`` are ``None``, -// the elements of the returned array stay the same. Both are broadcasted -// against ``a``. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// min, max : array_like or None -// Array API compatible alternatives for ``a_min`` and ``a_max`` -// arguments. Either ``a_min`` and ``a_max`` or ``min`` and ``max`` -// can be passed at the same time. Default: ``None``. -// -// .. versionadded:: 2.1.0 -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib). -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.bartlett(51) -// plt.plot(window) -// plt.title("Bartlett window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// with np.errstate(divide='ignore', invalid='ignore'): -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Bartlett window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes -// specified in the axis parameter. -// Default: 1. (see Examples below). -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// Returns -// ------- -// gradient : ndarray or tuple of ndarray -// A tuple of ndarrays (or a single ndarray if there is only one -// dimension) corresponding to the derivatives of f with respect -// to each dimension. Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> import numpy as np -// >>> f = np.array([1, 2, 4, 7, 11, 16]) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.]) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]])) -// (array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), -// array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])) -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), dx, y) -// (array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), -// array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])) -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]]), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// The `varargs` argument defines the spacing between sample points in the -// input array. It can take two forms: -// -// 1. An array, specifying coordinates, which may be unevenly spaced: -// -// >>> x = np.array([0., 2., 3., 6., 8.]) -// >>> y = x ** 2 -// >>> np.gradient(y, x, edge_order=2) -// array([ 0., 4., 6., 12., 16.]) -// -// 2. A scalar, representing the fixed sample distance: -// -// >>> dx = 2 -// >>> x = np.array([0., 2., 4., 6., 8.]) -// >>> y = x ** 2 -// >>> np.gradient(y, dx, edge_order=2) -// array([ 0., 4., 8., 12., 16.]) -// -// It's possible to provide different data for spacing along each dimension. -// The number of arguments must match the number of dimensions in the input -// data. -// -// >>> dx = 2 -// >>> dy = 3 -// >>> x = np.arange(0, 6, dx) -// >>> y = np.arange(0, 9, dy) -// >>> xs, ys = np.meshgrid(x, y) -// >>> zs = xs + 2 * ys -// >>> np.gradient(zs, dy, dx) # Passing two scalars -// (array([[2., 2., 2.], -// [2., 2., 2.], -// [2., 2., 2.]]), -// array([[1., 1., 1.], -// [1., 1., 1.], -// [1., 1., 1.]])) -// -// Mixing scalars and arrays is also allowed: -// -// >>> np.gradient(zs, y, dx) # Passing one array and one scalar -// (array([[2., 2., 2.], -// [2., 2., 2.], -// [2., 2., 2.]]), -// array([[1., 1., 1.], -// [1., 1., 1.], -// [1., 1., 1.]])) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default, -// axis=None, will compute the median along a flattened version of -// the array. If a sequence of axes, the array is first flattened -// along the given axes, then the median is computed along the -// resulting flattened axis. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// np.float64(3.5) -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> np.median(a, axis=(0, 1)) -// np.float64(3.5) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// np.float64(3.5) -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> import numpy as np -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities of the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// The recommended options, numbered as they appear in [1]_, are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. For backward compatibility -// with previous versions of NumPy, the following discontinuous variations -// of the default 'linear' (7.) option are available: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// See Notes for details. -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the quantile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// See the notes for more details. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis -// of the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a sample `a` from an underlying distribution, `quantile` provides a -// nonparametric estimate of the inverse cumulative distribution function. -// -// By default, this is done by interpolating between adjacent elements in -// ``y``, a sorted copy of `a`:: -// -// (1-g)*y[j] + g*y[j+1] -// -// where the index ``j`` and coefficient ``g`` are the integral and -// fractional components of ``q * (n-1)``, and ``n`` is the number of -// elements in the sample. -// -// This is a special case of Equation 1 of H&F [1]_. More generally, -// -// - ``j = (q*n + m - 1) // 1``, and -// - ``g = (q*n + m - 1) % 1``, -// -// where ``m`` may be defined according to several different conventions. -// The preferred convention may be selected using the ``method`` parameter: -// -// =============================== =============== =============== -// ``method`` number in H&F ``m`` -// =============================== =============== =============== -// ``interpolated_inverted_cdf`` 4 ``0`` -// ``hazen`` 5 ``1/2`` -// ``weibull`` 6 ``q`` -// ``linear`` (default) 7 ``1 - q`` -// ``median_unbiased`` 8 ``q/3 + 1/3`` -// ``normal_unbiased`` 9 ``q/4 + 3/8`` -// =============================== =============== =============== -// -// Note that indices ``j`` and ``j + 1`` are clipped to the range ``0`` to -// ``n - 1`` when the results of the formula would be outside the allowed -// range of non-negative indices. The ``- 1`` in the formulas for ``j`` and -// ``g`` accounts for Python's 0-based indexing. -// -// The table above includes only the estimators from H&F that are continuous -// functions of probability `q` (estimators 4-9). NumPy also provides the -// three discontinuous estimators from H&F (estimators 1-3), where ``j`` is -// defined as above, ``m`` is defined as follows, and ``g`` is a function -// of the real-valued ``index = q*n + m - 1`` and ``j``. -// -// 1. ``inverted_cdf``: ``m = 0`` and ``g = int(index - j > 0)`` -// 2. ``averaged_inverted_cdf``: ``m = 0`` and -// ``g = (1 + int(index - j > 0)) / 2`` -// 3. ``closest_observation``: ``m = -1/2`` and -// ``g = 1 - int((index == j) & (j%2 == 1))`` -// -// For backward compatibility with previous versions of NumPy, `quantile` -// provides four additional discontinuous estimators. Like -// ``method='linear'``, all have ``m = 1 - q`` so that ``j = q*(n-1) // 1``, -// but ``g`` is defined as follows. -// -// - ``lower``: ``g = 0`` -// - ``midpoint``: ``g = 0.5`` -// - ``higher``: ``g = 1`` -// - ``nearest``: ``g = (q*(n-1) % 1) > 0.5`` -// -// **Weighted quantiles:** -// More formally, the quantile at probability level :math:`q` of a cumulative -// distribution function :math:`F(y)=P(Y \leq y)` with probability measure -// :math:`P` is defined as any number :math:`x` that fulfills the -// *coverage conditions* -// -// .. math:: P(Y < x) \leq q \quad\text{and}\quad P(Y \leq x) \geq q -// -// with random variable :math:`Y\sim P`. -// Sample quantiles, the result of `quantile`, provide nonparametric -// estimation of the underlying population counterparts, represented by the -// unknown :math:`F`, given a data vector `a` of length ``n``. -// -// Some of the estimators above arise when one considers :math:`F` as the -// empirical distribution function of the data, i.e. -// :math:`F(y) = \frac{1}{n} \sum_i 1_{a_i \leq y}`. -// Then, different methods correspond to different choices of :math:`x` that -// fulfill the above coverage conditions. Methods that follow this approach -// are ``inverted_cdf`` and ``averaged_inverted_cdf``. -// -// For weighted quantiles, the coverage conditions still hold. The -// empirical cumulative distribution is simply replaced by its weighted -// version, i.e. -// :math:`P(Y \leq t) = \frac{1}{\sum_i w_i} \sum_i w_i 1_{x_i \leq t}`. -// Only ``method="inverted_cdf"`` supports weights. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as ``a.shape`` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as ``a.shape``. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), -// ... axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> import numpy as np -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import numpy as np -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response. -// -// .. plot:: -// :include-source: -// -// import matplotlib.pyplot as plt -// from numpy.fft import fft, fftshift -// window = np.kaiser(51, 14) -// plt.plot(window) -// plt.title("Kaiser window") -// plt.ylabel("Amplitude") -// plt.xlabel("Sample") -// plt.show() -// -// plt.figure() -// A = fft(window, 2048) / 25.5 -// mag = np.abs(fftshift(A)) -// freq = np.linspace(-0.5, 0.5, len(A)) -// response = 20 * np.log10(mag) -// response = np.clip(response, -100, 100) -// plt.plot(freq, response) -// plt.title("Frequency response of Kaiser window") -// plt.ylabel("Magnitude [dB]") -// plt.xlabel("Normalized frequency [cycles per sample]") -// plt.axis('tight') -// plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// Remove values along a dimension which are zero along all other. -// -// Parameters -// ---------- -// filt : array_like -// Input array. -// trim : {"fb", "f", "b"}, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. By default, zeros are trimmed on both sides. -// Front and back refer to the edges of a dimension, with "front" referring -// to the side with the lowest index 0, and "back" referring to the highest -// index (or index -1). -// axis : int or sequence, optional -// If None, `filt` is cropped such that the smallest bounding box is -// returned that still contains all values which are not zero. -// If an axis is specified, `filt` will be sliced in that dimension only -// on the sides specified by `trim`. The remaining area will be the -// smallest that still contains all values wich are not zero. -// -// .. versionadded:: 2.2.0 -// -// Returns -// ------- -// trimmed : ndarray or sequence -// The result of trimming the input. The number of dimensions and the -// input data type are preserved. -// -// Notes -// ----- -// For all-zero arrays, the first axis is trimmed first. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, trim='b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// Multiple dimensions are supported. -// -// >>> b = np.array([[0, 0, 2, 3, 0, 0], -// ... [0, 1, 0, 3, 0, 0], -// ... [0, 0, 0, 0, 0, 0]]) -// >>> np.trim_zeros(b) -// array([[0, 2, 3], -// [1, 0, 3]]) -// -// >>> np.trim_zeros(b, axis=-1) -// array([[0, 2, 3], -// [1, 0, 3], -// [0, 0, 0]]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object, axis *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : tuple of ndarrays -// A tuple of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> import numpy as np -// >>> rng = np.random.default_rng() -// >>> r = rng.normal(size=(100,3)) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, range_ *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the quantile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// The behavior of `numpy.nanquantile` is the same as that of -// `numpy.quantile` (ignoring nan values). -// For more information, please see `numpy.quantile`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// np.float64(nan) -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// >>> import numpy as np -// -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The `vdot` function handles complex numbers differently than `dot`: -// if the first argument is complex, it is replaced by its complex conjugate -// in the dot product calculation. `vdot` also handles multidimensional -// arrays differently than `dot`: it does not perform a matrix product, but -// flattens the arguments to 1-D arrays before taking a vector dot product. -// -// Consequently, when the arguments are 2-D arrays of the same shape, this -// function effectively returns their -// `Frobenius inner product `_ -// (also known as the *trace inner product* or the *standard inner product* -// on a vector space of matrices). -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// >>> import numpy as np -// -// Convert a list into an array. If all elements are finite, then -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, -np.inf]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the percentile according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. -// Only `method="inverted_cdf"` supports weights. -// -// .. versionadded:: 2.0.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// The behavior of `numpy.nanpercentile` with percentage `q` is that of -// `numpy.quantile` with argument ``q/100`` (ignoring nan values). -// For more information, please see `numpy.quantile`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// np.float64(nan) -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : {int, float}, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// mean : array_like, optional -// Provide the mean to prevent its recalculation. The mean should have -// a shape as if it was calculated with ``keepdims=True``. -// The axis for the calculation of the mean should be the same as used in -// the call to this var function. -// -// .. versionadded:: 2.0.0 -// -// correction : {int, float}, optional -// Array API compatible name for the ``ddof`` parameter. Only one of them -// can be provided at the same time. -// -// .. versionadded:: 2.0.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// *args : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -//go:linkname RightShift py.right_shift -func RightShift(__llgo_va_list ...interface{}) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` -// for more details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// >>> import numpy as np -// -// Define the signum function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> import numpy as np -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// np.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `numpy.digitize` is implemented in terms of `numpy.searchsorted`. -// This means that a binary search is used to bin the values, which scales -// much better for larger number of bins than the previous linear search. -// It also removes the requirement for the input array to be 1-dimensional. -// -// For monotonically *increasing* `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> import numpy as np -// -// Beginning with an array of integers from 0 to 5 (inclusive), -// elements less than ``3`` are negated, elements greater than ``3`` -// are squared, and elements not meeting either of these conditions -// (exactly ``3``) are replaced with a `default` value of ``42``. -// -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [-x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, -1, -2, 42, 16, 25]) -// -// When multiple conditions are satisfied, the first one encountered in -// `condlist` is used. -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, default_ *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> import numpy as np -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(__llgo_va_list ...interface{}) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value:: -// -// p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1] -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the bit-wise NOT of the absolute value is -// returned. In a two's-complement system, this operation effectively flips -// all the bits, resulting in a representation that corresponds to the -// negative of the input plus one. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range :math:`-2^{N-1}` to -// :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// ``numpy.bitwise_not`` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> import numpy as np -// -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// np.uint8(242) -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// np.uint16(65522) -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types, the result is the bit-wise NOT of -// the unsigned type, interpreted as a signed integer: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseInvert py.bitwise_invert -func BitwiseInvert(__llgo_va_list ...interface{}) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `numpy.int8`, `numpy.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a 4 by 4 array -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname BitwiseLeftShift py.bitwise_left_shift -func BitwiseLeftShift(__llgo_va_list ...interface{}) *py.Object -// -// concatenate( -// (a1, a2, ...), -// axis=0, -// out=None, -// dtype=None, -// casting="same_kind" -// ) -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// For a description of the options, please see :term:`casting`. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(a1 *py.Object, a2 *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), np.int64(1)) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Transposes a matrix (or a stack of matrices) ``x``. -// -// This function is Array API compatible. -// -// Parameters -// ---------- -// x : array_like -// Input array having shape (..., M, N) and whose two innermost -// dimensions form ``MxN`` matrices. -// -// Returns -// ------- -// out : ndarray -// An array containing the transpose for each matrix and having shape -// (..., N, M). -// -// See Also -// -------- -// transpose : Generic transpose method. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.matrix_transpose([[1, 2], [3, 4]]) -// array([[1, 3], -// [2, 4]]) -// -// >>> np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) -// array([[[1, 3], -// [2, 4]], -// [[5, 7], -// [6, 8]]]) -// -// -// -//go:linkname MatrixTranspose py.matrix_transpose -func MatrixTranspose(__llgo_va_list ...interface{}) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. If -// axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// add: ``numpy.add.reduce`` equivalent function. -// cumsum : Cumulative sum of array elements. -// trapezoid : Integration of array values using composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// np.int32(1) -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// np.int8(-128) -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(__llgo_va_list ...interface{}) *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int, array-like of ints or bools -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionchanged:: 2.1.2 -// Boolean indices are now treated as a mask of elements to insert, -// rather than being cast to the integers 0 and 1. -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. This is because of the difference between basic -// and advanced :ref:`indexing `. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.arange(6).reshape(3, 2) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.insert(a, 1, 6) -// array([0, 6, 1, 2, 3, 4, 5]) -// >>> np.insert(a, 1, 6, axis=1) -// array([[0, 6, 1], -// [2, 6, 3], -// [4, 6, 5]]) -// -// Difference between sequence and scalars, -// showing how ``obj=[1]`` behaves different from ``obj=1``: -// -// >>> np.insert(a, [1], [[7],[8],[9]], axis=1) -// array([[0, 7, 1], -// [2, 8, 3], -// [4, 9, 5]]) -// >>> np.insert(a, 1, [[7],[8],[9]], axis=1) -// array([[0, 7, 8, 9, 1], -// [2, 7, 8, 9, 3], -// [4, 7, 8, 9, 5]]) -// >>> np.array_equal(np.insert(a, 1, [7, 8, 9], axis=1), -// ... np.insert(a, [1], [[7],[8],[9]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([0, 1, 2, 3, 4, 5]) -// >>> np.insert(b, [2, 2], [6, 7]) -// array([0, 1, 6, 7, 2, 3, 4, 5]) -// -// >>> np.insert(b, slice(2, 4), [7, 8]) -// array([0, 1, 7, 2, 8, 3, 4, 5]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([0, 1, 7, 0, 2, 3, 4, 5]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> import numpy as np -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the bit-wise NOT of the absolute value is -// returned. In a two's-complement system, this operation effectively flips -// all the bits, resulting in a representation that corresponds to the -// negative of the input plus one. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range :math:`-2^{N-1}` to -// :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// ``numpy.bitwise_not`` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> import numpy as np -// -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// np.uint8(242) -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// np.uint16(65522) -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types, the result is the bit-wise NOT of -// the unsigned type, interpreted as a signed integer: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator ``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python's `math.remainder` and C's ``remainder``, which -// compute the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. Any content before the comment delimiter is -// discarded. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field -// names in a structured dtype. If `names` is None, the names of the -// dtype fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` -// is a file object. The special value 'bytes' enables backward -// compatibility workarounds that ensure that you receive byte arrays -// when possible and passes latin1 encoded strings to converters. -// Override this value to receive unicode arrays and pass strings -// as input to converters. If set to None the system default is used. -// The default value is 'bytes'. -// -// .. versionchanged:: 2.0 -// Before NumPy 2, the default was ``'bytes'`` for Python 2 -// compatibility. The default is now ``None``. -// -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When variables are named (either by a flexible dtype or with a `names` -// sequence), there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// * Custom converters may receive unexpected values due to dtype -// discovery. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO("1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, 'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO("11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, 'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is None. -// -// .. versionchanged:: 2.0 -// Before NumPy 2, the default was ``'bytes'`` for Python 2 -// compatibility. The default is now ``None``. -// -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> import numpy as np -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith("-") else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats, such as hex values: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Or a format where the ``-`` sign comes after the number: -// -// >>> s = StringIO("10.01 31.25-\n19.22 64.31\n17.57- 63.94") -// >>> conv = lambda x: -float(x[:-1]) if x.endswith("-") else float(x) -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -//go:linkname Log py.log -func Log(__llgo_va_list ...interface{}) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// >>> import numpy as np -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a 4 by 4 array -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, default_ *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(-np.inf) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> import numpy as np -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -//go:linkname Log2 py.log2 -func Log2(__llgo_va_list ...interface{}) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Examples -// -------- -// >>> import numpy as np -// -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by prepending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The row and column indices, respectively. The row indices are sorted -// in non-decreasing order, and the correspdonding column indices are -// strictly increasing for each row. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Examples -// -------- -// >>> import numpy as np -// -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il1 -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Note that row indices (first array) are non-decreasing, and the corresponding -// column indices (second array) are strictly increasing for each row. -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> il2 = np.tril_indices(4, 2) -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// -// Returns an array with axes transposed. -// -// For a 1-D array, this returns an unchanged view of the original array, as a -// transposed vector is simply the same vector. -// To convert a 1-D array into a 2-D column vector, an additional dimension -// must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does -// ``a[:, np.newaxis]``. -// For a 2-D array, this is the standard matrix transpose. -// For an n-D array, if axes are given, their order indicates how the -// axes are permuted (see Examples). If axes are not provided, then -// ``transpose(a).shape == a.shape[::-1]``. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axes : tuple or list of ints, optional -// If specified, it must be a tuple or list which contains a permutation -// of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative -// indices can also be used to specify axes. The i-th axis of the returned -// array will correspond to the axis numbered ``axes[i]`` of the input. -// If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses -// the order of the axes. -// -// Returns -// ------- -// p : ndarray -// `a` with its axes permuted. A view is returned whenever possible. -// -// See Also -// -------- -// ndarray.transpose : Equivalent method. -// moveaxis : Move axes of an array to new positions. -// argsort : Return the indices that would sort an array. -// -// Notes -// ----- -// Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors -// when using the `axes` keyword argument. -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// >>> a = np.arange(3*4*5).reshape((3, 4, 5)) -// >>> np.transpose(a, (-1, 0, -2)).shape -// (5, 3, 4) -// -// -// -//go:linkname PermuteDims py.permute_dims -func PermuteDims(a *py.Object, axes *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// The copy made of the data is shallow, i.e., for arrays with object dtype, -// the new array will point to the same objects. -// See Examples from `ndarray.copy`. -// -// Examples -// -------- -// >>> import numpy as np -// -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> import numpy as np -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, -// a ``.npy`` extension will be appended to the filename if it does not -// already have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for -// disallowing pickles include security (loading pickled data can execute -// arbitrary code) and portability (pickled objects may not be loadable -// on different Python installations, for example if the stored objects -// require libraries that are not available, and not all pickled data is -// compatible between different versions of Python). -// Default: True -// fix_imports : bool, optional -// The `fix_imports` flag is deprecated and has no effect. -// -// .. deprecated:: 2.1 -// This flag is ignored since NumPy 1.17 and was only needed to -// support loading in Python 2 some files written in Python 3. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> import numpy as np -// -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(__llgo_va_list ...interface{}) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> import numpy as np -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> import numpy as np -// >>> A = np.asmatrix('1 1; 1 1') -// >>> B = np.asmatrix('2 2; 2 2') -// >>> C = np.asmatrix('3 4; 5 6') -// >>> D = np.asmatrix('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> import numpy as np -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object From e39a113ca226ba0868ff5ddec858fbf92c0f192d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Fri, 22 Aug 2025 17:59:20 +0800 Subject: [PATCH 56/88] ver --- .github/workflows/verification.yml | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index edcc3ea5..55b91c8e 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -51,7 +51,7 @@ jobs: cd llpkgstore git checkout 8_21 # 临时修改 go.mod 中的模块路径 - sed -i 's|module github.com/goplus/llpkgstore|module github.com/PengPengPeng717/llpkgstore|' go.mod + sed -i '' 's|module github.com/goplus/llpkgstore|module github.com/PengPengPeng717/llpkgstore|' go.mod go install -v ./cmd/llpkgstore # - name: Set up Tool # run: | @@ -153,11 +153,11 @@ jobs: echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" echo "Any changed: ${{ steps.changed-files.outputs.any_changed }}" echo "All changed: ${{ steps.changed-files.outputs.all_changed }}" - - name: Test llpyg generation - run: | - # Test llpyg with numpy as per guide - llpyg numpy - echo "llpyg generation completed successfully" + # - name: Test llpyg generation + # run: | + # # Test llpyg with numpy as per guide + # llpyg numpy + # echo "llpyg generation completed successfully" - name: Verification & Prebuilt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -167,19 +167,19 @@ jobs: env: LLPKG_PATH: ${{ env.LLPKG_PATH }} run: llpkgstore demotest - - name: Create Git tag - run: | - echo "Creating Git tag: numpy/v0.1.0" + # - name: Create Git tag + # run: | + # echo "Creating Git tag: numpy/v0.1.0" - # Configure git user for tag creation - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" + # # Configure git user for tag creation + # # git config --local user.email "action@github.com" + # # git config --local user.name "GitHub Action" - # Create the tag - git tag "numpy/v0.1.0" + # # Create the tag + # git tag "numpy/v0.1.0" - # Push the tag to remote repository - echo "Pushing tag to remote repository..." - git push origin "numpy/v0.1.0" + # # Push the tag to remote repository + # echo "Pushing tag to remote repository..." + # git push origin "numpy/v0.1.0" - echo "✅ Git tag numpy/v0.1.0 created and pushed successfully" \ No newline at end of file + # echo "✅ Git tag numpy/v0.1.0 created and pushed successfully" \ No newline at end of file From 865fb57a8bfa2de7762f76eb2471f36e9f88363d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Fri, 22 Aug 2025 18:19:37 +0800 Subject: [PATCH 57/88] 11 --- .github/workflows/verification.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 55b91c8e..96762624 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -47,15 +47,14 @@ jobs: go-version: 1.24.x - name: Set up Tool run: | - git clone https://github.com/PengPengPeng717/llpkgstore.git - cd llpkgstore - git checkout 8_21 - # 临时修改 go.mod 中的模块路径 - sed -i '' 's|module github.com/goplus/llpkgstore|module github.com/PengPengPeng717/llpkgstore|' go.mod - go install -v ./cmd/llpkgstore + git clone https://github.com/PengPengPeng717/llpkgstore.git + cd llpkgstore + git checkout 8_21 + go build -o llpkgstore ./cmd/llpkgstore + sudo mv llpkgstore /usr/local/bin/ # - name: Set up Tool # run: | - # go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@8_21 + # go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@v0.9.0 - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | From 3f6dfdf89c06320cf053d5f79104fa9cd00c8b66 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Fri, 22 Aug 2025 18:22:34 +0800 Subject: [PATCH 58/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 05a1e027090ff8a6e85fe469d4a98c1040ec4976 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 14:23:40 +0800 Subject: [PATCH 59/88] 8_25 --- .github/workflows/issueclose.yml | 46 +- .github/workflows/labelcreate.yml | 46 +- .github/workflows/postprocessing.yml | 125 +- .github/workflows/verification.yml | 38 +- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------- 10 files changed, 230 insertions(+), 27169 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/.github/workflows/issueclose.yml b/.github/workflows/issueclose.yml index cbacdda8..8add125b 100644 --- a/.github/workflows/issueclose.yml +++ b/.github/workflows/issueclose.yml @@ -14,12 +14,54 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Check out LLGo + uses: actions/checkout@v4 + with: + repository: '1351914167/llgo' + path: .llgo + ref: get_pip + - name: Check out LLPyg + uses: actions/checkout@v4 + with: + repository: 'toaction/llpyg' + path: .llpyg + ref: feat/v1 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.23.x + go-version: 1.24.x - name: Set up Tool - run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest + run: | + git clone https://github.com/PengPengPeng717/llpkgstore.git + cd llpkgstore + git checkout 8_21 + go build -o llpkgstore ./cmd/llpkgstore + sudo mv llpkgstore /usr/local/bin/ + - name: Setup LLGo + working-directory: .llgo + run: | + go install -v ./cmd/... + export LLGO_ROOT=$PWD + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV + - name: Set up Python environment + run: | + echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + export PYTHONHOME=$LLGO_ROOT/python + export PATH=$PYTHONHOME/bin:$PATH + export DYLD_LIBRARY_PATH=$PYTHONHOME/lib + export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig + echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV + - name: Setup LLPyg + working-directory: .llpyg + run: | + cd _xtool + llgo install ./... + cd .. + go install -v ./cmd/... - name: Run cleaner process env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labelcreate.yml b/.github/workflows/labelcreate.yml index ddd7826d..48e4691e 100644 --- a/.github/workflows/labelcreate.yml +++ b/.github/workflows/labelcreate.yml @@ -24,12 +24,54 @@ jobs: ref: main path: .main fetch-depth: 0 + - name: Check out LLGo + uses: actions/checkout@v4 + with: + repository: '1351914167/llgo' + path: .llgo + ref: get_pip + - name: Check out LLPyg + uses: actions/checkout@v4 + with: + repository: 'toaction/llpyg' + path: .llpyg + ref: feat/v1 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.23.x + go-version: 1.24.x - name: Set up Tool - run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest + run: | + git clone https://github.com/PengPengPeng717/llpkgstore.git + cd llpkgstore + git checkout 8_21 + go build -o llpkgstore ./cmd/llpkgstore + sudo mv llpkgstore /usr/local/bin/ + - name: Setup LLGo + working-directory: .llgo + run: | + go install -v ./cmd/... + export LLGO_ROOT=$PWD + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV + - name: Set up Python environment + run: | + echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + export PYTHONHOME=$LLGO_ROOT/python + export PATH=$PYTHONHOME/bin:$PATH + export DYLD_LIBRARY_PATH=$PYTHONHOME/lib + export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig + echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV + - name: Setup LLPyg + working-directory: .llpyg + run: | + cd _xtool + llgo install ./... + cd .. + go install -v ./cmd/... - name: Copy llpkgstore.json to root continue-on-error: true run: | diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index dccb945b..df04fa28 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -23,32 +23,83 @@ jobs: matrix: os: - macos-13 - - macos-latest - - ubuntu-24.04 - - ubuntu-24.04-arm + # - macos-latest + # - ubuntu-24.04 + # - ubuntu-24.04-arm runs-on: ${{matrix.os}} steps: - name: Checkout uses: actions/checkout@v4 + - name: Check out LLGo + uses: actions/checkout@v4 + with: + repository: '1351914167/llgo' + path: .llgo + ref: get_pip + - name: Check out LLPyg + uses: actions/checkout@v4 + with: + repository: 'toaction/llpyg' + path: .llpyg + ref: feat/v1 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.23.x + go-version: 1.24.x - name: Set up Tool - run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest + run: | + git clone https://github.com/PengPengPeng717/llpkgstore.git + cd llpkgstore + git checkout 8_21 + go build -o llpkgstore ./cmd/llpkgstore + sudo mv llpkgstore /usr/local/bin/ - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | - brew update - brew install cmake conan cjson - - name: Install dependencies - if: startsWith(matrix.os, 'ubuntu') + # brew install llvm@19 bdw-gc openssl libffi libuv cmake conan lld@19 + # brew link --force libffi + # echo "$(brew --prefix llvm@19)/bin" >> $GITHUB_PATH + # echo "$(brew --prefix lld@19)/bin" >> $GITHUB_PATH + echo "Skipping C++ dependencies for Python-only build" + # - name: Install dependencies + # if: startsWith(matrix.os, 'ubuntu') + # run: | + # # sudo apt-get update + # # sudo apt-get install -y cmake python3 python3-pip pkg-config + # # python3 -m pip install conan + # echo "Skipping C++ dependencies for Python-only build" + - name: Pre setup Python and Conan + if: startsWith(matrix.os, 'macos') + run: | + # python3 -m pip install conan pydump --break-system-packages + echo "Skipping Conan setup for Python-only build" + - name: Setup LLGo + working-directory: .llgo + run: | + go install -v ./cmd/... + export LLGO_ROOT=$PWD + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV + - name: Set up Python environment run: | - sudo apt-get update - sudo apt-get install -y cmake python3 python3-pip pkg-config - python3 -m pip install conan - - name: Set up Conan - run: conan profile detect + echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + export PYTHONHOME=$LLGO_ROOT/python + export PATH=$PYTHONHOME/bin:$PATH + export DYLD_LIBRARY_PATH=$PYTHONHOME/lib + export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig + echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV + - name: Setup LLPyg + working-directory: .llpyg + run: | + cd _xtool + llgo install ./... + cd .. + go install -v ./cmd/... + # - name: Set up Conan + # run: conan profile detect - name: Run release process env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -68,12 +119,54 @@ jobs: with: ref: main path: .main + - name: Check out LLGo + uses: actions/checkout@v4 + with: + repository: '1351914167/llgo' + path: .llgo + ref: get_pip + - name: Check out LLPyg + uses: actions/checkout@v4 + with: + repository: 'toaction/llpyg' + path: .llpyg + ref: feat/v1 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.23.x + go-version: 1.24.x - name: Set up Tool - run: go install -v github.com/PengPengPeng717/llpkgstore/cmd/llpkgstore@latest + run: | + git clone https://github.com/PengPengPeng717/llpkgstore.git + cd llpkgstore + git checkout 8_21 + go build -o llpkgstore ./cmd/llpkgstore + sudo mv llpkgstore /usr/local/bin/ + - name: Setup LLGo + working-directory: .llgo + run: | + go install -v ./cmd/... + export LLGO_ROOT=$PWD + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV + - name: Set up Python environment + run: | + echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + export PYTHONHOME=$LLGO_ROOT/python + export PATH=$PYTHONHOME/bin:$PATH + export DYLD_LIBRARY_PATH=$PYTHONHOME/lib + export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig + echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV + - name: Setup LLPyg + working-directory: .llpyg + run: | + cd _xtool + llgo install ./... + cd .. + go install -v ./cmd/... - name: Checkout to website uses: actions/checkout@v4 with: diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 96762624..b3179104 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -58,10 +58,11 @@ jobs: - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | - brew install llvm@${{matrix.llvm}} bdw-gc openssl libffi libuv cmake conan lld@${{matrix.llvm}} - brew link --force libffi - echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH - echo "$(brew --prefix lld@${{matrix.llvm}})/bin" >> $GITHUB_PATH + # brew install llvm@${{matrix.llvm}} bdw-gc openssl libffi libuv cmake conan lld@${{matrix.llvm}} + # brew link --force libffi + # echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH + # echo "$(brew --prefix lld@${{matrix.llvm}})/bin" >> $GITHUB_PATH + echo "Skipping C++ dependencies for Python-only build" # - name: Install dependencies # if: startsWith(matrix.os, 'ubuntu') # run: | @@ -88,6 +89,7 @@ jobs: run: | python3 -m pip install conan pydump --break-system-packages # go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 + echo "Skipping Conan setup for Python-only build" # - name: Set up Conan # run: | # conan profile detect @@ -145,7 +147,7 @@ jobs: files: | # **/llpkg.cfg **/llpyg.cfg - **/llcppg.cfg + # **/llcppg.cfg **/*.go - name: Debug changed files run: | @@ -166,6 +168,32 @@ jobs: env: LLPKG_PATH: ${{ env.LLPKG_PATH }} run: llpkgstore demotest + # - name: Create direct version mapping for Python packages + # run: | + # echo "Creating direct version mapping for Python packages..." + # echo "Python packages will be mapped directly: numpy@1.26.4 → v1.26.4" + + # # 检查当前目录的 Python 包 + # if [ -f "llpkg.cfg" ]; then + # PACKAGE_TYPE=$(grep -o '"type": *"[^"]*"' llpkg.cfg | cut -d'"' -f4) + # if [ "$PACKAGE_TYPE" = "python" ]; then + # PACKAGE_NAME=$(grep -o '"name": *"[^"]*"' llpkg.cfg | cut -d'"' -f4) + # PACKAGE_VERSION=$(grep -o '"version": *"[^"]*"' llpkg.cfg | cut -d'"' -f4) + # echo "Detected Python package: $PACKAGE_NAME@$PACKAGE_VERSION → v$PACKAGE_VERSION" + # fi + # fi + + # # 检查子目录的 Python 包 + # for dir in */; do + # if [ -d "$dir" ] && [ -f "$dir/llpkg.cfg" ]; then + # PACKAGE_TYPE=$(grep -o '"type": *"[^"]*"' "$dir/llpkg.cfg" | cut -d'"' -f4) + # if [ "$PACKAGE_TYPE" = "python" ]; then + # PACKAGE_NAME=$(grep -o '"name": *"[^"]*"' "$dir/llpkg.cfg" | cut -d'"' -f4) + # PACKAGE_VERSION=$(grep -o '"version": *"[^"]*"' "$dir/llpkg.cfg" | cut -d'"' -f4) + # echo "Detected Python package in $dir: $PACKAGE_NAME@$PACKAGE_VERSION → v$PACKAGE_VERSION" + # fi + # fi + # done # - name: Create Git tag # run: | # echo "Creating Git tag: numpy/v0.1.0" diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 460bc8b5a36fd624209ebf421c9c52c326af77e6 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 14:35:50 +0800 Subject: [PATCH 60/88] ver --- .github/workflows/verification.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index b3179104..2c22d9b3 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -58,10 +58,10 @@ jobs: - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | - # brew install llvm@${{matrix.llvm}} bdw-gc openssl libffi libuv cmake conan lld@${{matrix.llvm}} - # brew link --force libffi - # echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH - # echo "$(brew --prefix lld@${{matrix.llvm}})/bin" >> $GITHUB_PATH + brew install llvm@${{matrix.llvm}} bdw-gc openssl libffi libuv cmake conan lld@${{matrix.llvm}} + brew link --force libffi + echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH + echo "$(brew --prefix lld@${{matrix.llvm}})/bin" >> $GITHUB_PATH echo "Skipping C++ dependencies for Python-only build" # - name: Install dependencies # if: startsWith(matrix.os, 'ubuntu') From 250fa41acbe68f68b72b36ba61a5b62d109a99e0 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 14:39:17 +0800 Subject: [PATCH 61/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 668c113ab28148ea9d1d89675fac98d41e603a2b Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 15:14:07 +0800 Subject: [PATCH 62/88] post --- .github/workflows/postprocessing.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index df04fa28..0094e4c7 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -56,10 +56,10 @@ jobs: - name: Install dependencies if: startsWith(matrix.os, 'macos') run: | - # brew install llvm@19 bdw-gc openssl libffi libuv cmake conan lld@19 - # brew link --force libffi - # echo "$(brew --prefix llvm@19)/bin" >> $GITHUB_PATH - # echo "$(brew --prefix lld@19)/bin" >> $GITHUB_PATH + brew install llvm@19 bdw-gc openssl libffi libuv cmake conan lld@19 + brew link --force libffi + echo "$(brew --prefix llvm@19)/bin" >> $GITHUB_PATH + echo "$(brew --prefix lld@19)/bin" >> $GITHUB_PATH echo "Skipping C++ dependencies for Python-only build" # - name: Install dependencies # if: startsWith(matrix.os, 'ubuntu') From e17305b27693b37a8fa70f77402923f8c5bfb7b6 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 15:18:23 +0800 Subject: [PATCH 63/88] delect numpy --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 6211cd0f629524ce2a4e35507e99f4b95da5d6b4 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 15:21:00 +0800 Subject: [PATCH 64/88] del numpy --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 88177bb0c9f9be7890722b5a89f0283eacda93ff Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 15:23:13 +0800 Subject: [PATCH 65/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From e9eb0630518c13f20b7ef8b30c99ed8509c3d029 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 15:32:25 +0800 Subject: [PATCH 66/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From bd61d6ac8fce7eb7fe39ed5a8bdc1e42a9103f81 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 16:30:33 +0800 Subject: [PATCH 67/88] del --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From cca731d0ea13f44c2486deb7c865874cfc274519 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 16:43:47 +0800 Subject: [PATCH 68/88] add+commit --- .github/workflows/postprocessing.yml | 3 ++- .github/workflows/verification.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index 0094e4c7..d14a84be 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -50,7 +50,8 @@ jobs: run: | git clone https://github.com/PengPengPeng717/llpkgstore.git cd llpkgstore - git checkout 8_21 + # git checkout 8_21 + git checkout post go build -o llpkgstore ./cmd/llpkgstore sudo mv llpkgstore /usr/local/bin/ - name: Install dependencies diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml index 2c22d9b3..89313b9c 100644 --- a/.github/workflows/verification.yml +++ b/.github/workflows/verification.yml @@ -49,7 +49,8 @@ jobs: run: | git clone https://github.com/PengPengPeng717/llpkgstore.git cd llpkgstore - git checkout 8_21 + # git checkout 8_21 + git checkout post go build -o llpkgstore ./cmd/llpkgstore sudo mv llpkgstore /usr/local/bin/ # - name: Set up Tool From 5934518ce8486921fea1030edae4d07f702c7e9b Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 16:57:08 +0800 Subject: [PATCH 69/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From b0dca29b72e9c608bdec377d8f2084b346b736b1 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:04:41 +0800 Subject: [PATCH 70/88] pos --- .github/workflows/postprocessing.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index d14a84be..d3e7c0f4 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -105,11 +105,31 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: llpkgstore release + - name: Resolve artifact path + shell: bash + run: | + set -euo pipefail + # If llpkgstore didn't export BIN_PATH/BIN_FILENAME, try to discover them. + if [ -z "${BIN_PATH:-}" ]; then + # Search common artifact patterns (zip/tar.gz) within workspace + BIN_PATH=$(find . -maxdepth 5 -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.tgz" \) | head -n1 || true) + if [ -n "${BIN_PATH}" ]; then + echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_ENV + fi + fi + if [ -z "${BIN_FILENAME:-}" ] && [ -n "${BIN_PATH:-}" ]; then + BIN_FILENAME=$(basename "${BIN_PATH}") + echo "BIN_FILENAME=${BIN_FILENAME}" >> $GITHUB_ENV + fi + # Final guardrails for upload step + if [ -z "${BIN_PATH:-}" ]; then + echo "::warning::BIN_PATH is empty; upload-artifact 'path' would be missing. Please ensure llpkgstore release sets BIN_PATH or adjust search patterns." + fi - name: Upload binary file to artifact uses: actions/upload-artifact@v4 with: - name: ${{env.BIN_FILENAME}} - path: ${{env.BIN_PATH}} + name: ${{ env.BIN_FILENAME || 'artifact' }} + path: ${{ env.BIN_PATH }} retention-days: 1 post-processing: runs-on: ubuntu-latest @@ -140,7 +160,7 @@ jobs: run: | git clone https://github.com/PengPengPeng717/llpkgstore.git cd llpkgstore - git checkout 8_21 + git checkout 8_25 go build -o llpkgstore ./cmd/llpkgstore sudo mv llpkgstore /usr/local/bin/ - name: Setup LLGo From 18ecea12d550548e524b0bf25698205b193f4b47 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:10:34 +0800 Subject: [PATCH 71/88] 111 --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From c4ff8df13a92db1ce3f76835b6f289319558d50a Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:14:13 +0800 Subject: [PATCH 72/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 6c68b572a4792d9fe4f965ab2e7b1122c604572d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:17:35 +0800 Subject: [PATCH 73/88] del --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 2d0f3df0d2d5cbda5f99a2088e3a6bb498685469 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:19:33 +0800 Subject: [PATCH 74/88] del --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From b2eb92076a1513cd1493de26e70b24ba88e43904 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:21:29 +0800 Subject: [PATCH 75/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 75c7dd5bd102ea62af92763d7317c02de229f688 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:25:01 +0800 Subject: [PATCH 76/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 05e30d19392fcebed85e5a2dc51132544191094c Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:34:50 +0800 Subject: [PATCH 77/88] psot --- .github/workflows/postprocessing.yml | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index d3e7c0f4..06fb4402 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -105,31 +105,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: llpkgstore release - - name: Resolve artifact path - shell: bash - run: | - set -euo pipefail - # If llpkgstore didn't export BIN_PATH/BIN_FILENAME, try to discover them. - if [ -z "${BIN_PATH:-}" ]; then - # Search common artifact patterns (zip/tar.gz) within workspace - BIN_PATH=$(find . -maxdepth 5 -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.tgz" \) | head -n1 || true) - if [ -n "${BIN_PATH}" ]; then - echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_ENV - fi - fi - if [ -z "${BIN_FILENAME:-}" ] && [ -n "${BIN_PATH:-}" ]; then - BIN_FILENAME=$(basename "${BIN_PATH}") - echo "BIN_FILENAME=${BIN_FILENAME}" >> $GITHUB_ENV - fi - # Final guardrails for upload step - if [ -z "${BIN_PATH:-}" ]; then - echo "::warning::BIN_PATH is empty; upload-artifact 'path' would be missing. Please ensure llpkgstore release sets BIN_PATH or adjust search patterns." - fi - name: Upload binary file to artifact uses: actions/upload-artifact@v4 with: - name: ${{ env.BIN_FILENAME || 'artifact' }} - path: ${{ env.BIN_PATH }} + name: ${{env.BIN_FILENAME}} + path: ${{env.BIN_PATH}} retention-days: 1 post-processing: runs-on: ubuntu-latest @@ -160,7 +140,8 @@ jobs: run: | git clone https://github.com/PengPengPeng717/llpkgstore.git cd llpkgstore - git checkout 8_25 + # git checkout 8_21 + git checkout post go build -o llpkgstore ./cmd/llpkgstore sudo mv llpkgstore /usr/local/bin/ - name: Setup LLGo From 730c95cda6098a1fce4e7ec4b077a6c78f4f81cc Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:35:43 +0800 Subject: [PATCH 78/88] del --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 8b524a96d0fbf1a17cfedaf49d6dbc6fad5c240b Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 17:39:47 +0800 Subject: [PATCH 79/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 6ccbeca76a71752ccea79e96f1474a57436e78f7 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 18:09:37 +0800 Subject: [PATCH 80/88] posy --- .github/workflows/postprocessing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index 06fb4402..602c9e36 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -108,8 +108,8 @@ jobs: - name: Upload binary file to artifact uses: actions/upload-artifact@v4 with: - name: ${{env.BIN_FILENAME}} - path: ${{env.BIN_PATH}} + name: ${{env.BIN_FILENAME || 'llpkg-binary'}} + path: ${{env.BIN_PATH || './dist'}} retention-days: 1 post-processing: runs-on: ubuntu-latest From 3edb736e5f1a85d2ba77a96807b69dc6a675e7a6 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 18:22:27 +0800 Subject: [PATCH 81/88] 111 --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 84f4b6d5a3d16f1014da8b6e53408b0c085a1ce0 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 18:32:42 +0800 Subject: [PATCH 82/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 71abe8e0e312724058eb31ba02d2f0e66b800c4d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 18:58:23 +0800 Subject: [PATCH 83/88] 111 --- .github/workflows/postprocessing.yml | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index 602c9e36..c93f4569 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -120,18 +120,18 @@ jobs: with: ref: main path: .main - - name: Check out LLGo - uses: actions/checkout@v4 - with: - repository: '1351914167/llgo' - path: .llgo - ref: get_pip - - name: Check out LLPyg - uses: actions/checkout@v4 - with: - repository: 'toaction/llpyg' - path: .llpyg - ref: feat/v1 + # - name: Check out LLGo + # uses: actions/checkout@v4 + # with: + # repository: '1351914167/llgo' + # path: .llgo + # ref: get_pip + # - name: Check out LLPyg + # uses: actions/checkout@v4 + # with: + # repository: 'toaction/llpyg' + # path: .llpyg + # ref: feat/v1 - name: Set up Go uses: actions/setup-go@v4 with: @@ -144,31 +144,31 @@ jobs: git checkout post go build -o llpkgstore ./cmd/llpkgstore sudo mv llpkgstore /usr/local/bin/ - - name: Setup LLGo - working-directory: .llgo - run: | - go install -v ./cmd/... - export LLGO_ROOT=$PWD - echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV - echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV - - name: Set up Python environment - run: | - echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV - export PYTHONHOME=$LLGO_ROOT/python - export PATH=$PYTHONHOME/bin:$PATH - export DYLD_LIBRARY_PATH=$PYTHONHOME/lib - export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig - echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV - echo "PATH=$PATH" >> $GITHUB_ENV - echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV - echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV - - name: Setup LLPyg - working-directory: .llpyg - run: | - cd _xtool - llgo install ./... - cd .. - go install -v ./cmd/... + # - name: Setup LLGo + # working-directory: .llgo + # run: | + # go install -v ./cmd/... + # export LLGO_ROOT=$PWD + # echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + # echo "LLGO_RPATH_CHANGE=ON" >> $GITHUB_ENV + # - name: Set up Python environment + # run: | + # echo "GOTOOLCHAIN=go1.24.5" >> $GITHUB_ENV + # export PYTHONHOME=$LLGO_ROOT/python + # export PATH=$PYTHONHOME/bin:$PATH + # export DYLD_LIBRARY_PATH=$PYTHONHOME/lib + # export PKG_CONFIG_PATH=$PYTHONHOME/lib/pkgconfig + # echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV + # echo "PATH=$PATH" >> $GITHUB_ENV + # echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV + # echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV + # - name: Setup LLPyg + # working-directory: .llpyg + # run: | + # cd _xtool + # llgo install ./... + # cd .. + # go install -v ./cmd/... - name: Checkout to website uses: actions/checkout@v4 with: From 484b3c29c0a9a3ba5129811ca9c8ef1f2f1d1c84 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 19:02:52 +0800 Subject: [PATCH 84/88] del --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 8be5c78ef6c21e09e63800bb008b4fde74c1dd0d Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 19:04:46 +0800 Subject: [PATCH 85/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From b27ae14bb1dfcda79632e4005861755e5ec7e926 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 19:22:39 +0800 Subject: [PATCH 86/88] post_json --- .github/workflows/postprocessing.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml index c93f4569..ae7ad2c9 100644 --- a/.github/workflows/postprocessing.yml +++ b/.github/workflows/postprocessing.yml @@ -198,8 +198,13 @@ jobs: git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add public/llpkgstore.json - git commit -m "Update llpkgstore.json" - git push + # Check if there are changes to commit + if git diff --staged --quiet; then + echo "No changes to commit in llpkgstore.json" + else + git commit -m "Update llpkgstore.json" + git push + fi build-and-upload: runs-on: ubuntu-latest needs: [post-processing] From db2538d6d52ea919f4983a003a82916208fc4711 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 19:26:28 +0800 Subject: [PATCH 87/88] del --- numpy/_demo/basic_test/main.go | 27 - numpy/go.mod | 5 - numpy/go.sum | 2 - numpy/llpkg.cfg | 15 - numpy/llpyg.cfg | 7 - numpy/numpy.go | 27088 ------------------------------- 6 files changed, 27144 deletions(-) delete mode 100644 numpy/_demo/basic_test/main.go delete mode 100644 numpy/go.mod delete mode 100644 numpy/go.sum delete mode 100644 numpy/llpkg.cfg delete mode 100644 numpy/llpyg.cfg delete mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go deleted file mode 100644 index c70be070..00000000 --- a/numpy/_demo/basic_test/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - - "numpy" - - "github.com/goplus/lib/py" - "github.com/goplus/lib/py/std" -) - -func main() { - fmt.Println("=== NumPy Basic Test Demo ===") - - // 测试1: 创建数组 - fmt.Println("\n1. 创建数组测试:") - - // 创建一个简单的数组 - arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) - arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) - - // 使用numpy进行数组运算 - arr3 := numpy.Add(arr1, arr2) - std.Print(py.Str("result:"), arr3) - - fmt.Println("\n=== 测试完成 ===") -} diff --git a/numpy/go.mod b/numpy/go.mod deleted file mode 100644 index fc2aaa3c..00000000 --- a/numpy/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module numpy - -go 1.24.5 - -require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum deleted file mode 100644 index 512980a5..00000000 --- a/numpy/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= -github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg deleted file mode 100644 index fba1a7cf..00000000 --- a/numpy/llpkg.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "python", - "upstream": { - "installer": { - "name": "pip", - "config": { - "options": "" - } - }, - "package": { - "name": "numpy", - "version": "1.26.4" - } - } -} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg deleted file mode 100644 index 698ff6b4..00000000 --- a/numpy/llpyg.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "numpy", - "libName": "numpy", - "modules": [ - "numpy" - ] -} diff --git a/numpy/numpy.go b/numpy/numpy.go deleted file mode 100644 index dc1217db..00000000 --- a/numpy/numpy.go +++ /dev/null @@ -1,27088 +0,0 @@ -package numpy - -import ( - "github.com/goplus/lib/py" - _ "unsafe" -) - -const LLGoPackage = "py.numpy" -// -// dot(a, b, out=None) -// -// Dot product of two arrays. Specifically, -// -// - If both `a` and `b` are 1-D arrays, it is inner product of vectors -// (without complex conjugation). -// -// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, -// but using :func:`matmul` or ``a @ b`` is preferred. -// -// - If either `a` or `b` is 0-D (scalar), it is equivalent to -// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is -// preferred. -// -// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over -// the last axis of `a` and `b`. -// -// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a -// sum product over the last axis of `a` and the second-to-last axis of -// `b`:: -// -// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Parameters -// ---------- -// a : array_like -// First argument. -// b : array_like -// Second argument. -// out : ndarray, optional -// Output argument. This must have the exact kind that would be returned -// if it was not used. In particular, it must have the right type, must be -// C-contiguous, and its dtype must be the dtype that would be returned -// for `dot(a,b)`. This is a performance feature. Therefore, if these -// conditions are not met, an exception is raised, instead of attempting -// to be flexible. -// -// Returns -// ------- -// output : ndarray -// Returns the dot product of `a` and `b`. If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// If `out` is given, then it is returned. -// -// Raises -// ------ -// ValueError -// If the last dimension of `a` is not the same size as -// the second-to-last dimension of `b`. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// matmul : '@' operator as method with out parameter. -// linalg.multi_dot : Chained dot product. -// -// Examples -// -------- -// >>> np.dot(3, 4) -// 12 -// -// Neither argument is complex-conjugated: -// -// >>> np.dot([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// For 2-D arrays it is the matrix product: -// -// >>> a = [[1, 0], [0, 1]] -// >>> b = [[4, 1], [2, 2]] -// >>> np.dot(a, b) -// array([[4, 1], -// [2, 2]]) -// -// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) -// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) -// >>> np.dot(a, b)[2,3,2,1,2,2] -// 499128 -// >>> sum(a[2,3,2,:] * b[1,2,:,2]) -// 499128 -// -// -// -//go:linkname Dot py.dot -func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with ones. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: C -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the given shape, dtype, and order. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// empty : Return a new uninitialized array. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Examples -// -------- -// >>> np.ones(5) -// array([1., 1., 1., 1., 1.]) -// -// >>> np.ones((5,), dtype=int) -// array([1, 1, 1, 1, 1]) -// -// >>> np.ones((2, 1)) -// array([[1.], -// [1.]]) -// -// >>> s = (2,2) -// >>> np.ones(s) -// array([[1., 1.], -// [1., 1.]]) -// -// -// -//go:linkname Ones py.ones -func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return selected slices of an array along given axis. -// -// When working along a given axis, a slice along that axis is returned in -// `output` for each index where `condition` evaluates to True. When -// working on a 1-D array, `compress` is equivalent to `extract`. -// -// Parameters -// ---------- -// condition : 1-D array of bools -// Array that selects which entries to return. If len(condition) -// is less than the size of `a` along the given axis, then output is -// truncated to the length of the condition array. -// a : array_like -// Array from which to extract a part. -// axis : int, optional -// Axis along which to take slices. If None (default), work on the -// flattened array. -// out : ndarray, optional -// Output array. Its type is preserved and it must be of the right -// shape to hold the output. -// -// Returns -// ------- -// compressed_array : ndarray -// A copy of `a` without the slices along axis for which `condition` -// is false. -// -// See Also -// -------- -// take, choose, diag, diagonal, select -// ndarray.compress : Equivalent method in ndarray -// extract : Equivalent method when working on 1-D arrays -// :ref:`ufuncs-output-type` -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) -// >>> a -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.compress([0, 1], a, axis=0) -// array([[3, 4]]) -// >>> np.compress([False, True, True], a, axis=0) -// array([[3, 4], -// [5, 6]]) -// >>> np.compress([False, True], a, axis=1) -// array([[2], -// [4], -// [6]]) -// -// Working on the flattened array does not return slices along an axis but -// selects elements. -// -// >>> np.compress([False, True], a) -// array([2]) -// -// -// -//go:linkname Compress py.compress -func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative sum of the elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// cumsum_along_axis : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to `out` is returned. The -// result has the same size as `a`, and the same shape as `a` if -// `axis` is not None or `a` is a 1-d array. -// -// See Also -// -------- -// sum : Sum array elements. -// trapz : Integration of array values using the composite trapezoidal rule. -// diff : Calculate the n-th discrete difference along given axis. -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point -// values since ``sum`` may use a pairwise summation routine, reducing -// the roundoff-error. See `sum` for more information. -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.cumsum(a) -// array([ 1, 3, 6, 10, 15, 21]) -// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) -// array([ 1., 3., 6., 10., 15., 21.]) -// -// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns -// array([[1, 2, 3], -// [5, 7, 9]]) -// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows -// array([[ 1, 3, 6], -// [ 4, 9, 15]]) -// -// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` -// -// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) -// >>> b.cumsum()[-1] -// 1000000.0050045159 -// >>> b.sum() -// 1000000.0050000029 -// -// -// -//go:linkname Cumsum py.cumsum -func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return element-wise quotient and remainder simultaneously. -// -// .. versionadded:: 1.13.0 -// -// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster -// because it avoids redundant work. It is used to implement the Python -// built-in function ``divmod`` on NumPy arrays. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out1 : ndarray -// Element-wise quotient resulting from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// out2 : ndarray -// Element-wise remainder from floor division. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent to Python's ``//`` operator. -// remainder : Equivalent to Python's ``%`` operator. -// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return -// values switched. -// -// Examples -// -------- -// >>> np.divmod(np.arange(5), 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -// The `divmod` function can be used as a shorthand for ``np.divmod`` on -// ndarrays. -// -// >>> x = np.arange(5) -// >>> divmod(x, 3) -// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) -// -//go:linkname Divmod py.divmod -func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the distance between x and the nearest adjacent number. -// -// Parameters -// ---------- -// x : array_like -// Values to find the spacing of. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The spacing of values of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// It can be considered as a generalization of EPS: -// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there -// should not be any representable number between ``x + spacing(x)`` and -// x for any finite x. -// -// Spacing of +- inf and NaN is NaN. -// -// Examples -// -------- -// >>> np.spacing(1) == np.finfo(np.float64).eps -// True -// -//go:linkname Spacing py.spacing -func Spacing(x *py.Object, out *py.Object) *py.Object -// -// View inputs as arrays with at least two dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted -// to arrays. Arrays that already have two or more dimensions are -// preserved. -// -// Returns -// ------- -// res, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 2``. -// Copies are avoided where possible, and views with two or more -// dimensions are returned. -// -// See Also -// -------- -// atleast_1d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_2d(3.0) -// array([[3.]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_2d(x) -// array([[0., 1., 2.]]) -// >>> np.atleast_2d(x).base is x -// True -// -// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) -// [array([[1]]), array([[1, 2]]), array([[1, 2]])] -// -// -// -//go:linkname Atleast2d py.atleast_2d -func Atleast2d(__llgo_va_list ...interface{}) *py.Object -// -// Return an array copy of the given object. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the copy. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. (Note that this function and :meth:`ndarray.copy` are very -// similar, but have different default values for their order= -// arguments.) -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise the -// returned array will be forced to be a base-class array (defaults to False). -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// arr : ndarray -// Array interpretation of `a`. -// -// See Also -// -------- -// ndarray.copy : Preferred method for creating an array copy -// -// Notes -// ----- -// This is equivalent to: -// -// >>> np.array(a, copy=True) #doctest: +SKIP -// -// Examples -// -------- -// Create an array x, with a reference y and a copy z: -// -// >>> x = np.array([1, 2, 3]) -// >>> y = x -// >>> z = np.copy(x) -// -// Note that, when we modify x, y changes, but not z: -// -// >>> x[0] = 10 -// >>> x[0] == y[0] -// True -// >>> x[0] == z[0] -// False -// -// Note that, np.copy clears previously set WRITEABLE=False flag. -// -// >>> a = np.array([1, 2, 3]) -// >>> a.flags["WRITEABLE"] = False -// >>> b = np.copy(a) -// >>> b.flags["WRITEABLE"] -// True -// >>> b[0] = 3 -// >>> b -// array([3, 2, 3]) -// -// Note that np.copy is a shallow copy and will not copy object -// elements within arrays. This is mainly important for arrays -// containing Python objects. The new array will contain the -// same object which may lead to surprises if that object can -// be modified (is mutable): -// -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> b = np.copy(a) -// >>> b[2][0] = 10 -// >>> a -// array([1, 'm', list([10, 3, 4])], dtype=object) -// -// To ensure all elements within an ``object`` array are copied, -// use `copy.deepcopy`: -// -// >>> import copy -// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) -// >>> c = copy.deepcopy(a) -// >>> c[2][0] = 10 -// >>> c -// array([1, 'm', list([10, 3, 4])], dtype=object) -// >>> a -// array([1, 'm', list([2, 3, 4])], dtype=object) -// -// -// -//go:linkname Copy py.copy -func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object -// ascontiguousarray(a, dtype=None, *, like=None) -// -// Return a contiguous array (ndim >= 1) in memory (C order). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// Data-type of returned array. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Contiguous array of same shape and content as `a`, with type `dtype` -// if specified. -// -// See Also -// -------- -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Calling ``ascontiguousarray`` makes a C-contiguous copy: -// -// >>> y = np.ascontiguousarray(x) -// >>> y.flags['C_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Then, calling ``ascontiguousarray`` returns the same object: -// -// >>> y = np.ascontiguousarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Ascontiguousarray py.ascontiguousarray -func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object -// promote_types(type1, type2) -// -// Returns the data type with the smallest size and smallest scalar -// kind to which both ``type1`` and ``type2`` may be safely cast. -// The returned data type is always considered "canonical", this mainly -// means that the promoted dtype will always be in native byte order. -// -// This function is symmetric, but rarely associative. -// -// Parameters -// ---------- -// type1 : dtype or dtype specifier -// First data type. -// type2 : dtype or dtype specifier -// Second data type. -// -// Returns -// ------- -// out : dtype -// The promoted data type. -// -// Notes -// ----- -// Please see `numpy.result_type` for additional information about promotion. -// -// .. versionadded:: 1.6.0 -// -// Starting in NumPy 1.9, promote_types function now returns a valid string -// length when given an integer or float dtype as one argument and a string -// dtype as another argument. Previously it always returned the input string -// dtype, even if it wasn't long enough to store the max integer/float value -// converted to a string. -// -// .. versionchanged:: 1.23.0 -// -// NumPy now supports promotion for more structured dtypes. It will now -// remove unnecessary padding from a structure dtype and promote included -// fields individually. -// -// See Also -// -------- -// result_type, dtype, can_cast -// -// Examples -// -------- -// >>> np.promote_types('f4', 'f8') -// dtype('float64') -// -// >>> np.promote_types('i8', 'f4') -// dtype('float64') -// -// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') -// dtype('S11') -// -// An example of a non-associative case: -// -// >>> p = np.promote_types -// >>> p('S', p('i1', 'u1')) -// dtype('S6') -// >>> p(p('S', 'i1'), 'u1') -// dtype('S4') -// -//go:linkname PromoteTypes py.promote_types -func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object -// -// Return an array of zeros with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.zeros_like(x) -// array([[0, 0, 0], -// [0, 0, 0]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.zeros_like(y) -// array([0., 0., 0.]) -// -// -// -//go:linkname ZerosLike py.zeros_like -func ZerosLike(__llgo_va_list ...interface{}) *py.Object -// -// may_share_memory(a, b, /, max_work=None) -// -// Determine if two arrays might share memory -// -// A return of True does not necessarily mean that the two arrays -// share any element. It just means that they *might*. -// -// Only the memory bounds of a and b are checked by default. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem. See -// `shares_memory` for details. Default for ``may_share_memory`` -// is to do a bounds check. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// shares_memory -// -// Examples -// -------- -// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) -// False -// >>> x = np.zeros([3, 4]) -// >>> np.may_share_memory(x[:,0], x[:,1]) -// True -// -// -// -//go:linkname MayShareMemory py.may_share_memory -func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Sum of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Elements to sum. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a sum is performed. The default, -// axis=None, will sum all of the elements of the input array. If -// axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a sum is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// dtype : dtype, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. The dtype of `a` is used by default unless `a` -// has an integer dtype of less precision than the default platform -// integer. In that case, if `a` is signed then the platform integer -// is used while if `a` is unsigned then an unsigned integer of the -// same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `sum` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// sum_along_axis : ndarray -// An array with the same shape as `a`, with the specified -// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar -// is returned. If an output array is specified, a reference to -// `out` is returned. -// -// See Also -// -------- -// ndarray.sum : Equivalent method. -// -// add.reduce : Equivalent functionality of `add`. -// -// cumsum : Cumulative sum of array elements. -// -// trapz : Integration of array values using the composite trapezoidal rule. -// -// mean, average -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// The sum of an empty array is the neutral element 0: -// -// >>> np.sum([]) -// 0.0 -// -// For floating point numbers the numerical precision of sum (and -// ``np.add.reduce``) is in general limited by directly adding each number -// individually to the result causing rounding errors in every step. -// However, often numpy will use a numerically better approach (partial -// pairwise summation) leading to improved precision in many use-cases. -// This improved precision is always provided when no ``axis`` is given. -// When ``axis`` is given, it will depend on which axis is summed. -// Technically, to provide the best speed possible, the improved precision -// is only used when the summation is along the fast axis in memory. -// Note that the exact precision may vary depending on other parameters. -// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but -// more precise approach to summation. -// Especially when summing a large number of lower precision floating point -// numbers, such as ``float32``, numerical errors can become significant. -// In such cases it can be advisable to use `dtype="float64"` to use a higher -// precision for the output. -// -// Examples -// -------- -// >>> np.sum([0.5, 1.5]) -// 2.0 -// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) -// 1 -// >>> np.sum([[0, 1], [0, 5]]) -// 6 -// >>> np.sum([[0, 1], [0, 5]], axis=0) -// array([0, 6]) -// >>> np.sum([[0, 1], [0, 5]], axis=1) -// array([1, 5]) -// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) -// array([1., 5.]) -// -// If the accumulator is too small, overflow occurs: -// -// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) -// -128 -// -// You can also start the sum with a value other than zero: -// -// >>> np.sum([10], initial=5) -// 15 -// -// -//go:linkname Sum py.sum -func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. -// -// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is -// the signed angle in radians between the ray ending at the origin and -// passing through the point (1,0), and the ray ending at the origin and -// passing through the point (`x2`, `x1`). (Note the role reversal: the -// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" -// is the second.) By IEEE convention, this function is defined for -// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see -// Notes for specific values). -// -// This function is not defined for complex-valued arguments; for the -// so-called argument of complex values, use `angle`. -// -// Parameters -// ---------- -// x1 : array_like, real-valued -// `y`-coordinates. -// x2 : array_like, real-valued -// `x`-coordinates. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// Array of angles in radians, in the range ``[-pi, pi]``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// arctan, tan, angle -// -// Notes -// ----- -// *arctan2* is identical to the `atan2` function of the underlying -// C library. The following special values are defined in the C -// standard: [1]_ -// -// ====== ====== ================ -// `x1` `x2` `arctan2(x1,x2)` -// ====== ====== ================ -// +/- 0 +0 +/- 0 -// +/- 0 -0 +/- pi -// > 0 +/-inf +0 / +pi -// < 0 +/-inf -0 / -pi -// +/-inf +inf +/- (pi/4) -// +/-inf -inf +/- (3*pi/4) -// ====== ====== ================ -// -// Note that +0 and -0 are distinct floating point numbers, as are +inf -// and -inf. -// -// References -// ---------- -// .. [1] ISO/IEC standard 9899:1999, "Programming language C." -// -// Examples -// -------- -// Consider four points in different quadrants: -// -// >>> x = np.array([-1, +1, +1, -1]) -// >>> y = np.array([-1, -1, +1, +1]) -// >>> np.arctan2(y, x) * 180 / np.pi -// array([-135., -45., 45., 135.]) -// -// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 -// and at several other special points, obtaining values in -// the range ``[-pi, pi]``: -// -// >>> np.arctan2([1., -1.], [0., 0.]) -// array([ 1.57079633, -1.57079633]) -// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) -// array([0. , 3.14159265, 0.78539816]) -// -//go:linkname Arctan2 py.arctan2 -func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set printing options. -// -// These options determine the way floating point numbers, arrays and -// other NumPy objects are displayed. -// -// Parameters -// ---------- -// precision : int or None, optional -// Number of digits of precision for floating point output (default 8). -// May be None if `floatmode` is not `fixed`, to print as many digits as -// necessary to uniquely specify the value. -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr (default 1000). -// To always use the full repr without summarization, pass `sys.maxsize`. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension (default 3). -// linewidth : int, optional -// The number of characters per line for the purpose of inserting -// line breaks (default 75). -// suppress : bool, optional -// If True, always print floating point numbers using fixed point -// notation, in which case numbers equal to zero in the current precision -// will print as zero. If False, then scientific notation is used when -// absolute value of the smallest number is < 1e-4 or the ratio of the -// maximum absolute value to the minimum is > 1e3. The default is False. -// nanstr : str, optional -// String representation of floating point not-a-number (default nan). -// infstr : str, optional -// String representation of floating point infinity (default inf). -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. (default '-') -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// - 'object' : `np.object_` arrays -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. Can take the following values -// (default maxprec_equal): -// -// * 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// * 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// * 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// * 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. This also -// enables 1.21 legacy printing mode (described below). -// -// If set to the string `'1.21'` enables 1.21 legacy printing mode. This -// approximates numpy 1.21 print output of complex structured dtypes -// by not inserting spaces after commas that separate fields and after -// colons. -// -// If set to `False`, disables legacy mode. -// -// Unrecognized strings will be ignored with a warning for forward -// compatibility. -// -// .. versionadded:: 1.14.0 -// .. versionchanged:: 1.22.0 -// -// See Also -// -------- -// get_printoptions, printoptions, set_string_function, array2string -// -// Notes -// ----- -// `formatter` is always reset with a call to `set_printoptions`. -// -// Use `printoptions` as a context manager to set the values temporarily. -// -// Examples -// -------- -// Floating point precision can be set: -// -// >>> np.set_printoptions(precision=4) -// >>> np.array([1.123456789]) -// [1.1235] -// -// Long arrays can be summarised: -// -// >>> np.set_printoptions(threshold=5) -// >>> np.arange(10) -// array([0, 1, 2, ..., 7, 8, 9]) -// -// Small results can be suppressed: -// -// >>> eps = np.finfo(float).eps -// >>> x = np.arange(4.) -// >>> x**2 - (x + eps)**2 -// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) -// >>> np.set_printoptions(suppress=True) -// >>> x**2 - (x + eps)**2 -// array([-0., -0., 0., 0.]) -// -// A custom formatter can be used to display array elements as desired: -// -// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) -// >>> x = np.arange(3) -// >>> x -// array([int: 0, int: -1, int: -2]) -// >>> np.set_printoptions() # formatter gets reset -// >>> x -// array([0, 1, 2]) -// -// To put back the default options, you can use: -// -// >>> np.set_printoptions(edgeitems=3, infstr='inf', -// ... linewidth=75, nanstr='nan', precision=8, -// ... suppress=False, threshold=1000, formatter=None) -// -// Also to temporarily override options, use `printoptions` as a context manager: -// -// >>> with np.printoptions(precision=2, suppress=True, threshold=5): -// ... np.linspace(0, 10, 10) -// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) -// -// -// -//go:linkname SetPrintoptions py.set_printoptions -func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object -// -// Compute the median along the specified axis. -// -// Returns the median of the array elements. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `arr`. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i -// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the -// two middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.median(a) -// 3.5 -// >>> np.median(a, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.median(a, axis=1) -// array([7., 2.]) -// >>> m = np.median(a, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.median(a, axis=0, out=m) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.median(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.median(b, axis=None, overwrite_input=True) -// 3.5 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Median py.median -func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// `y`-coordinate on the unit circle. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// angle : ndarray -// The inverse sine of each element in `x`, in radians and in the -// closed interval ``[-pi/2, pi/2]``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin -// -// Notes -// ----- -// `arcsin` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that :math:`sin(z) = x`. The convention is to -// return the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, *arcsin* always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arcsin` is a complex analytic function that -// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is -// continuous from above on the former and from below on the latter. -// -// The inverse sine is also known as `asin` or sin^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79ff. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// >>> np.arcsin(1) # pi/2 -// 1.5707963267948966 -// >>> np.arcsin(-1) # -pi/2 -// -1.5707963267948966 -// >>> np.arcsin(0) -// 0.0 -// -//go:linkname Arcsin py.arcsin -func Arcsin(x *py.Object, out *py.Object) *py.Object -// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Angles in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in radians. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : Convert angles from radians to degrees. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// ``deg2rad(x)`` is ``x * pi / 180``. -// -// Examples -// -------- -// >>> np.deg2rad(180) -// 3.1415926535897931 -// -//go:linkname Deg2rad py.deg2rad -func Deg2rad(x *py.Object, out *py.Object) *py.Object -// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Decompose the elements of x into mantissa and twos exponent. -// -// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. -// The mantissa lies in the open interval(-1, 1), while the twos -// exponent is a signed integer. -// -// Parameters -// ---------- -// x : array_like -// Array of numbers to be decomposed. -// out1 : ndarray, optional -// Output array for the mantissa. Must have the same shape as `x`. -// out2 : ndarray, optional -// Output array for the exponent. Must have the same shape as `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// mantissa : ndarray -// Floating values between -1 and 1. -// This is a scalar if `x` is a scalar. -// exponent : ndarray -// Integer exponents of 2. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// Examples -// -------- -// >>> x = np.arange(9) -// >>> y1, y2 = np.frexp(x) -// >>> y1 -// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, -// 0.5 ]) -// >>> y2 -// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) -// >>> y1 * 2**y2 -// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) -// -//go:linkname Frexp py.frexp -func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Trim the leading and/or trailing zeros from a 1-D array or sequence. -// -// Parameters -// ---------- -// filt : 1-D array or sequence -// Input array. -// trim : str, optional -// A string with 'f' representing trim from front and 'b' to trim from -// back. Default is 'fb', trim zeros from both front and back of the -// array. -// -// Returns -// ------- -// trimmed : 1-D array or sequence -// The result of trimming the input. The input data type is preserved. -// -// Examples -// -------- -// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) -// >>> np.trim_zeros(a) -// array([1, 2, 3, 0, 2, 1]) -// -// >>> np.trim_zeros(a, 'b') -// array([0, 0, 0, ..., 0, 2, 1]) -// -// The input data type is preserved, list/tuple in means list/tuple out. -// -// >>> np.trim_zeros([0, 1, 2, 0]) -// [1, 2] -// -// -// -//go:linkname TrimZeros py.trim_zeros -func TrimZeros(filt *py.Object, trim *py.Object) *py.Object -// -// Return the Hanning window. -// -// The Hanning window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray, shape(M,) -// The window, with the maximum value normalized to one (the value -// one appears only if `M` is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, kaiser -// -// Notes -// ----- -// The Hanning window is defined as -// -// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hanning was named for Julius von Hann, an Austrian meteorologist. -// It is also known as the Cosine Bell. Some authors prefer that it be -// called a Hann window, to help avoid confusion with the very similar -// Hamming window. -// -// Most references to the Hanning window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 106-108. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hanning(12) -// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, -// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, -// 0.07937323, 0. ]) -// -// Plot the window and its frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hanning(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hann window") -// Text(0.5, 1.0, 'Hann window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of the Hann window") -// Text(0.5, 1.0, 'Frequency response of the Hann window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hanning py.hanning -func Hanning(M *py.Object) *py.Object -// -// Create a two-dimensional array with the flattened input as a diagonal. -// -// Parameters -// ---------- -// v : array_like -// Input data, which is flattened and set as the `k`-th -// diagonal of the output. -// k : int, optional -// Diagonal to set; 0, the default, corresponds to the "main" diagonal, -// a positive (negative) `k` giving the number of the diagonal above -// (below) the main. -// -// Returns -// ------- -// out : ndarray -// The 2-D output array. -// -// See Also -// -------- -// diag : MATLAB work-alike for 1-D and 2-D arrays. -// diagonal : Return specified diagonals. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> np.diagflat([[1,2], [3,4]]) -// array([[1, 0, 0, 0], -// [0, 2, 0, 0], -// [0, 0, 3, 0], -// [0, 0, 0, 4]]) -// -// >>> np.diagflat([1,2], 1) -// array([[0, 1, 0], -// [0, 0, 2], -// [0, 0, 0]]) -// -// -// -//go:linkname Diagflat py.diagflat -func Diagflat(v *py.Object, k *py.Object) *py.Object -// -// Generate a Vandermonde matrix. -// -// The columns of the output matrix are powers of the input vector. The -// order of the powers is determined by the `increasing` boolean argument. -// Specifically, when `increasing` is False, the `i`-th output column is -// the input vector raised element-wise to the power of ``N - i - 1``. Such -// a matrix with a geometric progression in each row is named for Alexandre- -// Theophile Vandermonde. -// -// Parameters -// ---------- -// x : array_like -// 1-D input array. -// N : int, optional -// Number of columns in the output. If `N` is not specified, a square -// array is returned (``N = len(x)``). -// increasing : bool, optional -// Order of the powers of the columns. If True, the powers increase -// from left to right, if False (the default) they are reversed. -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : ndarray -// Vandermonde matrix. If `increasing` is False, the first column is -// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is -// True, the columns are ``x^0, x^1, ..., x^(N-1)``. -// -// See Also -// -------- -// polynomial.polynomial.polyvander -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 5]) -// >>> N = 3 -// >>> np.vander(x, N) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> np.column_stack([x**(N-1-i) for i in range(N)]) -// array([[ 1, 1, 1], -// [ 4, 2, 1], -// [ 9, 3, 1], -// [25, 5, 1]]) -// -// >>> x = np.array([1, 2, 3, 5]) -// >>> np.vander(x) -// array([[ 1, 1, 1, 1], -// [ 8, 4, 2, 1], -// [ 27, 9, 3, 1], -// [125, 25, 5, 1]]) -// >>> np.vander(x, increasing=True) -// array([[ 1, 1, 1, 1], -// [ 1, 2, 4, 8], -// [ 1, 3, 9, 27], -// [ 1, 5, 25, 125]]) -// -// The determinant of a square Vandermonde matrix is the product -// of the differences between the values of the input vector: -// -// >>> np.linalg.det(np.vander(x)) -// 48.000000000000043 # may vary -// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) -// 48 -// -// -// -//go:linkname Vander py.vander -func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object -// -// Return the indices for the upper-triangle of arr. -// -// See `triu_indices` for full details. -// -// Parameters -// ---------- -// arr : ndarray, shape(N, N) -// The indices will be valid for square arrays. -// k : int, optional -// Diagonal offset (see `triu` for details). -// -// Returns -// ------- -// triu_indices_from : tuple, shape(2) of ndarray, shape(N) -// Indices for the upper-triangle of `arr`. -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the upper triangular elements. -// -// >>> triui = np.triu_indices_from(a) -// >>> triui -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// >>> a[triui] -// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) -// -// This is syntactic sugar for triu_indices(). -// -// >>> np.triu_indices(a.shape[0]) -// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) -// -// Use the `k` parameter to return the indices for the upper triangular array -// from the k-th diagonal. -// -// >>> triuim1 = np.triu_indices_from(a, k=1) -// >>> a[triuim1] -// array([ 1, 2, 3, 6, 7, 11]) -// -// -// See Also -// -------- -// triu_indices, triu, tril_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TriuIndicesFrom py.triu_indices_from -func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// set_numeric_ops(op1=func1, op2=func2, ...) -// -// Set numerical operators for array objects. -// -// .. deprecated:: 1.16 -// -// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. -// For ndarray subclasses, define the ``__array_ufunc__`` method and -// override the relevant ufunc. -// -// Parameters -// ---------- -// op1, op2, ... : callable -// Each ``op = func`` pair describes an operator to be replaced. -// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace -// addition by modulus 5 addition. -// -// Returns -// ------- -// saved_ops : list of callables -// A list of all operators, stored before making replacements. -// -// Notes -// ----- -// .. warning:: -// Use with care! Incorrect usage may lead to memory errors. -// -// A function replacing an operator cannot make use of that operator. -// For example, when replacing add, you may not use ``+``. Instead, -// directly call ufuncs. -// -// Examples -// -------- -// >>> def add_mod5(x, y): -// ... return np.add(x, y) % 5 -// ... -// >>> old_funcs = np.set_numeric_ops(add=add_mod5) -// -// >>> x = np.arange(12).reshape((3, 4)) -// >>> x + x -// array([[0, 2, 4, 1], -// [3, 0, 2, 4], -// [1, 3, 0, 2]]) -// -// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators -// -//go:linkname SetNumericOps py.set_numeric_ops -func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object -// -// Test whether any array element along a given axis evaluates to True. -// -// Returns single boolean if `axis` is ``None`` -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical OR reduction is performed. -// The default (``axis=None``) is to perform a logical OR over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output and its type is preserved -// (e.g., if it is of type float, then it will remain so, returning -// 1.0 for True and 0.0 for False, regardless of the type of `a`). -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `any` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for any `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// any : bool or ndarray -// A new boolean or `ndarray` is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.any : equivalent method -// -// all : Test whether all elements along a given axis evaluate to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity evaluate -// to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.any([[True, False], [True, True]]) -// True -// -// >>> np.any([[True, False], [False, False]], axis=0) -// array([ True, False]) -// -// >>> np.any([-1, 0, 5]) -// True -// -// >>> np.any(np.nan) -// True -// -// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) -// False -// -// >>> o=np.array(False) -// >>> z=np.any([-1, 4, 5], out=o) -// >>> z, o -// (array(True), array(True)) -// >>> # Check now that z is a reference to o -// >>> z is o -// True -// >>> id(z), id(o) # identity of z and o # doctest: +SKIP -// (191614240, 191614240) -// -// -// -//go:linkname Any py.any -func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Multiply arguments element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays to be multiplied. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The product of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to `x1` * `x2` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.multiply(2.0, 4.0) -// 8.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.multiply(x1, x2) -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -// The ``*`` operator can be used as a shorthand for ``np.multiply`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 * x2 -// array([[ 0., 1., 4.], -// [ 0., 4., 10.], -// [ 0., 7., 16.]]) -// -//go:linkname Multiply py.multiply -func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the elements of an array that satisfy some condition. -// -// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If -// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. -// -// Note that `place` does the exact opposite of `extract`. -// -// Parameters -// ---------- -// condition : array_like -// An array whose nonzero or True entries indicate the elements of `arr` -// to extract. -// arr : array_like -// Input array of the same size as `condition`. -// -// Returns -// ------- -// extract : ndarray -// Rank 1 array of values from `arr` where `condition` is True. -// -// See Also -// -------- -// take, put, copyto, compress, place -// -// Examples -// -------- -// >>> arr = np.arange(12).reshape((3, 4)) -// >>> arr -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]]) -// >>> condition = np.mod(arr, 3)==0 -// >>> condition -// array([[ True, False, False, True], -// [False, False, True, False], -// [False, True, False, False]]) -// >>> np.extract(condition, arr) -// array([0, 3, 6, 9]) -// -// -// If `condition` is boolean: -// -// >>> arr[condition] -// array([0, 3, 6, 9]) -// -// -// -//go:linkname Extract py.extract -func Extract(condition *py.Object, arr *py.Object) *py.Object -// Convert the input to an array, checking for NaNs or Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. Success requires no NaNs or Infs. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray. If `a` is a subclass of ndarray, a base -// class ndarray is returned. -// -// Raises -// ------ -// ValueError -// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). -// -// See Also -// -------- -// asarray : Create and array. -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array. If all elements are finite -// ``asarray_chkfinite`` is identical to ``asarray``. -// -// >>> a = [1, 2] -// >>> np.asarray_chkfinite(a, dtype=float) -// array([1., 2.]) -// -// Raises ValueError if array_like contains Nans or Infs. -// -// >>> a = [1, 2, np.inf] -// >>> try: -// ... np.asarray_chkfinite(a) -// ... except ValueError: -// ... print('ValueError') -// ... -// ValueError -// -// -// -//go:linkname AsarrayChkfinite py.asarray_chkfinite -func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Extract a diagonal or construct a diagonal array. -// -// See the more detailed documentation for ``numpy.diagonal`` if you use this -// function to extract a diagonal and wish to write to the resulting array; -// whether it returns a copy or a view depends on what version of numpy you -// are using. -// -// Parameters -// ---------- -// v : array_like -// If `v` is a 2-D array, return a copy of its `k`-th diagonal. -// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th -// diagonal. -// k : int, optional -// Diagonal in question. The default is 0. Use `k>0` for diagonals -// above the main diagonal, and `k<0` for diagonals below the main -// diagonal. -// -// Returns -// ------- -// out : ndarray -// The extracted diagonal or constructed diagonal array. -// -// See Also -// -------- -// diagonal : Return specified diagonals. -// diagflat : Create a 2-D array with the flattened input as a diagonal. -// trace : Sum along diagonals. -// triu : Upper triangle of an array. -// tril : Lower triangle of an array. -// -// Examples -// -------- -// >>> x = np.arange(9).reshape((3,3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// -// >>> np.diag(x) -// array([0, 4, 8]) -// >>> np.diag(x, k=1) -// array([1, 5]) -// >>> np.diag(x, k=-1) -// array([3, 7]) -// -// >>> np.diag(np.diag(x)) -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 8]]) -// -// -// -//go:linkname Diag py.diag -func Diag(v *py.Object, k *py.Object) *py.Object -// -// Lower triangle of an array. -// -// Return a copy of an array with elements above the `k`-th diagonal zeroed. -// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two -// axes. -// -// Parameters -// ---------- -// m : array_like, shape (..., M, N) -// Input array. -// k : int, optional -// Diagonal above which to zero elements. `k = 0` (the default) is the -// main diagonal, `k < 0` is below it and `k > 0` is above. -// -// Returns -// ------- -// tril : ndarray, shape (..., M, N) -// Lower triangle of `m`, of same shape and data-type as `m`. -// -// See Also -// -------- -// triu : same thing, only for the upper triangle -// -// Examples -// -------- -// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 0, 0, 0], -// [ 4, 0, 0], -// [ 7, 8, 0], -// [10, 11, 12]]) -// -// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 0, 0, 0, 0], -// [ 5, 6, 0, 0, 0], -// [10, 11, 12, 0, 0], -// [15, 16, 17, 18, 0]], -// [[20, 0, 0, 0, 0], -// [25, 26, 0, 0, 0], -// [30, 31, 32, 0, 0], -// [35, 36, 37, 38, 0]], -// [[40, 0, 0, 0, 0], -// [45, 46, 0, 0, 0], -// [50, 51, 52, 0, 0], -// [55, 56, 57, 58, 0]]]) -// -// -// -//go:linkname Tril py.tril -func Tril(m *py.Object, k *py.Object) *py.Object -// -// Pad an array. -// -// Parameters -// ---------- -// array : array_like of rank N -// The array to pad. -// pad_width : {sequence, array_like, int} -// Number of values padded to the edges of each axis. -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths -// for each axis. -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after pad for each axis. -// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width -// for all axes. -// mode : str or function, optional -// One of the following string values or a user supplied function. -// -// 'constant' (default) -// Pads with a constant value. -// 'edge' -// Pads with the edge values of array. -// 'linear_ramp' -// Pads with the linear ramp between end_value and the -// array edge value. -// 'maximum' -// Pads with the maximum value of all or part of the -// vector along each axis. -// 'mean' -// Pads with the mean value of all or part of the -// vector along each axis. -// 'median' -// Pads with the median value of all or part of the -// vector along each axis. -// 'minimum' -// Pads with the minimum value of all or part of the -// vector along each axis. -// 'reflect' -// Pads with the reflection of the vector mirrored on -// the first and last values of the vector along each -// axis. -// 'symmetric' -// Pads with the reflection of the vector mirrored -// along the edge of the array. -// 'wrap' -// Pads with the wrap of the vector along the axis. -// The first values are used to pad the end and the -// end values are used to pad the beginning. -// 'empty' -// Pads with undefined values. -// -// .. versionadded:: 1.17 -// -// -// Padding function, see Notes. -// stat_length : sequence or int, optional -// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of -// values at edge of each axis used to calculate the statistic value. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic -// lengths for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after statistic lengths for each axis. -// -// ``(stat_length,)`` or ``int`` is a shortcut for -// ``before = after = statistic`` length for all axes. -// -// Default is ``None``, to use the entire axis. -// constant_values : sequence or scalar, optional -// Used in 'constant'. The values to set the padded values for each -// axis. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after constants for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// end_values : sequence or scalar, optional -// Used in 'linear_ramp'. The values used for the ending value of the -// linear_ramp and that will form the edge of the padded array. -// -// ``((before_1, after_1), ... (before_N, after_N))`` unique end values -// for each axis. -// -// ``(before, after)`` or ``((before, after),)`` yields same before -// and after end values for each axis. -// -// ``(constant,)`` or ``constant`` is a shortcut for -// ``before = after = constant`` for all axes. -// -// Default is 0. -// reflect_type : {'even', 'odd'}, optional -// Used in 'reflect', and 'symmetric'. The 'even' style is the -// default with an unaltered reflection around the edge value. For -// the 'odd' style, the extended part of the array is created by -// subtracting the reflected values from two times the edge value. -// -// Returns -// ------- -// pad : ndarray -// Padded array of rank equal to `array` with shape increased -// according to `pad_width`. -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For an array with rank greater than 1, some of the padding of later -// axes is calculated from padding of previous axes. This is easiest to -// think about with a rank 2 array where the corners of the padded array -// are calculated by using padded values from the first axis. -// -// The padding function, if used, should modify a rank 1 array in-place. It -// has the following signature:: -// -// padding_func(vector, iaxis_pad_width, iaxis, kwargs) -// -// where -// -// vector : ndarray -// A rank 1 array already padded with zeros. Padded values are -// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. -// iaxis_pad_width : tuple -// A 2-tuple of ints, iaxis_pad_width[0] represents the number of -// values padded at the beginning of vector where -// iaxis_pad_width[1] represents the number of values padded at -// the end of vector. -// iaxis : int -// The axis currently being calculated. -// kwargs : dict -// Any keyword arguments the function requires. -// -// Examples -// -------- -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) -// array([4, 4, 1, ..., 6, 6, 6]) -// -// >>> np.pad(a, (2, 3), 'edge') -// array([1, 1, 1, ..., 5, 5, 5]) -// -// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) -// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) -// -// >>> np.pad(a, (2,), 'maximum') -// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) -// -// >>> np.pad(a, (2,), 'mean') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> np.pad(a, (2,), 'median') -// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) -// -// >>> a = [[1, 2], [3, 4]] -// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') -// array([[1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1], -// [3, 3, 3, 4, 3, 3, 3], -// [1, 1, 1, 2, 1, 1, 1], -// [1, 1, 1, 2, 1, 1, 1]]) -// -// >>> a = [1, 2, 3, 4, 5] -// >>> np.pad(a, (2, 3), 'reflect') -// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) -// -// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') -// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// >>> np.pad(a, (2, 3), 'symmetric') -// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) -// -// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') -// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) -// -// >>> np.pad(a, (2, 3), 'wrap') -// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) -// -// >>> def pad_with(vector, pad_width, iaxis, kwargs): -// ... pad_value = kwargs.get('padder', 10) -// ... vector[:pad_width[0]] = pad_value -// ... vector[-pad_width[1]:] = pad_value -// >>> a = np.arange(6) -// >>> a = a.reshape((2, 3)) -// >>> np.pad(a, 2, pad_with) -// array([[10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 0, 1, 2, 10, 10], -// [10, 10, 3, 4, 5, 10, 10], -// [10, 10, 10, 10, 10, 10, 10], -// [10, 10, 10, 10, 10, 10, 10]]) -// >>> np.pad(a, 2, pad_with, padder=100) -// array([[100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 0, 1, 2, 100, 100], -// [100, 100, 3, 4, 5, 100, 100], -// [100, 100, 100, 100, 100, 100, 100], -// [100, 100, 100, 100, 100, 100, 100]]) -// -// -//go:linkname Pad py.pad -func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object -// -// vdot(a, b, /) -// -// Return the dot product of two vectors. -// -// The vdot(`a`, `b`) function handles complex numbers differently than -// dot(`a`, `b`). If the first argument is complex the complex conjugate -// of the first argument is used for the calculation of the dot product. -// -// Note that `vdot` handles multidimensional arrays differently than `dot`: -// it does *not* perform a matrix product, but flattens input arguments -// to 1-D vectors first. Consequently, it should only be used for vectors. -// -// Parameters -// ---------- -// a : array_like -// If `a` is complex the complex conjugate is taken before calculation -// of the dot product. -// b : array_like -// Second argument to the dot product. -// -// Returns -// ------- -// output : ndarray -// Dot product of `a` and `b`. Can be an int, float, or -// complex depending on the types of `a` and `b`. -// -// See Also -// -------- -// dot : Return the dot product without using the complex conjugate of the -// first argument. -// -// Examples -// -------- -// >>> a = np.array([1+2j,3+4j]) -// >>> b = np.array([5+6j,7+8j]) -// >>> np.vdot(a, b) -// (70-8j) -// >>> np.vdot(b, a) -// (70+8j) -// -// Note that higher-dimensional arrays are flattened! -// -// >>> a = np.array([[1, 4], [5, 6]]) -// >>> b = np.array([[4, 1], [2, 2]]) -// >>> np.vdot(a, b) -// 30 -// >>> np.vdot(b, a) -// 30 -// >>> 1*4 + 4*1 + 5*2 + 6*2 -// 30 -// -// -// -//go:linkname Vdot py.vdot -func Vdot(a *py.Object, b *py.Object) *py.Object -// -// Replaces specified elements of an array with given values. -// -// The indexing works on the flattened target array. `put` is roughly -// equivalent to: -// -// :: -// -// a.flat[ind] = v -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// ind : array_like -// Target indices, interpreted as integers. -// v : array_like -// Values to place in `a` at target indices. If `v` is shorter than -// `ind` it will be repeated as necessary. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. In 'raise' mode, -// if an exception occurs the target array may still be modified. -// -// See Also -// -------- -// putmask, place -// put_along_axis : Put elements by matching the array and the index arrays -// -// Examples -// -------- -// >>> a = np.arange(5) -// >>> np.put(a, [0, 2], [-44, -55]) -// >>> a -// array([-44, 1, -55, 3, 4]) -// -// >>> a = np.arange(5) -// >>> np.put(a, 22, -5, mode='clip') -// >>> a -// array([ 0, 1, 2, 3, -5]) -// -// -// -//go:linkname Put py.put -func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Return the size of the buffer used in ufuncs. -// -// Returns -// ------- -// getbufsize : int -// Size of ufunc buffer in bytes. -// -// -// -//go:linkname Getbufsize py.getbufsize -func Getbufsize() *py.Object -// -// Convert inputs to arrays with at least one dimension. -// -// Scalar inputs are converted to 1-dimensional arrays, whilst -// higher-dimensional inputs are preserved. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more input arrays. -// -// Returns -// ------- -// ret : ndarray -// An array, or list of arrays, each with ``a.ndim >= 1``. -// Copies are made only if necessary. -// -// See Also -// -------- -// atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> np.atleast_1d(1.0) -// array([1.]) -// -// >>> x = np.arange(9.0).reshape(3,3) -// >>> np.atleast_1d(x) -// array([[0., 1., 2.], -// [3., 4., 5.], -// [6., 7., 8.]]) -// >>> np.atleast_1d(x) is x -// True -// -// >>> np.atleast_1d(1, [3, 4]) -// [array([1]), array([3, 4])] -// -// -// -//go:linkname Atleast1d py.atleast_1d -func Atleast1d(__llgo_va_list ...interface{}) *py.Object -// -// View inputs as arrays with at least three dimensions. -// -// Parameters -// ---------- -// arys1, arys2, ... : array_like -// One or more array-like sequences. Non-array inputs are converted to -// arrays. Arrays that already have three or more dimensions are -// preserved. -// -// Returns -// ------- -// res1, res2, ... : ndarray -// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are -// avoided where possible, and views with three or more dimensions are -// returned. For example, a 1-D array of shape ``(N,)`` becomes a view -// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a -// view of shape ``(M, N, 1)``. -// -// See Also -// -------- -// atleast_1d, atleast_2d -// -// Examples -// -------- -// >>> np.atleast_3d(3.0) -// array([[[3.]]]) -// -// >>> x = np.arange(3.0) -// >>> np.atleast_3d(x).shape -// (1, 3, 1) -// -// >>> x = np.arange(12.0).reshape(4,3) -// >>> np.atleast_3d(x).shape -// (4, 3, 1) -// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself -// True -// -// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): -// ... print(arr, arr.shape) # doctest: +SKIP -// ... -// [[[1] -// [2]]] (1, 2, 1) -// [[[1] -// [2]]] (1, 2, 1) -// [[[1 2]]] (1, 1, 2) -// -// -// -//go:linkname Atleast3d py.atleast_3d -func Atleast3d(__llgo_va_list ...interface{}) *py.Object -// -// Stack arrays in sequence depth wise (along third axis). -// -// This is equivalent to concatenation along the third axis after 2-D arrays -// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape -// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by -// `dsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of arrays -// The arrays must have the same shape along all but the third axis. -// 1-D or 2-D arrays must have the same shape. -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 3-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// dsplit : Split array along third axis. -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.dstack((a,b)) -// array([[[1, 2], -// [2, 3], -// [3, 4]]]) -// -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[2],[3],[4]]) -// >>> np.dstack((a,b)) -// array([[[1, 2]], -// [[2, 3]], -// [[3, 4]]]) -// -// -// -//go:linkname Dstack py.dstack -func Dstack(tup *py.Object) *py.Object -// Find the wrapper for the array with the highest priority. -// -// In case of ties, leftmost wins. If no wrapper is found, return None -// -// -//go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object -// -// Broadcast any number of arrays against each other. -// -// Parameters -// ---------- -// `*args` : array_likes -// The arrays to broadcast. -// -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned arrays will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcasted : list of arrays -// These arrays are views on the original arrays. They are typically -// not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. If you need -// to write to the arrays, make copies first. While you can set the -// ``writable`` flag True, writing to a single output value may end up -// changing more than one location in the output array. -// -// .. deprecated:: 1.17 -// The output is currently marked so that if written to, a deprecation -// warning will be emitted. A future version will set the -// ``writable`` flag False so writing to it will raise an error. -// -// See Also -// -------- -// broadcast -// broadcast_to -// broadcast_shapes -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> y = np.array([[4],[5]]) -// >>> np.broadcast_arrays(x, y) -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// Here is a useful idiom for getting contiguous copies instead of -// non-contiguous views. -// -// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] -// [array([[1, 2, 3], -// [1, 2, 3]]), array([[4, 4, 4], -// [5, 5, 5]])] -// -// -// -//go:linkname BroadcastArrays py.broadcast_arrays -func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object -// -// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") -// -// Join a sequence of arrays along an existing axis. -// -// Parameters -// ---------- -// a1, a2, ... : sequence of array_like -// The arrays must have the same shape, except in the dimension -// corresponding to `axis` (the first, by default). -// axis : int, optional -// The axis along which the arrays will be joined. If axis is None, -// arrays are flattened before use. Default is 0. -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what concatenate would have returned if no -// out argument were specified. -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.20.0 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// res : ndarray -// The concatenated array. -// -// See Also -// -------- -// ma.concatenate : Concatenate function that preserves input masks. -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. -// split : Split array into a list of multiple sub-arrays of equal size. -// hsplit : Split array into multiple sub-arrays horizontally (column wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// stack : Stack a sequence of arrays along a new axis. -// block : Assemble arrays from blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// -// Notes -// ----- -// When one or more of the arrays to be concatenated is a MaskedArray, -// this function will return a MaskedArray object instead of an ndarray, -// but the input masks are *not* preserved. In cases where a MaskedArray -// is expected as input, use the ma.concatenate function from the masked -// array module instead. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> b = np.array([[5, 6]]) -// >>> np.concatenate((a, b), axis=0) -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// >>> np.concatenate((a, b.T), axis=1) -// array([[1, 2, 5], -// [3, 4, 6]]) -// >>> np.concatenate((a, b), axis=None) -// array([1, 2, 3, 4, 5, 6]) -// -// This function will not preserve masking of MaskedArray inputs. -// -// >>> a = np.ma.arange(3) -// >>> a[1] = np.ma.masked -// >>> b = np.arange(2, 5) -// >>> a -// masked_array(data=[0, --, 2], -// mask=[False, True, False], -// fill_value=999999) -// >>> b -// array([2, 3, 4]) -// >>> np.concatenate([a, b]) -// masked_array(data=[0, 1, 2, 2, 3, 4], -// mask=False, -// fill_value=999999) -// >>> np.ma.concatenate([a, b]) -// masked_array(data=[0, --, 2, 2, 3, 4], -// mask=[False, True, False, False, False, False], -// fill_value=999999) -// -// -// -//go:linkname Concatenate py.concatenate -func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object -// -// can_cast(from_, to, casting='safe') -// -// Returns True if cast between data types can occur according to the -// casting rule. If from is a scalar or array scalar, also returns -// True if the scalar value can be cast without overflow or truncation -// to an integer. -// -// Parameters -// ---------- -// from_ : dtype, dtype specifier, scalar, or array -// Data type, scalar, or array to cast from. -// to : dtype or dtype specifier -// Data type to cast to. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Returns -// ------- -// out : bool -// True if cast can occur according to the casting rule. -// -// Notes -// ----- -// .. versionchanged:: 1.17.0 -// Casting between a simple data type and a structured one is possible only -// for "unsafe" casting. Casting to multiple fields is allowed, but -// casting from multiple fields is not. -// -// .. versionchanged:: 1.9.0 -// Casting from numeric to string types in 'safe' casting mode requires -// that the string dtype length is long enough to store the maximum -// integer/float value converted. -// -// See also -// -------- -// dtype, result_type -// -// Examples -// -------- -// Basic examples -// -// >>> np.can_cast(np.int32, np.int64) -// True -// >>> np.can_cast(np.float64, complex) -// True -// >>> np.can_cast(complex, float) -// False -// -// >>> np.can_cast('i8', 'f8') -// True -// >>> np.can_cast('i8', 'f4') -// False -// >>> np.can_cast('i4', 'S4') -// False -// -// Casting scalars -// -// >>> np.can_cast(100, 'i1') -// True -// >>> np.can_cast(150, 'i1') -// False -// >>> np.can_cast(150, 'u1') -// True -// -// >>> np.can_cast(3.5e100, np.float32) -// False -// >>> np.can_cast(1000.0, np.float32) -// True -// -// Array scalar checks the value, array does not -// -// >>> np.can_cast(np.array(1000.0), np.float32) -// True -// >>> np.can_cast(np.array([1000.0]), np.float32) -// False -// -// Using the casting rules -// -// >>> np.can_cast('i8', 'i8', 'no') -// True -// >>> np.can_cast('i8', 'no') -// False -// -// >>> np.can_cast('i8', 'equiv') -// True -// >>> np.can_cast('i8', 'equiv') -// False -// -// >>> np.can_cast('i8', 'safe') -// True -// >>> np.can_cast('i4', 'safe') -// False -// -// >>> np.can_cast('i4', 'same_kind') -// True -// >>> np.can_cast('u4', 'same_kind') -// False -// -// >>> np.can_cast('u4', 'unsafe') -// True -// -// -// -//go:linkname CanCast py.can_cast -func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object -// -// Return the identity array. -// -// The identity array is a square array with ones on -// the main diagonal. -// -// Parameters -// ---------- -// n : int -// Number of rows (and columns) in `n` x `n` output. -// dtype : data-type, optional -// Data-type of the output. Defaults to ``float``. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// `n` x `n` array with its main diagonal set to one, -// and all other elements 0. -// -// Examples -// -------- -// >>> np.identity(3) -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// -// -//go:linkname Identity py.identity -func Identity(n *py.Object, dtype *py.Object) *py.Object -// -// Remove axes of length one from `a`. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// .. versionadded:: 1.7.0 -// -// Selects a subset of the entries of length one in the -// shape. If an axis is selected with shape entry greater than -// one, an error is raised. -// -// Returns -// ------- -// squeezed : ndarray -// The input array, but with all or a subset of the -// dimensions of length 1 removed. This is always `a` itself -// or a view into `a`. Note that if all axes are squeezed, -// the result is a 0d array and not a scalar. -// -// Raises -// ------ -// ValueError -// If `axis` is not None, and an axis being squeezed is not of length 1 -// -// See Also -// -------- -// expand_dims : The inverse operation, adding entries of length one -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// -// Examples -// -------- -// >>> x = np.array([[[0], [1], [2]]]) -// >>> x.shape -// (1, 3, 1) -// >>> np.squeeze(x).shape -// (3,) -// >>> np.squeeze(x, axis=0).shape -// (3, 1) -// >>> np.squeeze(x, axis=1).shape -// Traceback (most recent call last): -// ... -// ValueError: cannot select an axis to squeeze out which has size not equal to one -// >>> np.squeeze(x, axis=2).shape -// (1, 3) -// >>> x = np.array([[1234]]) -// >>> x.shape -// (1, 1) -// >>> np.squeeze(x) -// array(1234) # 0d array -// >>> np.squeeze(x).shape -// () -// >>> np.squeeze(x)[()] -// 1234 -// -// -// -//go:linkname Squeeze py.squeeze -func Squeeze(a *py.Object, axis *py.Object) *py.Object -// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic cosine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array of same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.cosh(0) -// 1.0 -// -// The hyperbolic cosine describes the shape of a hanging cable: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 1000) -// >>> plt.plot(x, np.cosh(x)) -// >>> plt.show() -// -//go:linkname Cosh py.cosh -func Cosh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices for the lower-triangle of arr. -// -// See `tril_indices` for full details. -// -// Parameters -// ---------- -// arr : array_like -// The indices will be valid for square arrays whose dimensions are -// the same as arr. -// k : int, optional -// Diagonal offset (see `tril` for details). -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Pass the array to get the indices of the lower triangular elements. -// -// >>> trili = np.tril_indices_from(a) -// >>> trili -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// >>> a[trili] -// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) -// -// This is syntactic sugar for tril_indices(). -// -// >>> np.tril_indices(a.shape[0]) -// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) -// -// Use the `k` parameter to return the indices for the lower triangular array -// up to the k-th diagonal. -// -// >>> trili1 = np.tril_indices_from(a, k=1) -// >>> a[trili1] -// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) -// -// See Also -// -------- -// tril_indices, tril, triu_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// -// -//go:linkname TrilIndicesFrom py.tril_indices_from -func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object -// -// Difference (subtraction) of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. -// `a1` and `a2` can be either array_like sequences of the polynomials' -// coefficients (including coefficients equal to zero), or `poly1d` objects. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d -// Minuend and subtrahend polynomials, respectively. -// -// Returns -// ------- -// out : ndarray or poly1d -// Array or `poly1d` object of the difference polynomial's coefficients. -// -// See Also -// -------- -// polyval, polydiv, polymul, polyadd -// -// Examples -// -------- -// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) -// -// >>> np.polysub([2, 10, -2], [3, 10, -4]) -// array([-1, 0, 2]) -// -// -// -//go:linkname Polysub py.polysub -func Polysub(a1 *py.Object, a2 *py.Object) *py.Object -// -// Counts the number of non-zero values in the array ``a``. -// -// The word "non-zero" is in reference to the Python 2.x -// built-in method ``__nonzero__()`` (renamed ``__bool__()`` -// in Python 3.x) of Python objects that tests an object's -// "truthfulness". For example, any number is considered -// truthful if it is nonzero, whereas any string is considered -// truthful if it is not the empty string. Thus, this function -// (recursively) counts how many elements in ``a`` (and in -// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` -// method evaluated to ``True``. -// -// Parameters -// ---------- -// a : array_like -// The array for which to count non-zeros. -// axis : int or tuple, optional -// Axis or tuple of axes along which to count non-zeros. -// Default is None, meaning that non-zeros will be counted -// along a flattened version of ``a``. -// -// .. versionadded:: 1.12.0 -// -// keepdims : bool, optional -// If this is set to True, the axes that are counted are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// count : int or array of int -// Number of non-zero values in the array along a given axis. -// Otherwise, the total number of non-zero values in the array -// is returned. -// -// See Also -// -------- -// nonzero : Return the coordinates of all the non-zero values. -// -// Examples -// -------- -// >>> np.count_nonzero(np.eye(4)) -// 4 -// >>> a = np.array([[0, 1, 7, 0], -// ... [3, 0, 2, 19]]) -// >>> np.count_nonzero(a) -// 5 -// >>> np.count_nonzero(a, axis=0) -// array([1, 1, 2, 1]) -// >>> np.count_nonzero(a, axis=1) -// array([2, 3]) -// >>> np.count_nonzero(a, axis=1, keepdims=True) -// array([[2], -// [3]]) -// -// -//go:linkname CountNonzero py.count_nonzero -func CountNonzero(a *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// .. deprecated:: 1.25.0 -// ``product`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `prod` instead. -// -// See Also -// -------- -// prod : equivalent function; see for details. -// -// -//go:linkname Product py.product -func Product(__llgo_va_list ...interface{}) *py.Object -// -// Round an array to the given number of decimals. -// -// `~numpy.round_` is a disrecommended backwards-compatibility -// alias of `~numpy.around` and `~numpy.round`. -// -// .. deprecated:: 1.25.0 -// ``round_`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `round` instead. -// -// See Also -// -------- -// around : equivalent function; see for details. -// -// -//go:linkname Round_ py.round_ -func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// -// Return the shape of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// shape : tuple of ints -// The elements of the shape tuple give the lengths of the -// corresponding array dimensions. -// -// See Also -// -------- -// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with -// ``N>=1``. -// ndarray.shape : Equivalent array method. -// -// Examples -// -------- -// >>> np.shape(np.eye(3)) -// (3, 3) -// >>> np.shape([[1, 3]]) -// (1, 2) -// >>> np.shape([0]) -// (1,) -// >>> np.shape(0) -// () -// -// >>> a = np.array([(1, 2), (3, 4), (5, 6)], -// ... dtype=[('x', 'i4'), ('y', 'i4')]) -// >>> np.shape(a) -// (3,) -// >>> a.shape -// (3,) -// -// -// -//go:linkname Shape py.shape -func Shape(a *py.Object) *py.Object -// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Natural logarithm, element-wise. -// -// The natural logarithm `log` is the inverse of the exponential function, -// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base -// `e`. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The natural logarithm of `x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log10, log2, log1p, emath.log -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log` always returns real output. For -// each value that cannot be expressed as a real number or infinity, it -// yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log([1, np.e, np.e**2, 0]) -// array([ 0., 1., 2., -Inf]) -// -//go:linkname Log py.log -func Log(x *py.Object, out *py.Object) *py.Object -// -// Return the scalar type of highest precision of the same kind as the input. -// -// Parameters -// ---------- -// t : dtype or dtype specifier -// The input data type. This can be a `dtype` object or an object that -// is convertible to a `dtype`. -// -// Returns -// ------- -// out : dtype -// The highest precision data type of the same kind (`dtype.kind`) as `t`. -// -// See Also -// -------- -// obj2sctype, mintypecode, sctype2char -// dtype -// -// Examples -// -------- -// >>> np.maximum_sctype(int) -// -// >>> np.maximum_sctype(np.uint8) -// -// >>> np.maximum_sctype(complex) -// # may vary -// -// >>> np.maximum_sctype(str) -// -// -// >>> np.maximum_sctype('i2') -// -// >>> np.maximum_sctype('f4') -// # may vary -// -// -// -//go:linkname MaximumSctype py.maximum_sctype -func MaximumSctype(t *py.Object) *py.Object -// -// Return a description for the given data type code. -// -// Parameters -// ---------- -// char : str -// Data type code. -// -// Returns -// ------- -// out : str -// Description of the input data type code. -// -// See Also -// -------- -// dtype, typecodes -// -// Examples -// -------- -// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', -// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] -// >>> for typechar in typechars: -// ... print(typechar, ' : ', np.typename(typechar)) -// ... -// S1 : character -// ? : bool -// B : unsigned char -// D : complex double precision -// G : complex long double precision -// F : complex single precision -// I : unsigned integer -// H : unsigned short -// L : unsigned long integer -// O : object -// Q : unsigned long long integer -// S : string -// U : unicode -// V : void -// b : signed char -// d : double precision -// g : long precision -// f : single precision -// i : integer -// h : short -// l : long integer -// q : long long integer -// -// -// -//go:linkname Typename py.typename -func Typename(char *py.Object) *py.Object -// -// Return the Kaiser window. -// -// The Kaiser window is a taper formed by using a Bessel function. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// beta : float -// Shape parameter for window. -// -// Returns -// ------- -// out : array -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hamming, hanning -// -// Notes -// ----- -// The Kaiser window is defined as -// -// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} -// \right)/I_0(\beta) -// -// with -// -// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, -// -// where :math:`I_0` is the modified zeroth-order Bessel function. -// -// The Kaiser was named for Jim Kaiser, who discovered a simple -// approximation to the DPSS window based on Bessel functions. The Kaiser -// window is a very good approximation to the Digital Prolate Spheroidal -// Sequence, or Slepian window, which is the transform which maximizes the -// energy in the main lobe of the window relative to total energy. -// -// The Kaiser can approximate many other windows by varying the beta -// parameter. -// -// ==== ======================= -// beta Window shape -// ==== ======================= -// 0 Rectangular -// 5 Similar to a Hamming -// 6 Similar to a Hanning -// 8.6 Similar to a Blackman -// ==== ======================= -// -// A beta value of 14 is probably a good starting point. Note that as beta -// gets large, the window narrows, and so the number of samples needs to be -// large enough to sample the increasingly narrow spike, otherwise NaNs will -// get returned. -// -// Most references to the Kaiser window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by -// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. -// John Wiley and Sons, New York, (1966). -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 177-178. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.kaiser(12, 14) -// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary -// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, -// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, -// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) -// -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.kaiser(51, 14) -// >>> plt.plot(window) -// [] -// >>> plt.title("Kaiser window") -// Text(0.5, 1.0, 'Kaiser window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Kaiser window") -// Text(0.5, 1.0, 'Frequency response of Kaiser window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// (-0.5, 0.5, -100.0, ...) # may vary -// >>> plt.show() -// -// -// -//go:linkname Kaiser py.kaiser -func Kaiser(M *py.Object, beta *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the minimum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``min`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// min : ndarray or scalar -// Minimum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// argmin : -// Return the indices of the minimum values. -// -// nanmax, maximum, fmax -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding min value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmin. -// -// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than -// ``min(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.min(a) # Minimum of the flattened array -// 0 -// >>> np.min(a, axis=0) # Minima along the first axis -// array([0, 1]) -// >>> np.min(a, axis=1) # Minima along the second axis -// array([0, 2]) -// >>> np.min(a, where=[False, True], initial=10, axis=0) -// array([10, 1]) -// -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.min(b) -// nan -// >>> np.min(b, where=~np.isnan(b), initial=10) -// 0.0 -// >>> np.nanmin(b) -// 0.0 -// -// >>> np.min([[-50], [10]], axis=-1, initial=0) -// array([-50, 0]) -// -// Notice that the initial value is used as one of the elements for which the -// minimum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// Notice that this isn't the same as Python's ``default`` argument. -// -// >>> np.min([6], initial=5) -// 5 -// >>> min([6], default=5) -// 6 -// -// -//go:linkname Min py.min -func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the variance along the specified axis. -// -// Returns the variance of the array elements, a measure of the spread of a -// distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the variance is computed. The default is to -// compute the variance of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a variance is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of elements. By -// default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `var` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If ``out=None``, returns a new array containing the variance; -// otherwise, a reference to the output array is returned. -// -// See Also -// -------- -// std, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. -// -// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.var(a) -// 1.25 -// >>> np.var(a, axis=0) -// array([1., 1.]) -// >>> np.var(a, axis=1) -// array([0.25, 0.25]) -// -// In single precision, var() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.var(a) -// 0.20250003 -// -// Computing the variance in float64 is more accurate: -// -// >>> np.var(a, dtype=np.float64) -// 0.20249999932944759 # may vary -// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 -// 0.2025 -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.var(a) -// 6.833333333333333 # may vary -// >>> np.var(a, where=[[True], [True], [False]]) -// 4.0 -// -// -// -//go:linkname Var py.var -func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Reverse the order of elements in an array along the given axis. -// -// The shape of the array is preserved, but the elements are reordered. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// m : array_like -// Input array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to flip over. The default, -// axis=None, will flip over all of the axes of the input array. -// If axis is negative it counts from the last to the first axis. -// -// If axis is a tuple of ints, flipping is performed on all of the axes -// specified in the tuple. -// -// .. versionchanged:: 1.15.0 -// None and tuples of axes are supported -// -// Returns -// ------- -// out : array_like -// A view of `m` with the entries of axis reversed. Since a view is -// returned, this operation is done in constant time. -// -// See Also -// -------- -// flipud : Flip an array vertically (axis=0). -// fliplr : Flip an array horizontally (axis=1). -// -// Notes -// ----- -// flip(m, 0) is equivalent to flipud(m). -// -// flip(m, 1) is equivalent to fliplr(m). -// -// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. -// -// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all -// positions. -// -// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at -// position 0 and position 1. -// -// Examples -// -------- -// >>> A = np.arange(8).reshape((2,2,2)) -// >>> A -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> np.flip(A, 0) -// array([[[4, 5], -// [6, 7]], -// [[0, 1], -// [2, 3]]]) -// >>> np.flip(A, 1) -// array([[[2, 3], -// [0, 1]], -// [[6, 7], -// [4, 5]]]) -// >>> np.flip(A) -// array([[[7, 6], -// [5, 4]], -// [[3, 2], -// [1, 0]]]) -// >>> np.flip(A, (0, 2)) -// array([[[5, 4], -// [7, 6]], -// [[1, 0], -// [3, 2]]]) -// >>> A = np.random.randn(3,4,5) -// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) -// True -// -// -//go:linkname Flip py.flip -func Flip(m *py.Object, axis *py.Object) *py.Object -// -// Split an array into multiple sub-arrays. -// -// Please refer to the ``split`` documentation. The only difference -// between these functions is that ``array_split`` allows -// `indices_or_sections` to be an integer that does *not* equally -// divide the axis. For an array of length l that should be split -// into n sections, it returns l % n sub-arrays of size l//n + 1 -// and the rest of size l//n. -// -// See Also -// -------- -// split : Split array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(8.0) -// >>> np.array_split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] -// -// >>> x = np.arange(9) -// >>> np.array_split(x, 4) -// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] -// -// -// -//go:linkname ArraySplit py.array_split -func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Evaluate a polynomial at specific values. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// If `p` is of length N, this function returns the value: -// -// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` -// -// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. -// If `x` is another polynomial then the composite polynomial ``p(x(t))`` -// is returned. -// -// Parameters -// ---------- -// p : array_like or poly1d object -// 1D array of polynomial coefficients (including coefficients equal -// to zero) from highest degree to the constant term, or an -// instance of poly1d. -// x : array_like or poly1d object -// A number, an array of numbers, or an instance of poly1d, at -// which to evaluate `p`. -// -// Returns -// ------- -// values : ndarray or poly1d -// If `x` is a poly1d instance, the result is the composition of the two -// polynomials, i.e., `x` is "substituted" in `p` and the simplified -// result is returned. In addition, the type of `x` - array_like or -// poly1d - governs the type of the output: `x` array_like => `values` -// array_like, `x` a poly1d object => `values` is also. -// -// See Also -// -------- -// poly1d: A polynomial class. -// -// Notes -// ----- -// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, -// for polynomials of high degree the values may be inaccurate due to -// rounding errors. Use carefully. -// -// If `x` is a subtype of `ndarray` the return value will be of the same type. -// -// References -// ---------- -// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. -// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand -// Reinhold Co., 1985, pg. 720. -// -// Examples -// -------- -// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 -// 76 -// >>> np.polyval([3,0,1], np.poly1d(5)) -// poly1d([76]) -// >>> np.polyval(np.poly1d([3,0,1]), 5) -// 76 -// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) -// poly1d([76]) -// -// -// -//go:linkname Polyval py.polyval -func Polyval(p *py.Object, x *py.Object) *py.Object -// -// Return the indices of the maximum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the -// results cannot be trusted if a slice contains only NaNs and -Infs. -// -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmax, nanargmin -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmax(a) -// 0 -// >>> np.nanargmax(a) -// 1 -// >>> np.nanargmax(a, axis=0) -// array([1, 0]) -// >>> np.nanargmax(a, axis=1) -// array([1, 1]) -// -// -// -//go:linkname Nanargmax py.nanargmax -func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Move axes of an array to new positions. -// -// Other axes remain in their original order. -// -// .. versionadded:: 1.11.0 -// -// Parameters -// ---------- -// a : np.ndarray -// The array whose axes should be reordered. -// source : int or sequence of int -// Original positions of the axes to move. These must be unique. -// destination : int or sequence of int -// Destination positions for each of the original axes. These must also be -// unique. -// -// Returns -// ------- -// result : np.ndarray -// Array with moved axes. This array is a view of the input array. -// -// See Also -// -------- -// transpose : Permute the dimensions of an array. -// swapaxes : Interchange two axes of an array. -// -// Examples -// -------- -// >>> x = np.zeros((3, 4, 5)) -// >>> np.moveaxis(x, 0, -1).shape -// (4, 5, 3) -// >>> np.moveaxis(x, -1, 0).shape -// (5, 3, 4) -// -// These all achieve the same result: -// -// >>> np.transpose(x).shape -// (5, 4, 3) -// >>> np.swapaxes(x, 0, -1).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape -// (5, 4, 3) -// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape -// (5, 4, 3) -// -// -// -//go:linkname Moveaxis py.moveaxis -func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object -// -// Replace NaN with zero and infinity with large finite numbers (default -// behaviour) or with the numbers defined by the user using the `nan`, -// `posinf` and/or `neginf` keywords. -// -// If `x` is inexact, NaN is replaced by zero or by the user defined value in -// `nan` keyword, infinity is replaced by the largest finite floating point -// values representable by ``x.dtype`` or by the user defined value in -// `posinf` keyword and -infinity is replaced by the most negative finite -// floating point values representable by ``x.dtype`` or by the user defined -// value in `neginf` keyword. -// -// For complex dtypes, the above is applied to each of the real and -// imaginary components of `x` separately. -// -// If `x` is not inexact, then no replacements are made. -// -// Parameters -// ---------- -// x : scalar or array_like -// Input data. -// copy : bool, optional -// Whether to create a copy of `x` (True) or to replace values -// in-place (False). The in-place operation only occurs if -// casting to an array does not require a copy. -// Default is True. -// -// .. versionadded:: 1.13 -// nan : int, float, optional -// Value to be used to fill NaN values. If no value is passed -// then NaN values will be replaced with 0.0. -// -// .. versionadded:: 1.17 -// posinf : int, float, optional -// Value to be used to fill positive infinity values. If no value is -// passed then positive infinity values will be replaced with a very -// large number. -// -// .. versionadded:: 1.17 -// neginf : int, float, optional -// Value to be used to fill negative infinity values. If no value is -// passed then negative infinity values will be replaced with a very -// small (or negative) number. -// -// .. versionadded:: 1.17 -// -// -// -// Returns -// ------- -// out : ndarray -// `x`, with the non-finite values replaced. If `copy` is False, this may -// be `x` itself. -// -// See Also -// -------- -// isinf : Shows which elements are positive or negative infinity. -// isneginf : Shows which elements are negative infinity. -// isposinf : Shows which elements are positive infinity. -// isnan : Shows which elements are Not a Number (NaN). -// isfinite : Shows which elements are finite (not NaN, not infinity) -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.nan_to_num(np.inf) -// 1.7976931348623157e+308 -// >>> np.nan_to_num(-np.inf) -// -1.7976931348623157e+308 -// >>> np.nan_to_num(np.nan) -// 0.0 -// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) -// >>> np.nan_to_num(x) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) -// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, -// -1.2800000e+02, 1.2800000e+02]) -// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) -// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary -// -1.28000000e+002, 1.28000000e+002]) -// >>> np.nan_to_num(y) -// array([ 1.79769313e+308 +0.00000000e+000j, # may vary -// 0.00000000e+000 +0.00000000e+000j, -// 0.00000000e+000 +1.79769313e+308j]) -// >>> np.nan_to_num(y, nan=111111, posinf=222222) -// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) -// -// -//go:linkname NanToNum py.nan_to_num -func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object -// -// Return the Hamming window. -// -// The Hamming window is a taper formed by using a weighted cosine. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value -// one appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, blackman, hanning, kaiser -// -// Notes -// ----- -// The Hamming window is defined as -// -// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) -// \qquad 0 \leq n \leq M-1 -// -// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey -// and is described in Blackman and Tukey. It was recommended for -// smoothing the truncated autocovariance function in the time domain. -// Most references to the Hamming window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. -// -// References -// ---------- -// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power -// spectra, Dover Publications, New York. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The -// University of Alberta Press, 1975, pp. 109-110. -// .. [3] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 425. -// -// Examples -// -------- -// >>> np.hamming(12) -// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary -// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, -// 0.15302337, 0.08 ]) -// -// Plot the window and the frequency response: -// -// >>> import matplotlib.pyplot as plt -// >>> from numpy.fft import fft, fftshift -// >>> window = np.hamming(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Hamming window") -// Text(0.5, 1.0, 'Hamming window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> response = 20 * np.log10(mag) -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Hamming window") -// Text(0.5, 1.0, 'Frequency response of Hamming window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> plt.axis('tight') -// ... -// >>> plt.show() -// -// -// -//go:linkname Hamming py.hamming -func Hamming(M *py.Object) *py.Object -// -// Return the indices of the minimum values in the specified axis ignoring -// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results -// cannot be trusted if a slice contains only NaNs and Infs. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which to operate. By default flattened input is used. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// -// .. versionadded:: 1.22.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray -// An array of indices or a single index value. -// -// See Also -// -------- -// argmin, nanargmax -// -// Examples -// -------- -// >>> a = np.array([[np.nan, 4], [2, 3]]) -// >>> np.argmin(a) -// 0 -// >>> np.nanargmin(a) -// 2 -// >>> np.nanargmin(a, axis=0) -// array([1, 1]) -// >>> np.nanargmin(a, axis=1) -// array([1, 0]) -// -// -// -//go:linkname Nanargmin py.nanargmin -func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// copyto(dst, src, casting='same_kind', where=True) -// -// Copies values from one array to another, broadcasting as necessary. -// -// Raises a TypeError if the `casting` rule is violated, and if -// `where` is provided, it selects which elements to copy. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dst : ndarray -// The array into which values are copied. -// src : array_like -// The array from which values are copied. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur when copying. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// where : array_like of bool, optional -// A boolean array which is broadcasted to match the dimensions -// of `dst`, and selects elements to copy from `src` to `dst` -// wherever it contains the value True. -// -// Examples -// -------- -// >>> A = np.array([4, 5, 6]) -// >>> B = [1, 2, 3] -// >>> np.copyto(A, B) -// >>> A -// array([1, 2, 3]) -// -// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> B = [[4, 5, 6], [7, 8, 9]] -// >>> np.copyto(A, B) -// >>> A -// array([[4, 5, 6], -// [7, 8, 9]]) -// -// -// -//go:linkname Copyto py.copyto -func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object -// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 AND x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical AND operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or, logical_not, logical_xor -// bitwise_and -// -// Examples -// -------- -// >>> np.logical_and(True, False) -// False -// >>> np.logical_and([True, False], [False, False]) -// array([False, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_and(x>1, x<4) -// array([False, False, True, True, False]) -// -// -// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a & b -// array([False, False]) -// -//go:linkname LogicalAnd py.logical_and -func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical negative, element-wise. -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = -x`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.negative([1.,-1.]) -// array([-1., 1.]) -// -// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> -x1 -// array([-1., 1.]) -// -//go:linkname Negative py.negative -func Negative(x *py.Object, out *py.Object) *py.Object -// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the right. -// -// Bits are shifted to the right `x2`. Because the internal -// representation of numbers is in binary format, this operation is -// equivalent to dividing `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like, int -// Input values. -// x2 : array_like, int -// Number of bits to remove at the right of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray, int -// Return `x1` with bits shifted `x2` times to the right. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// left_shift : Shift the bits of an integer to the left. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(10) -// '1010' -// >>> np.right_shift(10, 1) -// 5 -// >>> np.binary_repr(5) -// '101' -// -// >>> np.right_shift(10, [1,2,3]) -// array([5, 2, 1]) -// -// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on -// ndarrays. -// -// >>> x1 = 10 -// >>> x2 = np.array([1,2,3]) -// >>> x1 >> x2 -// array([5, 2, 1]) -// -//go:linkname RightShift py.right_shift -func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set how floating-point errors are handled. -// -// Note that operations on integer scalar types (such as `int16`) are -// handled like floating point, and are affected by these settings. -// -// Parameters -// ---------- -// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Set treatment for all types of floating-point errors at once: -// -// - ignore: Take no action when the exception occurs. -// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). -// - raise: Raise a `FloatingPointError`. -// - call: Call a function specified using the `seterrcall` function. -// - print: Print a warning directly to ``stdout``. -// - log: Record error in a Log object specified by `seterrcall`. -// -// The default is not to change the current behavior. -// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for division by zero. -// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point overflow. -// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for floating-point underflow. -// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional -// Treatment for invalid floating-point operation. -// -// Returns -// ------- -// old_settings : dict -// Dictionary containing the old settings. -// -// See also -// -------- -// seterrcall : Set a callback function for the 'call' mode. -// geterr, geterrcall, errstate -// -// Notes -// ----- -// The floating-point exceptions are defined in the IEEE 754 standard [1]_: -// -// - Division by zero: infinite result obtained from finite numbers. -// - Overflow: result too large to be expressed. -// - Underflow: result so close to zero that some precision -// was lost. -// - Invalid operation: result is not an expressible number, typically -// indicates that a NaN was produced. -// -// .. [1] https://en.wikipedia.org/wiki/IEEE_754 -// -// Examples -// -------- -// >>> old_settings = np.seterr(all='ignore') #seterr to known value -// >>> np.seterr(over='raise') -// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} -// >>> np.seterr(**old_settings) # reset to default -// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} -// -// >>> np.int16(32000) * np.int16(3) -// 30464 -// >>> old_settings = np.seterr(all='warn', over='raise') -// >>> np.int16(32000) * np.int16(3) -// Traceback (most recent call last): -// File "", line 1, in -// FloatingPointError: overflow encountered in scalar multiply -// -// >>> old_settings = np.seterr(all='print') -// >>> np.geterr() -// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} -// >>> np.int16(32000) * np.int16(3) -// 30464 -// -// -// -//go:linkname Seterr py.seterr -func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object -// -// Assemble an nd-array from nested lists of blocks. -// -// Blocks in the innermost lists are concatenated (see `concatenate`) along -// the last dimension (-1), then these are concatenated along the -// second-last dimension (-2), and so on until the outermost list is reached. -// -// Blocks can be of any dimension, but will not be broadcasted using the normal -// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` -// the same for all blocks. This is primarily useful for working with scalars, -// and means that code like ``np.block([v, 1])`` is valid, where -// ``v.ndim == 1``. -// -// When the nested list is two levels deep, this allows block matrices to be -// constructed from their components. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// arrays : nested list of array_like or scalars (but not tuples) -// If passed a single ndarray or scalar (a nested list of depth 0), this -// is returned unmodified (and not copied). -// -// Elements shapes must match along the appropriate axes (without -// broadcasting), but leading 1s will be prepended to the shape as -// necessary to make the dimensions match. -// -// Returns -// ------- -// block_array : ndarray -// The array assembled from the given blocks. -// -// The dimensionality of the output is equal to the greatest of: -// * the dimensionality of all the inputs -// * the depth to which the input list is nested -// -// Raises -// ------ -// ValueError -// * If list depths are mismatched - for instance, ``[[a, b], c]`` is -// illegal, and should be spelt ``[[a, b], [c]]`` -// * If lists are empty - for instance, ``[[a, b], []]`` -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// vstack : Stack arrays in sequence vertically (row wise). -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Notes -// ----- -// -// When called with only scalars, ``np.block`` is equivalent to an ndarray -// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to -// ``np.array([[1, 2], [3, 4]])``. -// -// This function does not enforce that the blocks lie on a fixed grid. -// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: -// -// AAAbb -// AAAbb -// cccDD -// -// But is also allowed to produce, for some ``a, b, c, d``:: -// -// AAAbb -// AAAbb -// cDDDD -// -// Since concatenation happens along the last axis first, `block` is _not_ -// capable of producing the following directly:: -// -// AAAbb -// cccbb -// cccDD -// -// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is -// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. -// -// Examples -// -------- -// The most common use of this function is to build a block matrix -// -// >>> A = np.eye(2) * 2 -// >>> B = np.eye(3) * 3 -// >>> np.block([ -// ... [A, np.zeros((2, 3))], -// ... [np.ones((3, 2)), B ] -// ... ]) -// array([[2., 0., 0., 0., 0.], -// [0., 2., 0., 0., 0.], -// [1., 1., 3., 0., 0.], -// [1., 1., 0., 3., 0.], -// [1., 1., 0., 0., 3.]]) -// -// With a list of depth 1, `block` can be used as `hstack` -// -// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) -// array([1, 2, 3]) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([a, b, 10]) # hstack([a, b, 10]) -// array([ 1, 2, 3, 4, 5, 6, 10]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([A, B]) # hstack([A, B]) -// array([[1, 1, 2, 2], -// [1, 1, 2, 2]]) -// -// With a list of depth 2, `block` can be used in place of `vstack`: -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.block([[a], [b]]) # vstack([a, b]) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> A = np.ones((2, 2), int) -// >>> B = 2 * A -// >>> np.block([[A], [B]]) # vstack([A, B]) -// array([[1, 1], -// [1, 1], -// [2, 2], -// [2, 2]]) -// -// It can also be used in places of `atleast_1d` and `atleast_2d` -// -// >>> a = np.array(0) -// >>> b = np.array([1]) -// >>> np.block([a]) # atleast_1d(a) -// array([0]) -// >>> np.block([b]) # atleast_1d(b) -// array([1]) -// -// >>> np.block([[a]]) # atleast_2d(a) -// array([[0]]) -// >>> np.block([[b]]) # atleast_2d(b) -// array([[1]]) -// -// -// -// -//go:linkname Block py.block -func Block(arrays *py.Object) *py.Object -// -// One-dimensional linear interpolation for monotonically increasing sample points. -// -// Returns the one-dimensional piecewise linear interpolant to a function -// with given discrete data points (`xp`, `fp`), evaluated at `x`. -// -// Parameters -// ---------- -// x : array_like -// The x-coordinates at which to evaluate the interpolated values. -// -// xp : 1-D sequence of floats -// The x-coordinates of the data points, must be increasing if argument -// `period` is not specified. Otherwise, `xp` is internally sorted after -// normalizing the periodic boundaries with ``xp = xp % period``. -// -// fp : 1-D sequence of float or complex -// The y-coordinates of the data points, same length as `xp`. -// -// left : optional float or complex corresponding to fp -// Value to return for `x < xp[0]`, default is `fp[0]`. -// -// right : optional float or complex corresponding to fp -// Value to return for `x > xp[-1]`, default is `fp[-1]`. -// -// period : None or float, optional -// A period for the x-coordinates. This parameter allows the proper -// interpolation of angular x-coordinates. Parameters `left` and `right` -// are ignored if `period` is specified. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// y : float or complex (corresponding to fp) or ndarray -// The interpolated values, same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `xp` and `fp` have different length -// If `xp` or `fp` are not 1-D sequences -// If `period == 0` -// -// See Also -// -------- -// scipy.interpolate -// -// Warnings -// -------- -// The x-coordinate sequence is expected to be increasing, but this is not -// explicitly enforced. However, if the sequence `xp` is non-increasing, -// interpolation results are meaningless. -// -// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. -// -// A simple check for `xp` being strictly increasing is:: -// -// np.all(np.diff(xp) > 0) -// -// Examples -// -------- -// >>> xp = [1, 2, 3] -// >>> fp = [3, 2, 0] -// >>> np.interp(2.5, xp, fp) -// 1.0 -// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) -// array([3. , 3. , 2.5 , 0.56, 0. ]) -// >>> UNDEF = -99.0 -// >>> np.interp(3.14, xp, fp, right=UNDEF) -// -99.0 -// -// Plot an interpolant to the sine function: -// -// >>> x = np.linspace(0, 2*np.pi, 10) -// >>> y = np.sin(x) -// >>> xvals = np.linspace(0, 2*np.pi, 50) -// >>> yinterp = np.interp(xvals, x, y) -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(x, y, 'o') -// [] -// >>> plt.plot(xvals, yinterp, '-x') -// [] -// >>> plt.show() -// -// Interpolation with periodic x-coordinates: -// -// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] -// >>> xp = [190, -190, 350, -350] -// >>> fp = [5, 10, 3, 4] -// >>> np.interp(x, xp, fp, period=360) -// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) -// -// Complex interpolation: -// -// >>> x = [1.5, 4.0] -// >>> xp = [2,3,5] -// >>> fp = [1.0j, 0, 2+3j] -// >>> np.interp(x, xp, fp) -// array([0.+1.j , 1.+1.5j]) -// -// -// -//go:linkname Interp py.interp -func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object -// -// Put values into the destination array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to place values into the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Destination array. -// indices : ndarray (Ni..., J, Nk...) -// Indices to change along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast -// against `arr`. -// values : array_like (Ni..., J, Nk...) -// values to insert at those indices. Its shape and dimension are -// broadcast to match that of `indices`. -// axis : int -// The axis to take 1d slices along. If axis is None, the destination -// array is treated as if a flattened 1d view had been created of it. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// values_1d = values [ii + s_[:,] + kk] -// for j in range(J): -// a_1d[indices_1d[j]] = values_1d[j] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// a_1d[indices_1d] = values_1d -// -// See Also -// -------- -// take_along_axis : -// Take values from the input array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can replace the maximum values with: -// -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.put_along_axis(a, ai, 99, axis=1) -// >>> a -// array([[10, 99, 20], -// [99, 40, 50]]) -// -// -// -//go:linkname PutAlongAxis py.put_along_axis -func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the minimum of an array or minimum along an axis. -// -// `amin` is an alias of `~numpy.min`. -// -// See Also -// -------- -// min : alias of this function -// ndarray.min : equivalent method -// -// -//go:linkname Amin py.amin -func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to operate. By default, flattened input is -// used. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, the maximum is selected over multiple axes, -// instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternative output array in which to place the result. Must -// be of the same shape and buffer length as the expected output. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the ``max`` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// max : ndarray or scalar -// Maximum of `a`. If `axis` is None, the result is a scalar value. -// If `axis` is an int, the result is an array of dimension -// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of -// dimension ``a.ndim - len(axis)``. -// -// See Also -// -------- -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// argmax : -// Return the indices of the maximum values. -// -// nanmin, minimum, fmin -// -// Notes -// ----- -// NaN values are propagated, that is if at least one item is NaN, the -// corresponding max value will be NaN as well. To ignore NaN values -// (MATLAB behavior), please use nanmax. -// -// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when -// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than -// ``max(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape((2,2)) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> np.max(a) # Maximum of the flattened array -// 3 -// >>> np.max(a, axis=0) # Maxima along the first axis -// array([2, 3]) -// >>> np.max(a, axis=1) # Maxima along the second axis -// array([1, 3]) -// >>> np.max(a, where=[False, True], initial=-1, axis=0) -// array([-1, 3]) -// >>> b = np.arange(5, dtype=float) -// >>> b[2] = np.NaN -// >>> np.max(b) -// nan -// >>> np.max(b, where=~np.isnan(b), initial=-1) -// 4.0 -// >>> np.nanmax(b) -// 4.0 -// -// You can use an initial value to compute the maximum of an empty slice, or -// to initialize it to a different value: -// -// >>> np.max([[-50], [10]], axis=-1, initial=0) -// array([ 0, 10]) -// -// Notice that the initial value is used as one of the elements for which the -// maximum is determined, unlike for the default argument Python's max -// function, which is only used for empty iterables. -// -// >>> np.max([5], initial=6) -// 6 -// >>> max([5], default=6) -// 5 -// -// -//go:linkname Max py.max -func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Test element-wise for negative infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a numpy boolean array is -// returned with values True where the corresponding element of the -// input is negative infinity and values False where the element of -// the input is not negative infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as -// zeros and ones, if the type is boolean then as False and True. The -// return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values. -// -// Examples -// -------- -// >>> np.isneginf(np.NINF) -// True -// >>> np.isneginf(np.inf) -// False -// >>> np.isneginf(np.PINF) -// False -// >>> np.isneginf([-np.inf, 0., np.inf]) -// array([ True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isneginf(x, y) -// array([1, 0, 0]) -// >>> y -// array([1, 0, 0]) -// -// -// -//go:linkname Isneginf py.isneginf -func Isneginf(x *py.Object, out *py.Object) *py.Object -// -// Returns the quotient and remainder of polynomial division. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The input arrays are the coefficients (including any coefficients -// equal to zero) of the "numerator" (dividend) and "denominator" -// (divisor) polynomials, respectively. -// -// Parameters -// ---------- -// u : array_like or poly1d -// Dividend polynomial's coefficients. -// -// v : array_like or poly1d -// Divisor polynomial's coefficients. -// -// Returns -// ------- -// q : ndarray -// Coefficients, including those equal to zero, of the quotient. -// r : ndarray -// Coefficients, including those equal to zero, of the remainder. -// -// See Also -// -------- -// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub -// polyval -// -// Notes -// ----- -// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need -// not equal `v.ndim`. In other words, all four possible combinations - -// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, -// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. -// -// Examples -// -------- -// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 -// -// >>> x = np.array([3.0, 5.0, 2.0]) -// >>> y = np.array([2.0, 1.0]) -// >>> np.polydiv(x, y) -// (array([1.5 , 1.75]), array([0.25])) -// -// -// -//go:linkname Polydiv py.polydiv -func Polydiv(u *py.Object, v *py.Object) *py.Object -// -// Determine if a class is a subclass of a second class. -// -// `issubclass_` is equivalent to the Python built-in ``issubclass``, -// except that it returns False instead of raising a TypeError if one -// of the arguments is not a class. -// -// Parameters -// ---------- -// arg1 : class -// Input class. True is returned if `arg1` is a subclass of `arg2`. -// arg2 : class or tuple of classes. -// Input class. If a tuple of classes, True is returned if `arg1` is a -// subclass of any of the tuple elements. -// -// Returns -// ------- -// out : bool -// Whether `arg1` is a subclass of `arg2` or not. -// -// See Also -// -------- -// issubsctype, issubdtype, issctype -// -// Examples -// -------- -// >>> np.issubclass_(np.int32, int) -// False -// >>> np.issubclass_(np.int32, float) -// False -// >>> np.issubclass_(np.float64, float) -// True -// -// -// -//go:linkname Issubclass_ py.issubclass_ -func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Determine if the first argument is a subclass of the second argument. -// -// Parameters -// ---------- -// arg1, arg2 : dtype or dtype specifier -// Data-types. -// -// Returns -// ------- -// out : bool -// The result. -// -// See Also -// -------- -// issctype, issubdtype, obj2sctype -// -// Examples -// -------- -// >>> np.issubsctype('S8', str) -// False -// >>> np.issubsctype(np.array([1]), int) -// True -// >>> np.issubsctype(np.array([1]), float) -// False -// -// -// -//go:linkname Issubsctype py.issubsctype -func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis, ignoring any -// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is -// raised and NaN is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose maximum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the maximum is computed. The default is to compute -// the maximum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `max` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The minimum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the maximum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmax : ndarray -// An array with the same shape as `a`, with the specified axis removed. -// If `a` is a 0-d array, or if axis is None, an ndarray scalar is -// returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmin : -// The minimum value of an array along a given axis, ignoring any NaNs. -// amax : -// The maximum value of an array along a given axis, propagating any NaNs. -// fmax : -// Element-wise maximum of two arrays, ignoring any NaNs. -// maximum : -// Element-wise maximum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amin, fmin, minimum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.max. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmax(a) -// 3.0 -// >>> np.nanmax(a, axis=0) -// array([3., 2.]) -// >>> np.nanmax(a, axis=1) -// array([2., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmax([1, 2, np.nan, np.NINF]) -// 2.0 -// >>> np.nanmax([1, 2, np.nan, np.inf]) -// inf -// -// -// -//go:linkname Nanmax py.nanmax -func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis, ignoring NaNs. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the means are computed. The default is to compute -// the mean of the flattened array. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for inexact inputs, it is the same as the input -// dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. Nan is -// returned for slices that contain only NaNs. -// -// See Also -// -------- -// average : Weighted average -// mean : Arithmetic mean taken while not ignoring NaNs -// var, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the non-NaN elements along the axis -// divided by the number of non-NaN elements. -// -// Note that for floating-point input, the mean is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32`. Specifying a -// higher-precision accumulator using the `dtype` keyword can alleviate -// this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanmean(a) -// 2.6666666666666665 -// >>> np.nanmean(a, axis=0) -// array([2., 4.]) -// >>> np.nanmean(a, axis=1) -// array([1., 3.5]) # may vary -// -// -// -//go:linkname Nanmean py.nanmean -func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// -// putmask(a, mask, values) -// -// Changes elements of an array based on conditional and input values. -// -// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. -// -// If `values` is not the same size as `a` and `mask` then it will repeat. -// This gives behavior different from ``a[mask] = values``. -// -// Parameters -// ---------- -// a : ndarray -// Target array. -// mask : array_like -// Boolean mask array. It has to be the same shape as `a`. -// values : array_like -// Values to put into `a` where `mask` is True. If `values` is smaller -// than `a` it will be repeated. -// -// See Also -// -------- -// place, put, take, copyto -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2, 3) -// >>> np.putmask(x, x>2, x**2) -// >>> x -// array([[ 0, 1, 2], -// [ 9, 16, 25]]) -// -// If `values` is smaller than `a` it is repeated: -// -// >>> x = np.arange(5) -// >>> np.putmask(x, x>1, [-33, -44]) -// >>> x -// array([ 0, 1, -33, -44, -33]) -// -// -// -//go:linkname Putmask py.putmask -func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object -// -// Returns the indices that would sort an array. -// -// Perform an indirect sort along the given axis using the algorithm specified -// by the `kind` keyword. It returns an array of indices of the same shape as -// `a` that index data along the given axis in sorted order. -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If None, -// the flattened array is used. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort under the covers and, in general, the -// actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that sort `a` along the specified `axis`. -// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the sorted `a`, irrespective of dimensionality. -// -// See Also -// -------- -// sort : Describes sorting algorithms used. -// lexsort : Indirect stable sort with multiple keys. -// ndarray.sort : Inplace sort. -// argpartition : Indirect partial sort. -// take_along_axis : Apply ``index_array`` from argsort -// to an array as if by calling sort. -// -// Notes -// ----- -// See `sort` for notes on the different sorting algorithms. -// -// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing -// nan values. The enhanced sort order is documented in `sort`. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 1, 2]) -// >>> np.argsort(x) -// array([1, 2, 0]) -// -// Two-dimensional array: -// -// >>> x = np.array([[0, 3], [2, 2]]) -// >>> x -// array([[0, 3], -// [2, 2]]) -// -// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) -// >>> ind -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) -// array([[0, 2], -// [2, 3]]) -// -// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) -// >>> ind -// array([[0, 1], -// [0, 1]]) -// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) -// array([[0, 3], -// [2, 2]]) -// -// Indices of the sorted elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) -// >>> ind -// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) -// >>> x[ind] # same as np.sort(x, axis=None) -// array([0, 2, 2, 3]) -// -// Sorting with keys: -// -// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x -// array([(1, 0), (0, 1)], -// dtype=[('x', '>> np.argsort(x, order=('x','y')) -// array([1, 0]) -// -// >>> np.argsort(x, order=('y','x')) -// array([0, 1]) -// -// -// -//go:linkname Argsort py.argsort -func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Given the "legs" of a right triangle, return its hypotenuse. -// -// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or -// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), -// it is broadcast for use with each element of the other argument. -// (See Examples) -// -// Parameters -// ---------- -// x1, x2 : array_like -// Leg of the triangle(s). -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// z : ndarray -// The hypotenuse of the triangle(s). -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -// Example showing broadcast of scalar_like argument: -// -// >>> np.hypot(3*np.ones((3, 3)), [4]) -// array([[ 5., 5., 5.], -// [ 5., 5., 5.], -// [ 5., 5., 5.]]) -// -//go:linkname Hypot py.hypot -func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Test element-wise for positive infinity, return result as bool array. -// -// Parameters -// ---------- -// x : array_like -// The input array. -// out : array_like, optional -// A location into which the result is stored. If provided, it must have a -// shape that the input broadcasts to. If not provided or None, a -// freshly-allocated boolean array is returned. -// -// Returns -// ------- -// out : ndarray -// A boolean array with the same dimensions as the input. -// If second argument is not supplied then a boolean array is returned -// with values True where the corresponding element of the input is -// positive infinity and values False where the element of the input is -// not positive infinity. -// -// If a second argument is supplied the result is stored there. If the -// type of that array is a numeric type the result is represented as zeros -// and ones, if the type is boolean then as False and True. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// isinf, isneginf, isfinite, isnan -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is also supplied when x is a scalar -// input, if first and second arguments have different shapes, or if the -// first argument has complex values -// -// Examples -// -------- -// >>> np.isposinf(np.PINF) -// True -// >>> np.isposinf(np.inf) -// True -// >>> np.isposinf(np.NINF) -// False -// >>> np.isposinf([-np.inf, 0., np.inf]) -// array([False, False, True]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isposinf(x, y) -// array([0, 0, 1]) -// >>> y -// array([0, 0, 1]) -// -// -// -//go:linkname Isposinf py.isposinf -func Isposinf(x *py.Object, out *py.Object) *py.Object -// -// Returns True if two arrays are element-wise equal within a tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// NaNs are treated as equal if they are in the same place and if -// ``equal_nan=True``. Infs are treated as equal if they are in the same -// place and of the same sign in both arrays. -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// .. versionadded:: 1.10.0 -// -// Returns -// ------- -// allclose : bool -// Returns True if the two arrays are equal within the given -// tolerance; False otherwise. -// -// See Also -// -------- -// isclose, all, any, equal -// -// Notes -// ----- -// If the following equation is element-wise True, then allclose returns -// True. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// The above equation is not symmetric in `a` and `b`, so that -// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in -// some rare cases. -// -// The comparison of `a` and `b` uses standard broadcasting, which -// means that `a` and `b` need not have the same shape in order for -// ``allclose(a, b)`` to evaluate to True. The same is true for -// `equal` but not `array_equal`. -// -// `allclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) -// False -// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) -// True -// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) -// False -// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// True -// -// -// -//go:linkname Allclose py.allclose -func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Compute the variance along the specified axis, while ignoring NaNs. -// -// Returns the variance of the array elements, a measure of the spread of -// a distribution. The variance is computed for the flattened array by -// default, otherwise over the specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose variance is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the variance is computed. The default is to compute -// the variance of the flattened array. -// dtype : data-type, optional -// Type to use in computing the variance. For arrays of integer type -// the default is `float64`; for arrays of float types it is the same as -// the array type. -// out : ndarray, optional -// Alternate output array in which to place the result. It must have -// the same shape as the expected output, but the type is cast if -// necessary. -// ddof : int, optional -// "Delta Degrees of Freedom": the divisor used in the calculation is -// ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// where : array_like of bool, optional -// Elements to include in the variance. See `~numpy.ufunc.reduce` for -// details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// variance : ndarray, see dtype parameter above -// If `out` is None, return a new array containing the variance, -// otherwise return a reference to the output array. If ddof is >= the -// number of non-NaN elements in a slice or the slice contains only -// NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// std : Standard deviation -// mean : Average -// var : Variance while not ignoring NaNs -// nanstd, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The variance is the average of the squared deviations from the mean, -// i.e., ``var = mean(abs(x - x.mean())**2)``. -// -// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. -// If, however, `ddof` is specified, the divisor ``N - ddof`` is used -// instead. In standard statistical practice, ``ddof=1`` provides an -// unbiased estimator of the variance of a hypothetical infinite -// population. ``ddof=0`` provides a maximum likelihood estimate of the -// variance for normally distributed variables. -// -// Note that for complex numbers, the absolute value is taken before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the variance is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for `float32` (see example -// below). Specifying a higher-accuracy accumulator using the ``dtype`` -// keyword can alleviate this issue. -// -// For this function to work on sub-classes of ndarray, they must define -// `sum` with the kwarg `keepdims` -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanvar(a) -// 1.5555555555555554 -// >>> np.nanvar(a, axis=0) -// array([1., 0.]) -// >>> np.nanvar(a, axis=1) -// array([0., 0.25]) # may vary -// -// -// -//go:linkname Nanvar py.nanvar -func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Cross-correlation of two 1-dimensional sequences. -// -// This function computes the correlation as generally defined in signal -// processing texts: -// -// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n -// -// with a and v sequences being zero-padded where necessary and -// :math:`\overline x` denoting complex conjugation. -// -// Parameters -// ---------- -// a, v : array_like -// Input sequences. -// mode : {'valid', 'same', 'full'}, optional -// Refer to the `convolve` docstring. Note that the default -// is 'valid', unlike `convolve`, which uses 'full'. -// old_behavior : bool -// `old_behavior` was removed in NumPy 1.10. If you need the old -// behavior, use `multiarray.correlate`. -// -// Returns -// ------- -// out : ndarray -// Discrete cross-correlation of `a` and `v`. -// -// See Also -// -------- -// convolve : Discrete, linear convolution of two one-dimensional sequences. -// multiarray.correlate : Old, no conjugate, version of correlate. -// scipy.signal.correlate : uses FFT which has superior performance on large arrays. -// -// Notes -// ----- -// The definition of correlation above is not unique and sometimes correlation -// may be defined differently. Another common definition is: -// -// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} -// -// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. -// -// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does -// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might -// be preferable. -// -// -// Examples -// -------- -// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -// array([3.5]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") -// array([2. , 3.5, 3. ]) -// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") -// array([0.5, 2. , 3.5, 3. , 0. ]) -// -// Using complex sequences: -// -// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') -// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) -// -// Note that you get the time reversed, complex conjugated result -// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change -// places: -// -// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') -// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) -// -// -// -//go:linkname Correlate py.correlate -func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// -// Compute the arithmetic mean along the specified axis. -// -// Returns the average of the array elements. The average is taken over -// the flattened array by default, otherwise over the specified axis. -// `float64` intermediate and return values are used for integer inputs. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose mean is desired. If `a` is not an -// array, a conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the means are computed. The default is to -// compute the mean of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a mean is performed over multiple axes, -// instead of a single axis or all the axes as before. -// dtype : data-type, optional -// Type to use in computing the mean. For integer inputs, the default -// is `float64`; for floating point inputs, it is the same as the -// input dtype. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. -// See :ref:`ufuncs-output-type` for more details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `mean` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// m : ndarray, see dtype parameter above -// If `out=None`, returns a new array containing the mean values, -// otherwise a reference to the output array is returned. -// -// See Also -// -------- -// average : Weighted average -// std, var, nanmean, nanstd, nanvar -// -// Notes -// ----- -// The arithmetic mean is the sum of the elements along the axis divided -// by the number of elements. -// -// Note that for floating-point input, the mean is computed using the -// same precision the input has. Depending on the input data, this can -// cause the results to be inaccurate, especially for `float32` (see -// example below). Specifying a higher-precision accumulator using the -// `dtype` keyword can alleviate this issue. -// -// By default, `float16` results are computed using `float32` intermediates -// for extra precision. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.mean(a) -// 2.5 -// >>> np.mean(a, axis=0) -// array([2., 3.]) -// >>> np.mean(a, axis=1) -// array([1.5, 3.5]) -// -// In single precision, `mean` can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.mean(a) -// 0.54999924 -// -// Computing the mean in float64 is more accurate: -// -// >>> np.mean(a, dtype=np.float64) -// 0.55000000074505806 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) -// >>> np.mean(a) -// 12.0 -// >>> np.mean(a, where=[[True], [False], [False]]) -// 9.0 -// -// -// -//go:linkname Mean py.mean -func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic sine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `arcsinh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that `sinh(z) = x`. The convention is to return the -// `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arcsinh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, it -// returns ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arccos` is a complex analytical function that -// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from -// the right on the former and from the left on the latter. -// -// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arcsinh -// -// Examples -// -------- -// >>> np.arcsinh(np.array([np.e, 10.0])) -// array([ 1.72538256, 2.99822295]) -// -//go:linkname Arcsinh py.arcsinh -func Arcsinh(x *py.Object, out *py.Object) *py.Object -// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the floor of the input, element-wise. -// -// The floor of the scalar `x` is the largest integer `i`, such that -// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The floor of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, trunc, rint, fix -// -// Notes -// ----- -// Some spreadsheet programs calculate the "floor-towards-zero", where -// ``floor(-2.5) == -2``. NumPy instead uses the definition of -// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" -// function is called ``fix`` in NumPy. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.floor(a) -// array([-2., -2., -1., 0., 1., 1., 2.]) -// -//go:linkname Floor py.floor -func Floor(x *py.Object, out *py.Object) *py.Object -// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the non-negative square-root of an array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// The values whose square-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the positive -// square-root of each element in `x`. If any element in `x` is -// complex, a complex array is returned (and the square-roots of -// negative reals are calculated). If all of the elements in `x` -// are real, so is `y`, with negative elements returning ``nan``. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.sqrt -// A version which returns complex numbers when given negative reals. -// Note that 0.0 and -0.0 are handled differently for complex inputs. -// -// Notes -// ----- -// *sqrt* has--consistent with common convention--as its branch cut the -// real "interval" [`-inf`, 0), and is continuous from above on it. -// A branch cut is a curve in the complex plane across which a given -// complex function fails to be continuous. -// -// Examples -// -------- -// >>> np.sqrt([1,4,9]) -// array([ 1., 2., 3.]) -// -// >>> np.sqrt([4, -1, -3+4J]) -// array([ 2.+0.j, 0.+1.j, 1.+2.j]) -// -// >>> np.sqrt([4, -1, np.inf]) -// array([ 2., nan, inf]) -// -//go:linkname Sqrt py.sqrt -func Sqrt(x *py.Object, out *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale. -// -// In linear space, the sequence starts at ``base ** start`` -// (`base` to the power of `start`) and ends with ``base ** stop`` -// (see `endpoint` below). -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.25.0 -// Non-scalar 'base` is now supported -// -// Parameters -// ---------- -// start : array_like -// ``base ** start`` is the starting value of the sequence. -// stop : array_like -// ``base ** stop`` is the final value of the sequence, unless `endpoint` -// is False. In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// base : array_like, optional -// The base of the log space. The step size between the elements in -// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. -// Default is 10.0. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred type will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start, -// stop, or base are array-like. By default (0), the samples will be -// along a new axis inserted at the beginning. Use -1 to get an axis at -// the end. -// -// .. versionadded:: 1.16.0 -// -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. Note that, when used with a float endpoint, the -// endpoint may or may not be included. -// linspace : Similar to logspace, but with the samples uniformly distributed -// in linear space, instead of log space. -// geomspace : Similar to logspace, but with endpoints specified directly. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If base is a scalar, logspace is equivalent to the code -// -// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) -// ... # doctest: +SKIP -// >>> power(base, y).astype(dtype) -// ... # doctest: +SKIP -// -// Examples -// -------- -// >>> np.logspace(2.0, 3.0, num=4) -// array([ 100. , 215.443469 , 464.15888336, 1000. ]) -// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) -// array([100. , 177.827941 , 316.22776602, 562.34132519]) -// >>> np.logspace(2.0, 3.0, num=4, base=2.0) -// array([4. , 5.0396842 , 6.34960421, 8. ]) -// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) -// array([[ 4. , 5.0396842 , 6.34960421, 8. ], -// [ 9. , 12.98024613, 18.72075441, 27. ]]) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) -// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) -// >>> y = np.zeros(N) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Logspace py.logspace -func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Return a scalar type which is common to the input arrays. -// -// The return type will always be an inexact (i.e. floating point) scalar -// type, even if all the arrays are integer arrays. If one of the inputs is -// an integer array, the minimum precision type that is returned is a -// 64-bit floating point dtype. -// -// All input arrays except int64 and uint64 can be safely cast to the -// returned dtype without loss of information. -// -// Parameters -// ---------- -// array1, array2, ... : ndarrays -// Input arrays. -// -// Returns -// ------- -// out : data type code -// Data type code. -// -// See Also -// -------- -// dtype, mintypecode -// -// Examples -// -------- -// >>> np.common_type(np.arange(2, dtype=np.float32)) -// -// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) -// -// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) -// -// -// -// -//go:linkname CommonType py.common_type -func CommonType(__llgo_va_list ...interface{}) *py.Object -// -// Upper triangle of an array. -// -// Return a copy of an array with the elements below the `k`-th diagonal -// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the -// final two axes. -// -// Please refer to the documentation for `tril` for further details. -// -// See Also -// -------- -// tril : lower triangle of an array -// -// Examples -// -------- -// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) -// array([[ 1, 2, 3], -// [ 4, 5, 6], -// [ 0, 8, 9], -// [ 0, 0, 12]]) -// -// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) -// array([[[ 0, 1, 2, 3, 4], -// [ 0, 6, 7, 8, 9], -// [ 0, 0, 12, 13, 14], -// [ 0, 0, 0, 18, 19]], -// [[20, 21, 22, 23, 24], -// [ 0, 26, 27, 28, 29], -// [ 0, 0, 32, 33, 34], -// [ 0, 0, 0, 38, 39]], -// [[40, 41, 42, 43, 44], -// [ 0, 46, 47, 48, 49], -// [ 0, 0, 52, 53, 54], -// [ 0, 0, 0, 58, 59]]]) -// -// -// -//go:linkname Triu py.triu -func Triu(m *py.Object, k *py.Object) *py.Object -// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate ``exp(x) - 1`` for all elements in the array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise exponential minus one: ``out = exp(x) - 1``. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log1p : ``log(1 + x)``, the inverse of expm1. -// -// -// Notes -// ----- -// This function provides greater precision than ``exp(x) - 1`` -// for small values of ``x``. -// -// Examples -// -------- -// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to -// about 32 significant digits. This example shows the superiority of -// expm1 in this case. -// -// >>> np.expm1(1e-10) -// 1.00000000005e-10 -// >>> np.exp(1e-10) - 1 -// 1.000000082740371e-10 -// -//go:linkname Expm1 py.expm1 -func Expm1(x *py.Object, out *py.Object) *py.Object -// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the natural logarithm of one plus the input array, element-wise. -// -// Calculates ``log(1 + x)``. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Natural logarithm of `1 + x`, element-wise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : ``exp(x) - 1``, the inverse of `log1p`. -// -// Notes -// ----- -// For real-valued input, `log1p` is accurate also for `x` so small -// that `1 + x == 1` in floating-point accuracy. -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `exp(z) = 1 + x`. The convention is to return -// the `z` whose imaginary part lies in `[-pi, pi]`. -// -// For real-valued input data types, `log1p` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log1p` is a complex analytical function that -// has a branch cut `[-inf, -1]` and is continuous from above on it. -// `log1p` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log1p(1e-99) -// 1e-99 -// >>> np.log(1 + 1e-99) -// 0.0 -// -//go:linkname Log1p py.log1p -func Log1p(x *py.Object, out *py.Object) *py.Object -// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in -// `x2`. `x1` and `x2` must be broadcastable to the same shape. -// -// An integer type raised to a negative integer power will raise a -// ``ValueError``. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// float_power : power function that promotes integers to float -// -// Examples -// -------- -// Cube each element in an array. -// -// >>> x1 = np.arange(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.power(x1, 3) -// array([ 0, 1, 8, 27, 64, 125]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.power(x1, x2) -// array([[ 0, 1, 8, 27, 16, 5], -// [ 0, 1, 8, 27, 16, 5]]) -// -// The ``**`` operator can be used as a shorthand for ``np.power`` on -// ndarrays. -// -// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) -// >>> x1 = np.arange(6) -// >>> x1 ** x2 -// array([ 0, 1, 8, 27, 16, 5]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1.0, -4.0]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname Power py.power -func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return a 2-D array with ones on the diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the output. -// M : int, optional -// Number of columns in the output. If None, defaults to `N`. -// k : int, optional -// Index of the diagonal: 0 (the default) refers to the main diagonal, -// a positive value refers to an upper diagonal, and a negative value -// to a lower diagonal. -// dtype : data-type, optional -// Data-type of the returned array. -// order : {'C', 'F'}, optional -// Whether the output should be stored in row-major (C-style) or -// column-major (Fortran-style) order in memory. -// -// .. versionadded:: 1.14.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// I : ndarray of shape (N,M) -// An array where all elements are equal to zero, except for the `k`-th -// diagonal, whose values are equal to one. -// -// See Also -// -------- -// identity : (almost) equivalent function -// diag : diagonal 2-D array from a 1-D array specified by the user. -// -// Examples -// -------- -// >>> np.eye(2, dtype=int) -// array([[1, 0], -// [0, 1]]) -// >>> np.eye(3, k=1) -// array([[0., 1., 0.], -// [0., 0., 1.], -// [0., 0., 0.]]) -// -// -// -//go:linkname Eye py.eye -func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Save an array to a binary file in NumPy ``.npy`` format. -// -// Parameters -// ---------- -// file : file, str, or pathlib.Path -// File or filename to which the data is saved. If file is a file-object, -// then the filename is unchanged. If file is a string or Path, a ``.npy`` -// extension will be appended to the filename if it does not already -// have one. -// arr : array_like -// Array data to be saved. -// allow_pickle : bool, optional -// Allow saving object arrays using Python pickles. Reasons for disallowing -// pickles include security (loading pickled data can execute arbitrary -// code) and portability (pickled objects may not be loadable on different -// Python installations, for example if the stored objects require libraries -// that are not available, and not all pickled data is compatible between -// Python 2 and Python 3). -// Default: True -// fix_imports : bool, optional -// Only useful in forcing objects in object arrays on Python 3 to be -// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle -// will try to map the new Python 3 names to the old module names used in -// Python 2, so that the pickle data stream is readable with Python 2. -// -// See Also -// -------- -// savez : Save several arrays into a ``.npz`` archive -// savetxt, load -// -// Notes -// ----- -// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// Any data saved to the file is appended to the end of the file. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// -// >>> x = np.arange(10) -// >>> np.save(outfile, x) -// -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> np.load(outfile) -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// >>> with open('test.npy', 'wb') as f: -// ... np.save(f, np.array([1, 2])) -// ... np.save(f, np.array([1, 3])) -// >>> with open('test.npy', 'rb') as f: -// ... a = np.load(f) -// ... b = np.load(f) -// >>> print(a, b) -// # [1 2] [1 3] -// -// -//go:linkname Save py.save -func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Mat py.mat -func Mat(data *py.Object, dtype *py.Object) *py.Object -// -// Return a new array of given shape and type, filled with `fill_value`. -// -// Parameters -// ---------- -// shape : int or sequence of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// fill_value : scalar or array_like -// Fill value. -// dtype : data-type, optional -// The desired data-type for the array The default, None, means -// ``np.array(fill_value).dtype``. -// order : {'C', 'F'}, optional -// Whether to store multidimensional data in C- or Fortran-contiguous -// (row- or column-wise) order in memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the given shape, dtype, and order. -// -// See Also -// -------- -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// -// Examples -// -------- -// >>> np.full((2, 2), np.inf) -// array([[inf, inf], -// [inf, inf]]) -// >>> np.full((2, 2), 10) -// array([[10, 10], -// [10, 10]]) -// -// >>> np.full((2, 2), [1, 2]) -// array([[1, 2], -// [1, 2]]) -// -// -// -//go:linkname Full py.full -func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conjugate py.conjugate -func Conjugate(x *py.Object, out *py.Object) *py.Object -// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Subtract arguments, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays to be subtracted from each other. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The difference of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// Equivalent to ``x1 - x2`` in terms of array broadcasting. -// -// Examples -// -------- -// >>> np.subtract(1.0, 4.0) -// -3.0 -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.subtract(x1, x2) -// array([[ 0., 0., 0.], -// [ 3., 3., 3.], -// [ 6., 6., 6.]]) -// -// The ``-`` operator can be used as a shorthand for ``np.subtract`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> x1 - x2 -// array([[0., 0., 0.], -// [3., 3., 3.], -// [6., 6., 6.]]) -// -//go:linkname Subtract py.subtract -func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// bincount(x, /, weights=None, minlength=0) -// -// Count number of occurrences of each value in array of non-negative ints. -// -// The number of bins (of size 1) is one larger than the largest value in -// `x`. If `minlength` is specified, there will be at least this number -// of bins in the output array (though it will be longer if necessary, -// depending on the contents of `x`). -// Each bin gives the number of occurrences of its index value in `x`. -// If `weights` is specified the input array is weighted by it, i.e. if a -// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead -// of ``out[n] += 1``. -// -// Parameters -// ---------- -// x : array_like, 1 dimension, nonnegative ints -// Input array. -// weights : array_like, optional -// Weights, array of the same shape as `x`. -// minlength : int, optional -// A minimum number of bins for the output array. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// out : ndarray of ints -// The result of binning the input array. -// The length of `out` is equal to ``np.amax(x)+1``. -// -// Raises -// ------ -// ValueError -// If the input is not 1-dimensional, or contains elements with negative -// values, or if `minlength` is negative. -// TypeError -// If the type of the input is float or complex. -// -// See Also -// -------- -// histogram, digitize, unique -// -// Examples -// -------- -// >>> np.bincount(np.arange(5)) -// array([1, 1, 1, 1, 1]) -// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) -// array([1, 3, 1, 1, 0, 0, 0, 1]) -// -// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) -// >>> np.bincount(x).size == np.amax(x)+1 -// True -// -// The input array needs to be of integer dtype, otherwise a -// TypeError is raised: -// -// >>> np.bincount(np.arange(5, dtype=float)) -// Traceback (most recent call last): -// ... -// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') -// according to the rule 'safe' -// -// A possible use of ``bincount`` is to perform sums over -// variable-size chunks of an array, using the ``weights`` keyword. -// -// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights -// >>> x = np.array([0, 1, 1, 2, 2, 2]) -// >>> np.bincount(x, weights=w) -// array([ 0.3, 0.7, 1.1]) -// -// -// -//go:linkname Bincount py.bincount -func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object -// -// The differences between consecutive elements of an array. -// -// Parameters -// ---------- -// ary : array_like -// If necessary, will be flattened before the differences are taken. -// to_end : array_like, optional -// Number(s) to append at the end of the returned differences. -// to_begin : array_like, optional -// Number(s) to prepend at the beginning of the returned differences. -// -// Returns -// ------- -// ediff1d : ndarray -// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. -// -// See Also -// -------- -// diff, gradient -// -// Notes -// ----- -// When applied to masked arrays, this function drops the mask information -// if the `to_begin` and/or `to_end` parameters are used. -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.ediff1d(x) -// array([ 1, 2, 3, -7]) -// -// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) -// array([-99, 1, 2, ..., -7, 88, 99]) -// -// The returned array is always 1D. -// -// >>> y = [[1, 2, 4], [1, 6, 24]] -// >>> np.ediff1d(y) -// array([ 1, 2, -3, 5, 18]) -// -// -// -//go:linkname Ediff1d py.ediff1d -func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis, while -// ignoring NaNs. -// -// Returns the standard deviation, a measure of the spread of a -// distribution, of the non-NaN array elements. The standard deviation is -// computed for the flattened array by default, otherwise over the -// specified axis. -// -// For all-NaN slices or slices with zero degrees of freedom, NaN is -// returned and a `RuntimeWarning` is raised. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of the non-NaN values. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the standard deviation is computed. The default is -// to compute the standard deviation of the flattened array. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it -// is the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the -// calculated values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of non-NaN -// elements. By default `ddof` is zero. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this value is anything but the default it is passed through -// as-is to the relevant functions of the sub-classes. If these -// functions do not have a `keepdims` kwarg, a RuntimeError will -// be raised. -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard -// deviation, otherwise return a reference to the output array. If -// ddof is >= the number of non-NaN elements in a slice or the slice -// contains only NaNs, then the result for that slice is NaN. -// -// See Also -// -------- -// var, mean, std -// nanvar, nanmean -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. -// -// The average squared deviation is normally calculated as -// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is -// specified, the divisor ``N - ddof`` is used instead. In standard -// statistical practice, ``ddof=1`` provides an unbiased estimator of the -// variance of the infinite population. ``ddof=0`` provides a maximum -// likelihood estimate of the variance for normally distributed variables. -// The standard deviation computed in this function is the square root of -// the estimated variance, so even with ``ddof=1``, it will not be an -// unbiased estimate of the standard deviation per se. -// -// Note that, for complex numbers, `std` takes the absolute value before -// squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example -// below). Specifying a higher-accuracy accumulator using the `dtype` -// keyword can alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, np.nan], [3, 4]]) -// >>> np.nanstd(a) -// 1.247219128924647 -// >>> np.nanstd(a, axis=0) -// array([1., 0.]) -// >>> np.nanstd(a, axis=1) -// array([0., 0.5]) # may vary -// -// -// -//go:linkname Nanstd py.nanstd -func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -// -// Compute the multidimensional histogram of some data. -// -// Parameters -// ---------- -// sample : (N, D) array, or (N, D) array_like -// The data to be histogrammed. -// -// Note the unusual interpretation of sample when an array_like: -// -// * When an array, each row is a coordinate in a D-dimensional space - -// such as ``histogramdd(np.array([p1, p2, p3]))``. -// * When an array_like, each element is the list of values for single -// coordinate - such as ``histogramdd((X, Y, Z))``. -// -// The first form should be preferred. -// -// bins : sequence or int, optional -// The bin specification: -// -// * A sequence of arrays describing the monotonically increasing bin -// edges along each dimension. -// * The number of bins for each dimension (nx, ny, ... =bins) -// * The number of bins for all dimensions (nx=ny=...=bins). -// -// range : sequence, optional -// A sequence of length D, each an optional (lower, upper) tuple giving -// the outer bin edges to be used if the edges are not given explicitly in -// `bins`. -// An entry of None in the sequence results in the minimum and maximum -// values being used for the corresponding dimension. -// The default, None, is equivalent to passing a tuple of D None values. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_volume``. -// weights : (N,) array_like, optional -// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. -// Weights are normalized to 1 if density is True. If density is False, -// the values of the returned histogram are equal to the sum of the -// weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray -// The multidimensional histogram of sample x. See density and weights -// for the different possible semantics. -// edges : list -// A list of D arrays describing the bin edges for each dimension. -// -// See Also -// -------- -// histogram: 1-D histogram -// histogram2d: 2-D histogram -// -// Examples -// -------- -// >>> r = np.random.randn(100,3) -// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) -// >>> H.shape, edges[0].size, edges[1].size, edges[2].size -// ((5, 8, 4), 6, 9, 5) -// -// -// -//go:linkname Histogramdd py.histogramdd -func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Interpret the input as a matrix. -// -// Unlike `matrix`, `asmatrix` does not make a copy if the input is already -// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. -// -// Parameters -// ---------- -// data : array_like -// Input data. -// dtype : data-type -// Data-type of the output matrix. -// -// Returns -// ------- -// mat : matrix -// `data` interpreted as a matrix. -// -// Examples -// -------- -// >>> x = np.array([[1, 2], [3, 4]]) -// -// >>> m = np.asmatrix(x) -// -// >>> x[0,0] = 5 -// -// >>> m -// matrix([[5, 2], -// [3, 4]]) -// -// -// -//go:linkname Asmatrix py.asmatrix -func Asmatrix(data *py.Object, dtype *py.Object) *py.Object -// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) -// -// Matrix product of two arrays. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays, scalars not allowed. -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not -// provided or None, a freshly-allocated array is returned. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.16 -// Now handles ufunc kwargs -// -// Returns -// ------- -// y : ndarray -// The matrix product of the inputs. -// This is a scalar only when both x1, x2 are 1-d vectors. -// -// Raises -// ------ -// ValueError -// If the last dimension of `x1` is not the same size as -// the second-to-last dimension of `x2`. -// -// If a scalar value is passed in. -// -// See Also -// -------- -// vdot : Complex-conjugating dot product. -// tensordot : Sum products over arbitrary axes. -// einsum : Einstein summation convention. -// dot : alternative matrix product with different broadcasting rules. -// -// Notes -// ----- -// -// The behavior depends on the arguments in the following way. -// -// - If both arguments are 2-D they are multiplied like conventional -// matrices. -// - If either argument is N-D, N > 2, it is treated as a stack of -// matrices residing in the last two indexes and broadcast accordingly. -// - If the first argument is 1-D, it is promoted to a matrix by -// prepending a 1 to its dimensions. After matrix multiplication -// the prepended 1 is removed. -// - If the second argument is 1-D, it is promoted to a matrix by -// appending a 1 to its dimensions. After matrix multiplication -// the appended 1 is removed. -// -// ``matmul`` differs from ``dot`` in two important ways: -// -// - Multiplication by scalars is not allowed, use ``*`` instead. -// - Stacks of matrices are broadcast together as if the matrices -// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: -// -// >>> a = np.ones([9, 5, 7, 4]) -// >>> c = np.ones([9, 5, 4, 3]) -// >>> np.dot(a, c).shape -// (9, 5, 7, 9, 5, 3) -// >>> np.matmul(a, c).shape -// (9, 5, 7, 3) -// >>> # n is 7, k is 4, m is 3 -// -// The matmul function implements the semantics of the ``@`` operator -// introduced in Python 3.5 following :pep:`465`. -// -// It uses an optimized BLAS library when possible (see `numpy.linalg`). -// -// Examples -// -------- -// For 2-D arrays it is the matrix product: -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([[4, 1], -// ... [2, 2]]) -// >>> np.matmul(a, b) -// array([[4, 1], -// [2, 2]]) -// -// For 2-D mixed with 1-D, the result is the usual. -// -// >>> a = np.array([[1, 0], -// ... [0, 1]]) -// >>> b = np.array([1, 2]) -// >>> np.matmul(a, b) -// array([1, 2]) -// >>> np.matmul(b, a) -// array([1, 2]) -// -// -// Broadcasting is conventional for stacks of arrays -// -// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) -// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) -// >>> np.matmul(a,b).shape -// (2, 2, 2) -// >>> np.matmul(a, b)[0, 1, 1] -// 98 -// >>> sum(a[0, 1, :] * b[0 , :, 1]) -// 98 -// -// Vector, vector returns the scalar inner product, but neither argument -// is complex-conjugated: -// -// >>> np.matmul([2j, 3j], [2j, 3j]) -// (-13+0j) -// -// Scalar multiplication raises an error. -// -// >>> np.matmul([1,2], 3) -// Traceback (most recent call last): -// ... -// ValueError: matmul: Input operand 1 does not have enough dimensions ... -// -// The ``@`` operator can be used as a shorthand for ``np.matmul`` on -// ndarrays. -// -// >>> x1 = np.array([2j, 3j]) -// >>> x2 = np.array([2j, 3j]) -// >>> x1 @ x2 -// (-13+0j) -// -// .. versionadded:: 1.10.0 -// -//go:linkname Matmul py.matmul -func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Check if all elements of input array are true. -// -// .. deprecated:: 1.25.0 -// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `all` instead. -// -// See Also -// -------- -// numpy.all : Equivalent function; see for details. -// -// -//go:linkname Alltrue py.alltrue -func Alltrue(__llgo_va_list ...interface{}) *py.Object -// -// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// Calculates which of the given dates are valid days, and which are not. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of bool, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of bool -// An array with the same shape as ``dates``, containing True for -// each valid day, and False for each invalid day. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// busday_offset : Applies an offset counted in valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # The weekdays are Friday, Saturday, and Monday -// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], -// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) -// array([False, False, True]) -// -// -//go:linkname IsBusday py.is_busday -func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return a string representation of the data in an array. -// -// The data in the array is returned as a single string. This function is -// similar to `array_repr`, the difference being that `array_repr` also -// returns information on the kind of array and its data type. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// See Also -// -------- -// array2string, array_repr, set_printoptions -// -// Examples -// -------- -// >>> np.array_str(np.arange(3)) -// '[0 1 2]' -// -// -// -//go:linkname ArrayStr py.array_str -func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Expand the shape of an array. -// -// Insert a new axis that will appear at the `axis` position in the expanded -// array shape. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int or tuple of ints -// Position in the expanded axes where the new axis (or axes) is placed. -// -// .. deprecated:: 1.13.0 -// Passing an axis where ``axis > a.ndim`` will be treated as -// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will -// be treated as ``axis == 0``. This behavior is deprecated. -// -// .. versionchanged:: 1.18.0 -// A tuple of axes is now supported. Out of range axes as -// described above are now forbidden and raise an `AxisError`. -// -// Returns -// ------- -// result : ndarray -// View of `a` with the number of dimensions increased. -// -// See Also -// -------- -// squeeze : The inverse operation, removing singleton dimensions -// reshape : Insert, remove, and combine dimensions, and resize existing ones -// doc.indexing, atleast_1d, atleast_2d, atleast_3d -// -// Examples -// -------- -// >>> x = np.array([1, 2]) -// >>> x.shape -// (2,) -// -// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=0) -// >>> y -// array([[1, 2]]) -// >>> y.shape -// (1, 2) -// -// The following is equivalent to ``x[:, np.newaxis]``: -// -// >>> y = np.expand_dims(x, axis=1) -// >>> y -// array([[1], -// [2]]) -// >>> y.shape -// (2, 1) -// -// ``axis`` may also be a tuple: -// -// >>> y = np.expand_dims(x, axis=(0, 1)) -// >>> y -// array([[[1, 2]]]) -// -// >>> y = np.expand_dims(x, axis=(2, 0)) -// >>> y -// array([[[1], -// [2]]]) -// -// Note that some examples may use ``None`` instead of ``np.newaxis``. These -// are the same objects: -// -// >>> np.newaxis is None -// True -// -// -// -//go:linkname ExpandDims py.expand_dims -func ExpandDims(a *py.Object, axis *py.Object) *py.Object -// -// Return an array of ones with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of ones with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// ones : Return a new array setting values to one. -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> x = x.reshape((2, 3)) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.ones_like(x) -// array([[1, 1, 1], -// [1, 1, 1]]) -// -// >>> y = np.arange(3, dtype=float) -// >>> y -// array([0., 1., 2.]) -// >>> np.ones_like(y) -// array([1., 1., 1.]) -// -// -// -//go:linkname OnesLike py.ones_like -func OnesLike(__llgo_va_list ...interface{}) *py.Object -// -// Return True if x is a not complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. So even if the input -// has an imaginary part equal to zero, `isrealobj` evaluates to False -// if the data type is complex. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// y : bool -// The return value, False if `x` is of a complex type. -// -// See Also -// -------- -// iscomplexobj, isreal -// -// Notes -// ----- -// The function is only meant for arrays with numerical values but it -// accepts all other objects. Since it assumes array input, the return -// value of other objects may be True. -// -// >>> np.isrealobj('A string') -// True -// >>> np.isrealobj(False) -// True -// >>> np.isrealobj(None) -// True -// -// Examples -// -------- -// >>> np.isrealobj(1) -// True -// >>> np.isrealobj(1+0j) -// False -// >>> np.isrealobj([3, 1+0j, True]) -// False -// -// -// -//go:linkname Isrealobj py.isrealobj -func Isrealobj(x *py.Object) *py.Object -// -// Sort a complex array using the real part first, then the imaginary part. -// -// Parameters -// ---------- -// a : array_like -// Input array -// -// Returns -// ------- -// out : complex ndarray -// Always returns a sorted complex array. -// -// Examples -// -------- -// >>> np.sort_complex([5, 3, 6, 2, 1]) -// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) -// -// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) -// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) -// -// -// -//go:linkname SortComplex py.sort_complex -func SortComplex(a *py.Object) *py.Object -// -// Return the Blackman window. -// -// The Blackman window is a taper formed by using the first three -// terms of a summation of cosines. It was designed to have close to the -// minimal leakage possible. It is close to optimal, only slightly worse -// than a Kaiser window. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an empty -// array is returned. -// -// Returns -// ------- -// out : ndarray -// The window, with the maximum value normalized to one (the value one -// appears only if the number of samples is odd). -// -// See Also -// -------- -// bartlett, hamming, hanning, kaiser -// -// Notes -// ----- -// The Blackman window is defined as -// -// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) -// -// Most references to the Blackman window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. It is also known as an apodization (which means -// "removing the foot", i.e. smoothing discontinuities at the beginning -// and end of the sampled signal) or tapering function. It is known as a -// "near optimal" tapering function, almost as good (by some measures) -// as the kaiser window. -// -// References -// ---------- -// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, -// Dover Publications, New York. -// -// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. -// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.blackman(12) -// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary -// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, -// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, -// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) -// -// Plot the window and the frequency response: -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.blackman(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Blackman window") -// Text(0.5, 1.0, 'Blackman window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Blackman window") -// Text(0.5, 1.0, 'Frequency response of Blackman window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Blackman py.blackman -func Blackman(M *py.Object) *py.Object -// -// Broadcast the input shapes into a single shape. -// -// :ref:`Learn more about broadcasting here `. -// -// .. versionadded:: 1.20.0 -// -// Parameters -// ---------- -// `*args` : tuples of ints, or ints -// The shapes to be broadcast against each other. -// -// Returns -// ------- -// tuple -// Broadcasted shape. -// -// Raises -// ------ -// ValueError -// If the shapes are not compatible and cannot be broadcast according -// to NumPy's broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_to -// -// Examples -// -------- -// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) -// (3, 2) -// -// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) -// (5, 6, 7) -// -// -//go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object -// -// Find the union of two arrays. -// -// Return the unique, sorted array of values that are in either of the two -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. They are flattened if they are not already 1D. -// -// Returns -// ------- -// union1d : ndarray -// Unique, sorted union of the input arrays. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) -// array([-2, -1, 0, 1, 2]) -// -// To find the union of more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([1, 2, 3, 4, 6]) -// -// -//go:linkname Union1d py.union1d -func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object -// -// Find the indices of array elements that are non-zero, grouped by element. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// index_array : (N, a.ndim) ndarray -// Indices of elements that are non-zero. Indices are grouped by element. -// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of -// non-zero items. -// -// See Also -// -------- -// where, nonzero -// -// Notes -// ----- -// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, -// but produces a result of the correct shape for a 0D array. -// -// The output of ``argwhere`` is not suitable for indexing arrays. -// For this purpose use ``nonzero(a)`` instead. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.argwhere(x>1) -// array([[0, 2], -// [1, 0], -// [1, 1], -// [1, 2]]) -// -// -// -//go:linkname Argwhere py.argwhere -func Argwhere(a *py.Object) *py.Object -// -// True if two arrays have the same shape and elements, False otherwise. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// equal_nan : bool -// Whether to compare NaN's as equal. If the dtype of a1 and a2 is -// complex, values will be considered equal if either the real or the -// imaginary component of a given value is ``nan``. -// -// .. versionadded:: 1.19.0 -// -// Returns -// ------- -// b : bool -// Returns True if the arrays are equal. -// -// See Also -// -------- -// allclose: Returns True if two arrays are element-wise equal within a -// tolerance. -// array_equiv: Returns True if input arrays are shape consistent and all -// elements equal. -// -// Examples -// -------- -// >>> np.array_equal([1, 2], [1, 2]) -// True -// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) -// True -// >>> np.array_equal([1, 2], [1, 2, 3]) -// False -// >>> np.array_equal([1, 2], [1, 4]) -// False -// >>> a = np.array([1, np.nan]) -// >>> np.array_equal(a, a) -// False -// >>> np.array_equal(a, a, equal_nan=True) -// True -// -// When ``equal_nan`` is True, complex values with nan components are -// considered equal if either the real *or* the imaginary components are nan. -// -// >>> a = np.array([1 + 1j]) -// >>> b = a.copy() -// >>> a.real = np.nan -// >>> b.imag = np.nan -// >>> np.array_equal(a, b, equal_nan=True) -// True -// -// -//go:linkname ArrayEqual py.array_equal -func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object -// -// Join a sequence of arrays along a new axis. -// -// The ``axis`` parameter specifies the index of the new axis in the -// dimensions of the result. For example, if ``axis=0`` it will be the first -// dimension and if ``axis=-1`` it will be the last dimension. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// arrays : sequence of array_like -// Each array must have the same shape. -// -// axis : int, optional -// The axis in the result array along which the input arrays are stacked. -// -// out : ndarray, optional -// If provided, the destination to place the result. The shape must be -// correct, matching that of what stack would have returned if no -// out argument were specified. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// -// Returns -// ------- -// stacked : ndarray -// The stacked array has one more dimension than the input arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// block : Assemble an nd-array from nested lists of blocks. -// split : Split array into a list of multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] -// >>> np.stack(arrays, axis=0).shape -// (10, 3, 4) -// -// >>> np.stack(arrays, axis=1).shape -// (3, 10, 4) -// -// >>> np.stack(arrays, axis=2).shape -// (3, 4, 10) -// -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.stack((a, b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> np.stack((a, b), axis=-1) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Stack py.stack -func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Returns a bool array, where True if input element is complex. -// -// What is tested is whether the input has a non-zero imaginary part, not if -// the input type is complex. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray of bools -// Output array. -// -// See Also -// -------- -// isreal -// iscomplexobj : Return True if x is a complex type or an array of complex -// numbers. -// -// Examples -// -------- -// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) -// array([ True, False, False, False, False, True]) -// -// -// -//go:linkname Iscomplex py.iscomplex -func Iscomplex(x *py.Object) *py.Object -// -// Return an array converted to a float type. -// -// Parameters -// ---------- -// a : array_like -// The input array. -// dtype : str or dtype object, optional -// Float type code to coerce input array `a`. If `dtype` is one of the -// 'int' dtypes, it is replaced with float64. -// -// Returns -// ------- -// out : ndarray -// The input `a` as a float ndarray. -// -// Examples -// -------- -// >>> np.asfarray([2, 3]) -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='float') -// array([2., 3.]) -// >>> np.asfarray([2, 3], dtype='int8') -// array([2., 3.]) -// -// -// -//go:linkname Asfarray py.asfarray -func Asfarray(a *py.Object, dtype *py.Object) *py.Object -// -// Rotate an array by 90 degrees in the plane specified by axes. -// -// Rotation direction is from the first towards the second axis. -// This means for a 2D array with the default `k` and `axes`, the -// rotation will be counterclockwise. -// -// Parameters -// ---------- -// m : array_like -// Array of two or more dimensions. -// k : integer -// Number of times the array is rotated by 90 degrees. -// axes : (2,) array_like -// The array is rotated in the plane defined by the axes. -// Axes must be different. -// -// .. versionadded:: 1.12.0 -// -// Returns -// ------- -// y : ndarray -// A rotated view of `m`. -// -// See Also -// -------- -// flip : Reverse the order of elements in an array along the given axis. -// fliplr : Flip an array horizontally. -// flipud : Flip an array vertically. -// -// Notes -// ----- -// ``rot90(m, k=1, axes=(1,0))`` is the reverse of -// ``rot90(m, k=1, axes=(0,1))`` -// -// ``rot90(m, k=1, axes=(1,0))`` is equivalent to -// ``rot90(m, k=-1, axes=(0,1))`` -// -// Examples -// -------- -// >>> m = np.array([[1,2],[3,4]], int) -// >>> m -// array([[1, 2], -// [3, 4]]) -// >>> np.rot90(m) -// array([[2, 4], -// [1, 3]]) -// >>> np.rot90(m, 2) -// array([[4, 3], -// [2, 1]]) -// >>> m = np.arange(8).reshape((2,2,2)) -// >>> np.rot90(m, 1, (1,2)) -// array([[[1, 3], -// [0, 2]], -// [[5, 7], -// [4, 6]]]) -// -// -// -//go:linkname Rot90 py.rot90 -func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object -// -// Return a new array with sub-arrays along an axis deleted. For a one -// dimensional array, this returns those entries not returned by -// `arr[obj]`. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : slice, int or array of ints -// Indicate indices of sub-arrays to remove along the specified axis. -// -// .. versionchanged:: 1.19.0 -// Boolean indices are now treated as a mask of elements to remove, -// rather than being cast to the integers 0 and 1. -// -// axis : int, optional -// The axis along which to delete the subarray defined by `obj`. -// If `axis` is None, `obj` is applied to the flattened array. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with the elements specified by `obj` removed. Note -// that `delete` does not occur in-place. If `axis` is None, `out` is -// a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// append : Append elements at the end of an array. -// -// Notes -// ----- -// Often it is preferable to use a boolean mask. For example: -// -// >>> arr = np.arange(12) + 1 -// >>> mask = np.ones(len(arr), dtype=bool) -// >>> mask[[0,2,4]] = False -// >>> result = arr[mask,...] -// -// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further -// use of `mask`. -// -// Examples -// -------- -// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) -// >>> arr -// array([[ 1, 2, 3, 4], -// [ 5, 6, 7, 8], -// [ 9, 10, 11, 12]]) -// >>> np.delete(arr, 1, 0) -// array([[ 1, 2, 3, 4], -// [ 9, 10, 11, 12]]) -// -// >>> np.delete(arr, np.s_[::2], 1) -// array([[ 2, 4], -// [ 6, 8], -// [10, 12]]) -// >>> np.delete(arr, [1,3,5], None) -// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) -// -// -// -//go:linkname Delete py.delete -func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object -// -// Return the product of array elements over a given axis treating Not a -// Numbers (NaNs) as ones. -// -// One is returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose product is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the product is computed. The default is to compute -// the product of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// keepdims : bool, optional -// If True, the axes which are reduced are left in the result as -// dimensions with size one. With this option, the result will -// broadcast correctly against the original `arr`. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.prod : Product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nanprod(1) -// 1 -// >>> np.nanprod([1]) -// 1 -// >>> np.nanprod([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanprod(a) -// 6.0 -// >>> np.nanprod(a, axis=0) -// array([3., 2.]) -// -// -// -//go:linkname Nanprod py.nanprod -func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Returns True if input arrays are shape consistent and all elements equal. -// -// Shape consistent means they are either the same shape, or one input array -// can be broadcasted to create the same shape as the other one. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Input arrays. -// -// Returns -// ------- -// out : bool -// True if equivalent, False otherwise. -// -// Examples -// -------- -// >>> np.array_equiv([1, 2], [1, 2]) -// True -// >>> np.array_equiv([1, 2], [1, 3]) -// False -// -// Showing the shape equivalence: -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) -// True -// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) -// False -// -// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) -// False -// -// -// -//go:linkname ArrayEquiv py.array_equiv -func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object -// -// Return the binary representation of the input number as a string. -// -// For negative numbers, if width is not given, a minus sign is added to the -// front. If width is given, the two's complement of the number is -// returned, with respect to that width. -// -// In a two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit two's-complement -// system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// num : int -// Only an integer decimal number can be used. -// width : int, optional -// The length of the returned string if `num` is positive, or the length -// of the two's complement if `num` is negative, provided that `width` is -// at least a sufficient number of bits for `num` to be represented in the -// designated form. -// -// If the `width` value is insufficient, it will be ignored, and `num` will -// be returned in binary (`num` > 0) or two's complement (`num` < 0) form -// with its width equal to the minimum number of bits needed to represent -// the number in the designated form. This behavior is deprecated and will -// later raise an error. -// -// .. deprecated:: 1.12.0 -// -// Returns -// ------- -// bin : str -// Binary representation of `num` or two's complement of `num`. -// -// See Also -// -------- -// base_repr: Return a string representation of a number in the given base -// system. -// bin: Python's built-in binary representation generator of an integer. -// -// Notes -// ----- -// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x -// faster. -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// >>> np.binary_repr(3) -// '11' -// >>> np.binary_repr(-3) -// '-11' -// >>> np.binary_repr(3, width=4) -// '0011' -// -// The two's complement is returned when the input number is negative and -// width is specified: -// -// >>> np.binary_repr(-3, width=3) -// '101' -// >>> np.binary_repr(-3, width=5) -// '11101' -// -// -// -//go:linkname BinaryRepr py.binary_repr -func BinaryRepr(num *py.Object, width *py.Object) *py.Object -// -// Test whether all array elements along a given axis evaluate to True. -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a logical AND reduction is performed. -// The default (``axis=None``) is to perform a logical AND over all -// the dimensions of the input array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : ndarray, optional -// Alternate output array in which to place the result. -// It must have the same shape as the expected output and its -// type is preserved (e.g., if ``dtype(out)`` is float, the result -// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more -// details. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `all` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in checking for all `True` values. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// all : ndarray, bool -// A new boolean or array is returned unless `out` is specified, -// in which case a reference to `out` is returned. -// -// See Also -// -------- -// ndarray.all : equivalent method -// -// any : Test whether any element along a given axis evaluates to True. -// -// Notes -// ----- -// Not a Number (NaN), positive infinity and negative infinity -// evaluate to `True` because these are not equal to zero. -// -// Examples -// -------- -// >>> np.all([[True,False],[True,True]]) -// False -// -// >>> np.all([[True,False],[True,True]], axis=0) -// array([ True, False]) -// -// >>> np.all([-1, 4, 5]) -// True -// -// >>> np.all([1.0, np.nan]) -// True -// -// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) -// True -// -// >>> o=np.array(False) -// >>> z=np.all([-1, 4, 5], out=o) -// >>> id(z), id(o), z -// (28293632, 28293632, array(True)) # may vary -// -// -// -//go:linkname All py.all -func All(__llgo_va_list ...interface{}) *py.Object -// -// Return the number of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : int, optional -// Axis along which the elements are counted. By default, give -// the total number of elements. -// -// Returns -// ------- -// element_count : int -// Number of elements along the specified axis. -// -// See Also -// -------- -// shape : dimensions of array -// ndarray.shape : dimensions of array -// ndarray.size : number of elements in array -// -// Examples -// -------- -// >>> a = np.array([[1,2,3],[4,5,6]]) -// >>> np.size(a) -// 6 -// >>> np.size(a,1) -// 3 -// >>> np.size(a,0) -// 2 -// -// -// -//go:linkname Size py.size -func Size(a *py.Object, axis *py.Object) *py.Object -// -// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) -// -// Counts the number of valid days between `begindates` and -// `enddates`, not including the day of `enddates`. -// -// If ``enddates`` specifies a date value that is earlier than the -// corresponding ``begindates`` date value, the count will be negative. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// begindates : array_like of datetime64[D] -// The array of the first dates for counting. -// enddates : array_like of datetime64[D] -// The array of the end dates for counting, which are excluded -// from the count themselves. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of int, optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of int -// An array with a shape from broadcasting ``begindates`` and ``enddates`` -// together, containing the number of valid days between -// the begin and end dates. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_offset : Applies an offset counted in valid days. -// -// Examples -// -------- -// >>> # Number of weekdays in January 2011 -// ... np.busday_count('2011-01', '2011-02') -// 21 -// >>> # Number of weekdays in 2011 -// >>> np.busday_count('2011', '2012') -// 260 -// >>> # Number of Saturdays in 2011 -// ... np.busday_count('2011', '2012', weekmask='Sat') -// 53 -// -// -//go:linkname BusdayCount py.busday_count -func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Compute the qth quantile of the data along the specified axis, -// while ignoring nan values. -// Returns the qth quantile(s) of the array elements. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The -// default is to compute the quantile(s) along a flattened -// version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probability levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// quantile -// nanmean, nanmedian -// nanmedian : equivalent to ``nanquantile(..., 0.5)`` -// nanpercentile : same as nanquantile, but with q in the range [0, 100]. -// -// Notes -// ----- -// For more information please see `numpy.quantile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.quantile(a, 0.5) -// nan -// >>> np.nanquantile(a, 0.5) -// 3.0 -// >>> np.nanquantile(a, 0.5, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanquantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanquantile(a, 0.5, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// >>> b = a.copy() -// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanquantile py.nanquantile -func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// empty(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, without initializing entries. -// -// Parameters -// ---------- -// shape : int or tuple of int -// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// Desired output data-type for the array, e.g, `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data of the given shape, dtype, and -// order. Object arrays will be initialized to None. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// `empty`, unlike `zeros`, does not set the array values to zero, -// and may therefore be marginally faster. On the other hand, it requires -// the user to manually set all the values in the array, and should be -// used with caution. -// -// Examples -// -------- -// >>> np.empty([2, 2]) -// array([[ -9.74499359e+001, 6.69583040e-309], -// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized -// -// >>> np.empty([2, 2], dtype=int) -// array([[-1073741821, -1067949133], -// [ 496041986, 19249760]]) #uninitialized -// -//go:linkname Empty py.empty -func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// Return a list of coordinate matrices from coordinate vectors. -// -// Make N-D coordinate arrays for vectorized evaluations of -// N-D scalar/vector fields over N-D grids, given -// one-dimensional coordinate arrays x1, x2,..., xn. -// -// .. versionchanged:: 1.9 -// 1-D and 0-D cases are allowed. -// -// Parameters -// ---------- -// x1, x2,..., xn : array_like -// 1-D arrays representing the coordinates of a grid. -// indexing : {'xy', 'ij'}, optional -// Cartesian ('xy', default) or matrix ('ij') indexing of output. -// See Notes for more details. -// -// .. versionadded:: 1.7.0 -// sparse : bool, optional -// If True the shape of the returned coordinate array for dimension *i* -// is reduced from ``(N1, ..., Ni, ... Nn)`` to -// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are -// intended to be use with :ref:`basics.broadcasting`. When all -// coordinates are used in an expression, broadcasting still leads to a -// fully-dimensonal result array. -// -// Default is False. -// -// .. versionadded:: 1.7.0 -// copy : bool, optional -// If False, a view into the original arrays are returned in order to -// conserve memory. Default is True. Please note that -// ``sparse=False, copy=False`` will likely return non-contiguous -// arrays. Furthermore, more than one element of a broadcast array -// may refer to a single memory location. If you need to write to the -// arrays, make copies first. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// X1, X2,..., XN : list of ndarrays -// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, -// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' -// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' -// with the elements of `xi` repeated to fill the matrix along -// the first dimension for `x1`, the second for `x2` and so on. -// -// Notes -// ----- -// This function supports both indexing conventions through the indexing -// keyword argument. Giving the string 'ij' returns a meshgrid with -// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. -// In the 2-D case with inputs of length M and N, the outputs are of shape -// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case -// with inputs of length M, N and P, outputs are of shape (N, M, P) for -// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is -// illustrated by the following code snippet:: -// -// xv, yv = np.meshgrid(x, y, indexing='ij') -// for i in range(nx): -// for j in range(ny): -// # treat xv[i,j], yv[i,j] -// -// xv, yv = np.meshgrid(x, y, indexing='xy') -// for i in range(nx): -// for j in range(ny): -// # treat xv[j,i], yv[j,i] -// -// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. -// -// See Also -// -------- -// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. -// ogrid : Construct an open multi-dimensional "meshgrid" using indexing -// notation. -// how-to-index -// -// Examples -// -------- -// >>> nx, ny = (3, 2) -// >>> x = np.linspace(0, 1, nx) -// >>> y = np.linspace(0, 1, ny) -// >>> xv, yv = np.meshgrid(x, y) -// >>> xv -// array([[0. , 0.5, 1. ], -// [0. , 0.5, 1. ]]) -// >>> yv -// array([[0., 0., 0.], -// [1., 1., 1.]]) -// -// The result of `meshgrid` is a coordinate grid: -// -// >>> import matplotlib.pyplot as plt -// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') -// >>> plt.show() -// -// You can create sparse output arrays to save memory and computation time. -// -// >>> xv, yv = np.meshgrid(x, y, sparse=True) -// >>> xv -// array([[0. , 0.5, 1. ]]) -// >>> yv -// array([[0.], -// [1.]]) -// -// `meshgrid` is very useful to evaluate functions on a grid. If the -// function depends on all coordinates, both dense and sparse outputs can be -// used. -// -// >>> x = np.linspace(-5, 5, 101) -// >>> y = np.linspace(-5, 5, 101) -// >>> # full coordinate arrays -// >>> xx, yy = np.meshgrid(x, y) -// >>> zz = np.sqrt(xx**2 + yy**2) -// >>> xx.shape, yy.shape, zz.shape -// ((101, 101), (101, 101), (101, 101)) -// >>> # sparse coordinate arrays -// >>> xs, ys = np.meshgrid(x, y, sparse=True) -// >>> zs = np.sqrt(xs**2 + ys**2) -// >>> xs.shape, ys.shape, zs.shape -// ((1, 101), (101, 1), (101, 101)) -// >>> np.array_equal(zz, zs) -// True -// -// >>> h = plt.contourf(x, y, zs) -// >>> plt.axis('scaled') -// >>> plt.colorbar() -// >>> plt.show() -// -// -//go:linkname Meshgrid py.meshgrid -func Meshgrid(__llgo_va_list ...interface{}) *py.Object -// Broadcast an array to a new shape. -// -// Parameters -// ---------- -// array : array_like -// The array to broadcast. -// shape : tuple or int -// The shape of the desired array. A single integer ``i`` is interpreted -// as ``(i,)``. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// -// Returns -// ------- -// broadcast : array -// A readonly view on the original array with the given shape. It is -// typically not contiguous. Furthermore, more than one element of a -// broadcasted array may refer to a single memory location. -// -// Raises -// ------ -// ValueError -// If the array is not compatible with the new shape according to NumPy's -// broadcasting rules. -// -// See Also -// -------- -// broadcast -// broadcast_arrays -// broadcast_shapes -// -// Notes -// ----- -// .. versionadded:: 1.10.0 -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3]) -// >>> np.broadcast_to(x, (3, 3)) -// array([[1, 2, 3], -// [1, 2, 3], -// [1, 2, 3]]) -// -// -//go:linkname BroadcastTo py.broadcast_to -func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object -// -// Compute the bi-dimensional histogram of two data samples. -// -// Parameters -// ---------- -// x : array_like, shape (N,) -// An array containing the x coordinates of the points to be -// histogrammed. -// y : array_like, shape (N,) -// An array containing the y coordinates of the points to be -// histogrammed. -// bins : int or array_like or [int, int] or [array, array], optional -// The bin specification: -// -// * If int, the number of bins for the two dimensions (nx=ny=bins). -// * If array_like, the bin edges for the two dimensions -// (x_edges=y_edges=bins). -// * If [int, int], the number of bins in each dimension -// (nx, ny = bins). -// * If [array, array], the bin edges in each dimension -// (x_edges, y_edges = bins). -// * A combination [int, array] or [array, int], where int -// is the number of bins and array is the bin edges. -// -// range : array_like, shape(2,2), optional -// The leftmost and rightmost edges of the bins along each dimension -// (if not specified explicitly in the `bins` parameters): -// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range -// will be considered outliers and not tallied in the histogram. -// density : bool, optional -// If False, the default, returns the number of samples in each bin. -// If True, returns the probability *density* function at the bin, -// ``bin_count / sample_count / bin_area``. -// weights : array_like, shape(N,), optional -// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. -// Weights are normalized to 1 if `density` is True. If `density` is -// False, the values of the returned histogram are equal to the sum of -// the weights belonging to the samples falling into each bin. -// -// Returns -// ------- -// H : ndarray, shape(nx, ny) -// The bi-dimensional histogram of samples `x` and `y`. Values in `x` -// are histogrammed along the first dimension and values in `y` are -// histogrammed along the second dimension. -// xedges : ndarray, shape(nx+1,) -// The bin edges along the first dimension. -// yedges : ndarray, shape(ny+1,) -// The bin edges along the second dimension. -// -// See Also -// -------- -// histogram : 1D histogram -// histogramdd : Multidimensional histogram -// -// Notes -// ----- -// When `density` is True, then the returned histogram is the sample -// density, defined such that the sum over bins of the product -// ``bin_value * bin_area`` is 1. -// -// Please note that the histogram does not follow the Cartesian convention -// where `x` values are on the abscissa and `y` values on the ordinate -// axis. Rather, `x` is histogrammed along the first dimension of the -// array (vertical), and `y` along the second dimension of the array -// (horizontal). This ensures compatibility with `histogramdd`. -// -// Examples -// -------- -// >>> from matplotlib.image import NonUniformImage -// >>> import matplotlib.pyplot as plt -// -// Construct a 2-D histogram with variable bin width. First define the bin -// edges: -// -// >>> xedges = [0, 1, 3, 5] -// >>> yedges = [0, 2, 3, 4, 6] -// -// Next we create a histogram H with random bin content: -// -// >>> x = np.random.normal(2, 1, 100) -// >>> y = np.random.normal(1, 1, 100) -// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) -// >>> # Histogram does not follow Cartesian convention (see Notes), -// >>> # therefore transpose H for visualization purposes. -// >>> H = H.T -// -// :func:`imshow ` can only display square bins: -// -// >>> fig = plt.figure(figsize=(7, 3)) -// >>> ax = fig.add_subplot(131, title='imshow: square bins') -// >>> plt.imshow(H, interpolation='nearest', origin='lower', -// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) -// -// -// :func:`pcolormesh ` can display actual edges: -// -// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', -// ... aspect='equal') -// >>> X, Y = np.meshgrid(xedges, yedges) -// >>> ax.pcolormesh(X, Y, H) -// -// -// :class:`NonUniformImage ` can be used to -// display actual bin edges with interpolation: -// -// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', -// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) -// >>> im = NonUniformImage(ax, interpolation='bilinear') -// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 -// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 -// >>> im.set_data(xcenters, ycenters, H) -// >>> ax.add_image(im) -// >>> plt.show() -// -// It is also possible to construct a 2-D histogram without specifying bin -// edges: -// -// >>> # Generate non-symmetric test data -// >>> n = 10000 -// >>> x = np.linspace(1, 100, n) -// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 -// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges -// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) -// -// Now we can plot the histogram using -// :func:`pcolormesh `, and a -// :func:`hexbin ` for comparison. -// -// >>> # Plot histogram using pcolormesh -// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) -// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') -// >>> ax1.plot(x, 2*np.log(x), 'k-') -// >>> ax1.set_xlim(x.min(), x.max()) -// >>> ax1.set_ylim(y.min(), y.max()) -// >>> ax1.set_xlabel('x') -// >>> ax1.set_ylabel('y') -// >>> ax1.set_title('histogram2d') -// >>> ax1.grid() -// -// >>> # Create hexbin plot for comparison -// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') -// >>> ax2.plot(x, 2*np.log(x), 'k-') -// >>> ax2.set_title('hexbin') -// >>> ax2.set_xlim(x.min(), x.max()) -// >>> ax2.set_xlabel('x') -// >>> ax2.grid() -// -// >>> plt.show() -// -// -//go:linkname Histogram2d py.histogram2d -func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Return an antiderivative (indefinite integral) of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The returned order `m` antiderivative `P` of polynomial `p` satisfies -// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` -// integration constants `k`. The constants determine the low-order -// polynomial part -// -// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} -// -// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. -// -// Parameters -// ---------- -// p : array_like or poly1d -// Polynomial to integrate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of the antiderivative. (Default: 1) -// k : list of `m` scalars or scalar, optional -// Integration constants. They are given in the order of integration: -// those corresponding to highest-order terms come first. -// -// If ``None`` (default), all constants are assumed to be zero. -// If `m = 1`, a single scalar can be given instead of a list. -// -// See Also -// -------- -// polyder : derivative of a polynomial -// poly1d.integ : equivalent method -// -// Examples -// -------- -// The defining property of the antiderivative: -// -// >>> p = np.poly1d([1,1,1]) -// >>> P = np.polyint(p) -// >>> P -// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary -// >>> np.polyder(P) == p -// True -// -// The integration constants default to zero, but can be specified: -// -// >>> P = np.polyint(p, 3) -// >>> P(0) -// 0.0 -// >>> np.polyder(P)(0) -// 0.0 -// >>> np.polyder(P, 2)(0) -// 0.0 -// >>> P = np.polyint(p, 3, k=[6,5,3]) -// >>> P -// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary -// -// Note that 3 = 6 / 2!, and that the constants are given in the order of -// integrations. Constant of the highest-order polynomial term comes first: -// -// >>> np.polyder(P, 2)(0) -// 6.0 -// >>> np.polyder(P, 1)(0) -// 5.0 -// >>> P(0) -// 3.0 -// -// -// -//go:linkname Polyint py.polyint -func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object -// -// Deprecates a function and includes the deprecation in its docstring. -// -// This function is used as a decorator. It returns an object that can be -// used to issue a DeprecationWarning, by passing the to-be decorated -// function as argument, this adds warning to the to-be decorated function's -// docstring and returns the new function object. -// -// See Also -// -------- -// deprecate : Decorate a function such that it issues a `DeprecationWarning` -// -// Parameters -// ---------- -// msg : str -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// obj : object -// -// -// -//go:linkname DeprecateWithDoc py.deprecate_with_doc -func DeprecateWithDoc(msg *py.Object) *py.Object -// -// Return the sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. -// -// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or -// empty. In later versions zero is returned. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose sum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the sum is computed. The default is to compute the -// sum of the flattened array. -// dtype : data-type, optional -// The type of the returned array and of the accumulator in which the -// elements are summed. By default, the dtype of `a` is used. An -// exception is when `a` has an integer type with less precision than -// the platform (u)intp. In that case, the default will be either -// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 -// bits. For inexact inputs, dtype must be inexact. -// -// .. versionadded:: 1.8.0 -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``. If provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer -// can yield unexpected results. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `mean` or `sum` methods -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// Starting value for the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nansum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.sum : Sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// isfinite : Show which elements are not NaN or +/-inf. -// -// Notes -// ----- -// If both positive and negative infinity are present, the sum will be Not -// A Number (NaN). -// -// Examples -// -------- -// >>> np.nansum(1) -// 1 -// >>> np.nansum([1]) -// 1 -// >>> np.nansum([1, np.nan]) -// 1.0 -// >>> a = np.array([[1, 1], [1, np.nan]]) -// >>> np.nansum(a) -// 3.0 -// >>> np.nansum(a, axis=0) -// array([2., 1.]) -// >>> np.nansum([1, np.nan, np.inf]) -// inf -// >>> np.nansum([1, np.nan, np.NINF]) -// -inf -// >>> from numpy.testing import suppress_warnings -// >>> with suppress_warnings() as sup: -// ... sup.filter(RuntimeWarning) -// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present -// nan -// -// -// -//go:linkname Nansum py.nansum -func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// zeros(shape, dtype=float, order='C', *, like=None) -// -// Return a new array of given shape and type, filled with zeros. -// -// Parameters -// ---------- -// shape : int or tuple of ints -// Shape of the new array, e.g., ``(2, 3)`` or ``2``. -// dtype : data-type, optional -// The desired data-type for the array, e.g., `numpy.int8`. Default is -// `numpy.float64`. -// order : {'C', 'F'}, optional, default: 'C' -// Whether to store multi-dimensional data in row-major -// (C-style) or column-major (Fortran-style) order in -// memory. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array of zeros with the given shape, dtype, and order. -// -// See Also -// -------- -// zeros_like : Return an array of zeros with shape and type of input. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> np.zeros(5) -// array([ 0., 0., 0., 0., 0.]) -// -// >>> np.zeros((5,), dtype=int) -// array([0, 0, 0, 0, 0]) -// -// >>> np.zeros((2, 1)) -// array([[ 0.], -// [ 0.]]) -// -// >>> s = (2,2) -// >>> np.zeros(s) -// array([[ 0., 0.], -// [ 0., 0.]]) -// -// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype -// array([(0, 0), (0, 0)], -// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) -// >>> a -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// -// You can think of reshaping as first raveling the array (using the given -// index order), then inserting the elements from the raveled array into the -// new array using the same kind of index ordering as was used for the -// raveling. -// -// >>> np.reshape(a, (2, 3)) # C-like index ordering -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering -// array([[0, 4, 3], -// [2, 1, 5]]) -// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') -// array([[0, 4, 3], -// [2, 1, 5]]) -// -// Examples -// -------- -// >>> a = np.array([[1,2,3], [4,5,6]]) -// >>> np.reshape(a, 6) -// array([1, 2, 3, 4, 5, 6]) -// >>> np.reshape(a, 6, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 -// array([[1, 2], -// [3, 4], -// [5, 6]]) -// -// -//go:linkname Reshape py.reshape -func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object -// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs in base-2. -// -// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine -// learning when the calculated probabilities of events may be so small as -// to exceed the range of normal floating point numbers. In such cases -// the base-2 logarithm of the calculated probability can be used instead. -// This function allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Base-2 logarithm of ``2**x1 + 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp: Logarithm of the sum of exponentiations of the inputs. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log2(1e-50) -// >>> prob2 = np.log2(2.5e-50) -// >>> prob12 = np.logaddexp2(prob1, prob2) -// >>> prob1, prob2, prob12 -// (-166.09640474436813, -164.77447664948076, -164.28904982231052) -// >>> 2**prob12 -// 3.4999999999999914e-50 -// -//go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the gradient of an N-dimensional array. -// -// The gradient is computed using second order accurate central differences -// in the interior points and either first or second order accurate one-sides -// (forward or backwards) differences at the boundaries. -// The returned gradient hence has the same shape as the input array. -// -// Parameters -// ---------- -// f : array_like -// An N-dimensional array containing samples of a scalar function. -// varargs : list of scalar or array, optional -// Spacing between f values. Default unitary spacing for all dimensions. -// Spacing can be specified using: -// -// 1. single scalar to specify a sample distance for all dimensions. -// 2. N scalars to specify a constant sample distance for each dimension. -// i.e. `dx`, `dy`, `dz`, ... -// 3. N arrays to specify the coordinates of the values along each -// dimension of F. The length of the array must match the size of -// the corresponding dimension -// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. -// -// If `axis` is given, the number of varargs must equal the number of axes. -// Default: 1. -// -// edge_order : {1, 2}, optional -// Gradient is calculated using N-th order accurate differences -// at the boundaries. Default: 1. -// -// .. versionadded:: 1.9.1 -// -// axis : None or int or tuple of ints, optional -// Gradient is calculated only along the given axis or axes -// The default (axis = None) is to calculate the gradient for all the axes -// of the input array. axis may be negative, in which case it counts from -// the last to the first axis. -// -// .. versionadded:: 1.11.0 -// -// Returns -// ------- -// gradient : ndarray or list of ndarray -// A list of ndarrays (or a single ndarray if there is only one dimension) -// corresponding to the derivatives of f with respect to each dimension. -// Each derivative has the same shape as f. -// -// Examples -// -------- -// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) -// >>> np.gradient(f) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// >>> np.gradient(f, 2) -// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) -// -// Spacing can be also specified with an array that represents the coordinates -// of the values F along the dimensions. -// For instance a uniform spacing: -// -// >>> x = np.arange(f.size) -// >>> np.gradient(f, x) -// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) -// -// Or a non uniform one: -// -// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) -// >>> np.gradient(f, x) -// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) -// -// For two dimensional arrays, the return will be two arrays ordered by -// axis. In this example the first array stands for the gradient in -// rows and the second one in columns direction: -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) -// [array([[ 2., 2., -1.], -// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], -// [1. , 1. , 1. ]])] -// -// In this example the spacing is also specified: -// uniform for axis=0 and non uniform for axis=1 -// -// >>> dx = 2. -// >>> y = [1., 1.5, 3.5] -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) -// [array([[ 1. , 1. , -0.5], -// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], -// [2. , 1.7, 0.5]])] -// -// It is possible to specify how boundaries are treated using `edge_order` -// -// >>> x = np.array([0, 1, 2, 3, 4]) -// >>> f = x**2 -// >>> np.gradient(f, edge_order=1) -// array([1., 2., 4., 6., 7.]) -// >>> np.gradient(f, edge_order=2) -// array([0., 2., 4., 6., 8.]) -// -// The `axis` keyword can be used to specify a subset of axes of which the -// gradient is calculated -// -// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) -// array([[ 2., 2., -1.], -// [ 2., 2., -1.]]) -// -// Notes -// ----- -// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous -// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we -// minimize the "consistency error" :math:`\eta_{i}` between the true gradient -// and its estimate from a linear combination of the neighboring grid-points: -// -// .. math:: -// -// \eta_{i} = f_{i}^{\left(1\right)} - -// \left[ \alpha f\left(x_{i}\right) + -// \beta f\left(x_{i} + h_{d}\right) + -// \gamma f\left(x_{i}-h_{s}\right) -// \right] -// -// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` -// with their Taylor series expansion, this translates into solving -// the following the linear system: -// -// .. math:: -// -// \left\{ -// \begin{array}{r} -// \alpha+\beta+\gamma=0 \\ -// \beta h_{d}-\gamma h_{s}=1 \\ -// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 -// \end{array} -// \right. -// -// The resulting approximation of :math:`f_{i}^{(1)}` is the following: -// -// .. math:: -// -// \hat f_{i}^{(1)} = -// \frac{ -// h_{s}^{2}f\left(x_{i} + h_{d}\right) -// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) -// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} -// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} -// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} -// + h_{s}h_{d}^{2}}{h_{d} -// + h_{s}}\right) -// -// It is worth noting that if :math:`h_{s}=h_{d}` -// (i.e., data are evenly spaced) -// we find the standard second order approximation: -// -// .. math:: -// -// \hat f_{i}^{(1)}= -// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} -// + \mathcal{O}\left(h^{2}\right) -// -// With a similar procedure the forward/backward approximations used for -// boundaries can be derived. -// -// References -// ---------- -// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics -// (Texts in Applied Mathematics). New York: Springer. -// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations -// in Geophysical Fluid Dynamics. New York: Springer. -// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on -// Arbitrarily Spaced Grids, -// Mathematics of Computation 51, no. 184 : 699-706. -// `PDF `_. -// -// -//go:linkname Gradient py.gradient -func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Kronecker product of two arrays. -// -// Computes the Kronecker product, a composite array made of blocks of the -// second array scaled by the first. -// -// Parameters -// ---------- -// a, b : array_like -// -// Returns -// ------- -// out : ndarray -// -// See Also -// -------- -// outer : The outer product -// -// Notes -// ----- -// The function assumes that the number of dimensions of `a` and `b` -// are the same, if necessary prepending the smallest with ones. -// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, -// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. -// The elements are products of elements from `a` and `b`, organized -// explicitly by:: -// -// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] -// -// where:: -// -// kt = it * st + jt, t = 0,...,N -// -// In the common 2-D case (N=1), the block structure can be visualized:: -// -// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], -// [ ... ... ], -// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] -// -// -// Examples -// -------- -// >>> np.kron([1,10,100], [5,6,7]) -// array([ 5, 6, 7, ..., 500, 600, 700]) -// >>> np.kron([5,6,7], [1,10,100]) -// array([ 5, 50, 500, ..., 7, 70, 700]) -// -// >>> np.kron(np.eye(2), np.ones((2,2))) -// array([[1., 1., 0., 0.], -// [1., 1., 0., 0.], -// [0., 0., 1., 1.], -// [0., 0., 1., 1.]]) -// -// >>> a = np.arange(100).reshape((2,5,2,5)) -// >>> b = np.arange(24).reshape((2,3,4)) -// >>> c = np.kron(a,b) -// >>> c.shape -// (2, 10, 6, 20) -// >>> I = (1,3,0,2) -// >>> J = (0,2,1) -// >>> J1 = (0,) + J # extend to ndim=4 -// >>> S1 = (1,) + b.shape -// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) -// >>> c[K] == a[I]*b[J] -// True -// -// -// -//go:linkname Kron py.kron -func Kron(a *py.Object, b *py.Object) *py.Object -// -// inner(a, b, /) -// -// Inner product of two arrays. -// -// Ordinary inner product of vectors for 1-D arrays (without complex -// conjugation), in higher dimensions a sum product over the last axes. -// -// Parameters -// ---------- -// a, b : array_like -// If `a` and `b` are nonscalar, their last dimensions must match. -// -// Returns -// ------- -// out : ndarray -// If `a` and `b` are both -// scalars or both 1-D arrays then a scalar is returned; otherwise -// an array is returned. -// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` -// -// Raises -// ------ -// ValueError -// If both `a` and `b` are nonscalar and their last dimensions have -// different sizes. -// -// See Also -// -------- -// tensordot : Sum products over arbitrary axes. -// dot : Generalised matrix product, using second last dimension of `b`. -// einsum : Einstein summation convention. -// -// Notes -// ----- -// For vectors (1-D arrays) it computes the ordinary inner-product:: -// -// np.inner(a, b) = sum(a[:]*b[:]) -// -// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: -// -// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) -// -// or explicitly:: -// -// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] -// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) -// -// In addition `a` or `b` may be scalars, in which case:: -// -// np.inner(a,b) = a*b -// -// Examples -// -------- -// Ordinary inner product for vectors: -// -// >>> a = np.array([1,2,3]) -// >>> b = np.array([0,1,0]) -// >>> np.inner(a, b) -// 2 -// -// Some multidimensional examples: -// -// >>> a = np.arange(24).reshape((2,3,4)) -// >>> b = np.arange(4) -// >>> c = np.inner(a, b) -// >>> c.shape -// (2, 3) -// >>> c -// array([[ 14, 38, 62], -// [ 86, 110, 134]]) -// -// >>> a = np.arange(2).reshape((1,1,2)) -// >>> b = np.arange(6).reshape((3,2)) -// >>> c = np.inner(a, b) -// >>> c.shape -// (1, 1, 3) -// >>> c -// array([[[1, 3, 5]]]) -// -// An example where `b` is a scalar: -// -// >>> np.inner(np.eye(2), 7) -// array([[7., 0.], -// [0., 7.]]) -// -// -// -//go:linkname Inner py.inner -func Inner(a *py.Object, b *py.Object) *py.Object -//go:linkname Arccos py.arccos -func Arccos(__llgo_va_list ...interface{}) *py.Object -// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// First array elements raised to powers from second array, element-wise. -// -// Raise each base in `x1` to the positionally-corresponding power in `x2`. -// `x1` and `x2` must be broadcastable to the same shape. This differs from -// the power function in that integers, float16, and float32 are promoted to -// floats with a minimum precision of float64 so that the result is always -// inexact. The intent is that the function will return a usable result for -// negative powers and seldom overflow for positive powers. -// -// Negative values raised to a non-integral value will return ``nan``. -// To get complex results, cast the input to complex, or specify the -// ``dtype`` to be ``complex`` (see the example below). -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// x1 : array_like -// The bases. -// x2 : array_like -// The exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The bases in `x1` raised to the exponents in `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// power : power function that preserves type -// -// Examples -// -------- -// Cube each element in a list. -// -// >>> x1 = range(6) -// >>> x1 -// [0, 1, 2, 3, 4, 5] -// >>> np.float_power(x1, 3) -// array([ 0., 1., 8., 27., 64., 125.]) -// -// Raise the bases to different exponents. -// -// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] -// >>> np.float_power(x1, x2) -// array([ 0., 1., 8., 27., 16., 5.]) -// -// The effect of broadcasting. -// -// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) -// >>> x2 -// array([[1, 2, 3, 3, 2, 1], -// [1, 2, 3, 3, 2, 1]]) -// >>> np.float_power(x1, x2) -// array([[ 0., 1., 8., 27., 16., 5.], -// [ 0., 1., 8., 27., 16., 5.]]) -// -// Negative values raised to a non-integral value will result in ``nan`` -// (and a warning will be generated). -// -// >>> x3 = np.array([-1, -4]) -// >>> with np.errstate(invalid='ignore'): -// ... p = np.float_power(x3, 1.5) -// ... -// >>> p -// array([nan, nan]) -// -// To get complex results, give the argument ``dtype=complex``. -// -// >>> np.float_power(x3, 1.5, dtype=complex) -// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) -// -//go:linkname FloatPower py.float_power -func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute hyperbolic tangent element-wise. -// -// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// https://personal.math.ubc.ca/~cbm/aands/page_83.htm -// -// .. [2] Wikipedia, "Hyperbolic function", -// https://en.wikipedia.org/wiki/Hyperbolic_function -// -// Examples -// -------- -// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) -// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) -// -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.tanh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tanh py.tanh -func Tanh(x *py.Object, out *py.Object) *py.Object -// -// Return an array drawn from elements in choicelist, depending on conditions. -// -// Parameters -// ---------- -// condlist : list of bool ndarrays -// The list of conditions which determine from which array in `choicelist` -// the output elements are taken. When multiple conditions are satisfied, -// the first one encountered in `condlist` is used. -// choicelist : list of ndarrays -// The list of arrays from which the output elements are taken. It has -// to be of the same length as `condlist`. -// default : scalar, optional -// The element inserted in `output` when all conditions evaluate to False. -// -// Returns -// ------- -// output : ndarray -// The output at position m is the m-th element of the array in -// `choicelist` where the m-th element of the corresponding array in -// `condlist` is True. -// -// See Also -// -------- -// where : Return elements from one of two arrays depending on condition. -// take, choose, compress, diag, diagonal -// -// Examples -// -------- -// >>> x = np.arange(6) -// >>> condlist = [x<3, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 42) -// array([ 0, 1, 2, 42, 16, 25]) -// -// >>> condlist = [x<=4, x>3] -// >>> choicelist = [x, x**2] -// >>> np.select(condlist, choicelist, 55) -// array([ 0, 1, 2, 3, 4, 25]) -// -// -// -//go:linkname Select py.select -func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object -// -// Least squares polynomial fit. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` -// to points `(x, y)`. Returns a vector of coefficients `p` that minimises -// the squared error in the order `deg`, `deg-1`, ... `0`. -// -// The `Polynomial.fit ` class -// method is recommended for new code as it is more stable numerically. See -// the documentation of the method for more information. -// -// Parameters -// ---------- -// x : array_like, shape (M,) -// x-coordinates of the M sample points ``(x[i], y[i])``. -// y : array_like, shape (M,) or (M, K) -// y-coordinates of the sample points. Several data sets of sample -// points sharing the same x-coordinates can be fitted at once by -// passing in a 2D-array that contains one dataset per column. -// deg : int -// Degree of the fitting polynomial -// rcond : float, optional -// Relative condition number of the fit. Singular values smaller than -// this relative to the largest singular value will be ignored. The -// default value is len(x)*eps, where eps is the relative precision of -// the float type, about 2e-16 in most cases. -// full : bool, optional -// Switch determining nature of return value. When it is False (the -// default) just the coefficients are returned, when True diagnostic -// information from the singular value decomposition is also returned. -// w : array_like, shape (M,), optional -// Weights. If not None, the weight ``w[i]`` applies to the unsquared -// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are -// chosen so that the errors of the products ``w[i]*y[i]`` all have the -// same variance. When using inverse-variance weighting, use -// ``w[i] = 1/sigma(y[i])``. The default value is None. -// cov : bool or str, optional -// If given and not `False`, return not just the estimate but also its -// covariance matrix. By default, the covariance are scaled by -// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed -// to be unreliable except in a relative sense and everything is scaled -// such that the reduced chi2 is unity. This scaling is omitted if -// ``cov='unscaled'``, as is relevant for the case that the weights are -// w = 1/sigma, with sigma known to be a reliable estimate of the -// uncertainty. -// -// Returns -// ------- -// p : ndarray, shape (deg + 1,) or (deg + 1, K) -// Polynomial coefficients, highest power first. If `y` was 2-D, the -// coefficients for `k`-th data set are in ``p[:,k]``. -// -// residuals, rank, singular_values, rcond -// These values are only returned if ``full == True`` -// -// - residuals -- sum of squared residuals of the least squares fit -// - rank -- the effective rank of the scaled Vandermonde -// coefficient matrix -// - singular_values -- singular values of the scaled Vandermonde -// coefficient matrix -// - rcond -- value of `rcond`. -// -// For more details, see `numpy.linalg.lstsq`. -// -// V : ndarray, shape (M,M) or (M,M,K) -// Present only if ``full == False`` and ``cov == True``. The covariance -// matrix of the polynomial coefficient estimates. The diagonal of -// this matrix are the variance estimates for each coefficient. If y -// is a 2-D array, then the covariance matrix for the `k`-th data set -// are in ``V[:,:,k]`` -// -// -// Warns -// ----- -// RankWarning -// The rank of the coefficient matrix in the least-squares fit is -// deficient. The warning is only raised if ``full == False``. -// -// The warnings can be turned off by -// -// >>> import warnings -// >>> warnings.simplefilter('ignore', np.RankWarning) -// -// See Also -// -------- -// polyval : Compute polynomial values. -// linalg.lstsq : Computes a least-squares fit. -// scipy.interpolate.UnivariateSpline : Computes spline fits. -// -// Notes -// ----- -// The solution minimizes the squared error -// -// .. math:: -// E = \sum_{j=0}^k |p(x_j) - y_j|^2 -// -// in the equations:: -// -// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] -// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] -// ... -// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] -// -// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. -// -// `polyfit` issues a `RankWarning` when the least-squares fit is badly -// conditioned. This implies that the best fit is not well-defined due -// to numerical error. The results may be improved by lowering the polynomial -// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter -// can also be set to a value smaller than its default, but the resulting -// fit may be spurious: including contributions from the small singular -// values can add numerical noise to the result. -// -// Note that fitting polynomial coefficients is inherently badly conditioned -// when the degree of the polynomial is large or the interval of sample points -// is badly centered. The quality of the fit should always be checked in these -// cases. When polynomial fits are not satisfactory, splines may be a good -// alternative. -// -// References -// ---------- -// .. [1] Wikipedia, "Curve fitting", -// https://en.wikipedia.org/wiki/Curve_fitting -// .. [2] Wikipedia, "Polynomial interpolation", -// https://en.wikipedia.org/wiki/Polynomial_interpolation -// -// Examples -// -------- -// >>> import warnings -// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) -// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) -// >>> z = np.polyfit(x, y, 3) -// >>> z -// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary -// -// It is convenient to use `poly1d` objects for dealing with polynomials: -// -// >>> p = np.poly1d(z) -// >>> p(0.5) -// 0.6143849206349179 # may vary -// >>> p(3.5) -// -0.34732142857143039 # may vary -// >>> p(10) -// 22.579365079365115 # may vary -// -// High-order polynomials may oscillate wildly: -// -// >>> with warnings.catch_warnings(): -// ... warnings.simplefilter('ignore', np.RankWarning) -// ... p30 = np.poly1d(np.polyfit(x, y, 30)) -// ... -// >>> p30(4) -// -0.80000000000000204 # may vary -// >>> p30(5) -// -0.99999999999999445 # may vary -// >>> p30(4.5) -// -0.10547061179440398 # may vary -// -// Illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> xp = np.linspace(-2, 6, 100) -// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') -// >>> plt.ylim(-2,2) -// (-2, 2) -// >>> plt.show() -// -// -// -//go:linkname Polyfit py.polyfit -func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object -// -// Return minimum of an array or minimum along an axis, ignoring any NaNs. -// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and -// Nan is returned for that slice. -// -// Parameters -// ---------- -// a : array_like -// Array containing numbers whose minimum is desired. If `a` is not an -// array, a conversion is attempted. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the minimum is computed. The default is to compute -// the minimum of the flattened array. -// out : ndarray, optional -// Alternate output array in which to place the result. The default -// is ``None``; if provided, it must have the same shape as the -// expected output, but the type will be cast if necessary. See -// :ref:`ufuncs-output-type` for more details. -// -// .. versionadded:: 1.8.0 -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If the value is anything but the default, then -// `keepdims` will be passed through to the `min` method -// of sub-classes of `ndarray`. If the sub-classes methods -// does not implement `keepdims` any exceptions will be raised. -// -// .. versionadded:: 1.8.0 -// initial : scalar, optional -// The maximum value of an output element. Must be present to allow -// computation on empty slice. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.22.0 -// where : array_like of bool, optional -// Elements to compare for the minimum. See `~numpy.ufunc.reduce` -// for details. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// nanmin : ndarray -// An array with the same shape as `a`, with the specified axis -// removed. If `a` is a 0-d array, or if axis is None, an ndarray -// scalar is returned. The same dtype as `a` is returned. -// -// See Also -// -------- -// nanmax : -// The maximum value of an array along a given axis, ignoring any NaNs. -// amin : -// The minimum value of an array along a given axis, propagating any NaNs. -// fmin : -// Element-wise minimum of two arrays, ignoring any NaNs. -// minimum : -// Element-wise minimum of two arrays, propagating any NaNs. -// isnan : -// Shows which elements are Not a Number (NaN). -// isfinite: -// Shows which elements are neither NaN nor infinity. -// -// amax, fmax, maximum -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Positive infinity is treated as a very large number and negative -// infinity is treated as a very small (i.e. negative) number. -// -// If the input has a integer type the function is equivalent to np.min. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nanmin(a) -// 1.0 -// >>> np.nanmin(a, axis=0) -// array([1., 2.]) -// >>> np.nanmin(a, axis=1) -// array([1., 3.]) -// -// When positive infinity and negative infinity are present: -// -// >>> np.nanmin([1, 2, np.nan, np.inf]) -// 1.0 -// >>> np.nanmin([1, 2, np.nan, np.NINF]) -// -inf -// -// -// -//go:linkname Nanmin py.nanmin -func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Cosine element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding cosine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> np.cos(np.array([0, np.pi/2, np.pi])) -// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) -// >>> -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Cos py.cos -func Cos(x *py.Object, out *py.Object) *py.Object -// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The greatest common divisor of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// lcm : The lowest common multiple -// -// Examples -// -------- -// >>> np.gcd(12, 20) -// 4 -// >>> np.gcd.reduce([15, 25, 35]) -// 5 -// >>> np.gcd(np.arange(6), 20) -// array([20, 1, 2, 1, 4, 5]) -// -//go:linkname Gcd py.gcd -func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Set the floating-point error callback function or log object. -// -// There are two ways to capture floating-point error messages. The first -// is to set the error-handler to 'call', using `seterr`. Then, set -// the function to call using this function. -// -// The second is to set the error-handler to 'log', using `seterr`. -// Floating-point errors then trigger a call to the 'write' method of -// the provided object. -// -// Parameters -// ---------- -// func : callable f(err, flag) or object with write method -// Function to call upon floating-point errors ('call'-mode) or -// object whose 'write' method is used to log such message ('log'-mode). -// -// The call function takes two arguments. The first is a string describing -// the type of error (such as "divide by zero", "overflow", "underflow", -// or "invalid value"), and the second is the status flag. The flag is a -// byte, whose four least-significant bits indicate the type of error, one -// of "divide", "over", "under", "invalid":: -// -// [0 0 0 0 divide over under invalid] -// -// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. -// -// If an object is provided, its write method should take one argument, -// a string. -// -// Returns -// ------- -// h : callable, log instance or None -// The old error handler. -// -// See Also -// -------- -// seterr, geterr, geterrcall -// -// Examples -// -------- -// Callback upon error: -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// -// >>> saved_handler = np.seterrcall(err_handler) -// >>> save_err = np.seterr(all='call') -// -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} -// -// Log error message: -// -// >>> class Log: -// ... def write(self, msg): -// ... print("LOG: %s" % msg) -// ... -// -// >>> log = Log() -// >>> saved_handler = np.seterrcall(log) -// >>> save_err = np.seterr(all='log') -// -// >>> np.array([1, 2, 3]) / 0.0 -// LOG: Warning: divide by zero encountered in divide -// array([inf, inf, inf]) -// -// >>> np.seterrcall(saved_handler) -// -// >>> np.seterr(**save_err) -// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} -// -// -// -//go:linkname Seterrcall py.seterrcall -func Seterrcall(Func *py.Object) *py.Object -// -// Check whether or not an object can be iterated over. -// -// Parameters -// ---------- -// y : object -// Input object. -// -// Returns -// ------- -// b : bool -// Return ``True`` if the object has an iterator method or is a -// sequence and ``False`` otherwise. -// -// -// Examples -// -------- -// >>> np.iterable([1, 2, 3]) -// True -// >>> np.iterable(2) -// False -// -// Notes -// ----- -// In most cases, the results of ``np.iterable(obj)`` are consistent with -// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is -// the treatment of 0-dimensional arrays:: -// -// >>> from collections.abc import Iterable -// >>> a = np.array(1.0) # 0-dimensional numpy array -// >>> isinstance(a, Iterable) -// True -// >>> np.iterable(a) -// False -// -// -// -//go:linkname Iterable py.iterable -func Iterable(y *py.Object) *py.Object -// -// Reverse the order of elements along axis 0 (up/down). -// -// For a 2-D array, this flips the entries in each column in the up/down -// direction. Rows are preserved, but appear in a different order than before. -// -// Parameters -// ---------- -// m : array_like -// Input array. -// -// Returns -// ------- -// out : array_like -// A view of `m` with the rows reversed. Since a view is -// returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// fliplr : Flip array in the left/right direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. -// Requires the array to be at least 1-D. -// -// Examples -// -------- -// >>> A = np.diag([1.0, 2, 3]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.flipud(A) -// array([[0., 0., 3.], -// [0., 2., 0.], -// [1., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.flipud(A) == A[::-1,...]) -// True -// -// >>> np.flipud([1,2]) -// array([2, 1]) -// -// -// -//go:linkname Flipud py.flipud -func Flipud(m *py.Object) *py.Object -// -// Construct an array by executing a function over each coordinate. -// -// The resulting array therefore has a value ``fn(x, y, z)`` at -// coordinate ``(x, y, z)``. -// -// Parameters -// ---------- -// function : callable -// The function is called with N parameters, where N is the rank of -// `shape`. Each parameter represents the coordinates of the array -// varying along a specific axis. For example, if `shape` -// were ``(2, 2)``, then the parameters would be -// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` -// shape : (N,) tuple of ints -// Shape of the output array, which also determines the shape of -// the coordinate arrays passed to `function`. -// dtype : data-type, optional -// Data-type of the coordinate arrays passed to `function`. -// By default, `dtype` is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// fromfunction : any -// The result of the call to `function` is passed back directly. -// Therefore the shape of `fromfunction` is completely determined by -// `function`. If `function` returns a scalar value, the shape of -// `fromfunction` would not match the `shape` parameter. -// -// See Also -// -------- -// indices, meshgrid -// -// Notes -// ----- -// Keywords other than `dtype` and `like` are passed to `function`. -// -// Examples -// -------- -// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) -// array([[0., 0.], -// [1., 1.]]) -// -// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) -// array([[0., 1.], -// [0., 1.]]) -// -// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) -// array([[ True, False, False], -// [False, True, False], -// [False, False, True]]) -// -// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) -// array([[0, 1, 2], -// [1, 2, 3], -// [2, 3, 4]]) -// -// -// -//go:linkname Fromfunction py.fromfunction -func Fromfunction(function *py.Object, shape *py.Object) *py.Object -// -// Determine common type following standard coercion rules. -// -// .. deprecated:: NumPy 1.25 -// -// This function is deprecated, use `numpy.promote_types` or -// `numpy.result_type` instead. To achieve semantics for the -// `scalar_types` argument, use `numpy.result_type` and pass the Python -// values `0`, `0.0`, or `0j`. -// This will give the same results in almost all cases. -// More information and rare exception can be found in the -// `NumPy 1.25 release notes `_. -// -// Parameters -// ---------- -// array_types : sequence -// A list of dtypes or dtype convertible objects representing arrays. -// scalar_types : sequence -// A list of dtypes or dtype convertible objects representing scalars. -// -// Returns -// ------- -// datatype : dtype -// The common data type, which is the maximum of `array_types` ignoring -// `scalar_types`, unless the maximum of `scalar_types` is of a -// different kind (`dtype.kind`). If the kind is not understood, then -// None is returned. -// -// See Also -// -------- -// dtype, common_type, can_cast, mintypecode -// -// Examples -// -------- -// >>> np.find_common_type([], [np.int64, np.float32, complex]) -// dtype('complex128') -// >>> np.find_common_type([np.int64, np.float32], []) -// dtype('float64') -// -// The standard casting rules ensure that a scalar cannot up-cast an -// array unless the scalar is of a fundamentally different kind of data -// (i.e. under a different hierarchy in the data type hierarchy) then -// the array: -// -// >>> np.find_common_type([np.float32], [np.int64, np.float64]) -// dtype('float32') -// -// Complex is of a different type, so it up-casts the float in the -// `array_types` argument: -// -// >>> np.find_common_type([np.float32], [complex]) -// dtype('complex128') -// -// Type specifier strings are convertible to dtypes and can therefore -// be used instead of dtypes: -// -// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) -// dtype('complex128') -// -// -// -//go:linkname FindCommonType py.find_common_type -func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object -// -// Set the size of the buffer used in ufuncs. -// -// Parameters -// ---------- -// size : int -// Size of buffer. -// -// -// -//go:linkname Setbufsize py.setbufsize -func Setbufsize(size *py.Object) *py.Object -// -// Estimate a covariance matrix, given data and weights. -// -// Covariance indicates the level to which two variables vary together. -// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, -// then the covariance matrix element :math:`C_{ij}` is the covariance of -// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance -// of :math:`x_i`. -// -// See the notes for an outline of the algorithm. -// -// Parameters -// ---------- -// m : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `m` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same form -// as that of `m`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : bool, optional -// Default normalization (False) is by ``(N - 1)``, where ``N`` is the -// number of observations given (unbiased estimate). If `bias` is True, -// then normalization is by ``N``. These values can be overridden by using -// the keyword ``ddof`` in numpy versions >= 1.5. -// ddof : int, optional -// If not ``None`` the default value implied by `bias` is overridden. -// Note that ``ddof=1`` will return the unbiased estimate, even if both -// `fweights` and `aweights` are specified, and ``ddof=0`` will return -// the simple average. See the notes for the details. The default value -// is ``None``. -// -// .. versionadded:: 1.5 -// fweights : array_like, int, optional -// 1-D array of integer frequency weights; the number of times each -// observation vector should be repeated. -// -// .. versionadded:: 1.10 -// aweights : array_like, optional -// 1-D array of observation vector weights. These relative weights are -// typically large for observations considered "important" and smaller for -// observations considered less "important". If ``ddof=0`` the array of -// weights can be used to assign probabilities to observation vectors. -// -// .. versionadded:: 1.10 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// out : ndarray -// The covariance matrix of the variables. -// -// See Also -// -------- -// corrcoef : Normalized covariance matrix -// -// Notes -// ----- -// Assume that the observations are in the columns of the observation -// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The -// steps to compute the weighted covariance are as follows:: -// -// >>> m = np.arange(10, dtype=np.float64) -// >>> f = np.arange(10) * 2 -// >>> a = np.arange(10) ** 2. -// >>> ddof = 1 -// >>> w = f * a -// >>> v1 = np.sum(w) -// >>> v2 = np.sum(w * a) -// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 -// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) -// -// Note that when ``a == 1``, the normalization factor -// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` -// as it should. -// -// Examples -// -------- -// Consider two variables, :math:`x_0` and :math:`x_1`, which -// correlate perfectly, but in opposite directions: -// -// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T -// >>> x -// array([[0, 1, 2], -// [2, 1, 0]]) -// -// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance -// matrix shows this clearly: -// -// >>> np.cov(x) -// array([[ 1., -1.], -// [-1., 1.]]) -// -// Note that element :math:`C_{0,1}`, which shows the correlation between -// :math:`x_0` and :math:`x_1`, is negative. -// -// Further, note how `x` and `y` are combined: -// -// >>> x = [-2.1, -1, 4.3] -// >>> y = [3, 1.1, 0.12] -// >>> X = np.stack((x, y), axis=0) -// >>> np.cov(X) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x, y) -// array([[11.71 , -4.286 ], # may vary -// [-4.286 , 2.144133]]) -// >>> np.cov(x) -// array(11.71) -// -// -// -//go:linkname Cov py.cov -func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object -// -// Find the sum of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the polynomial resulting from the sum of two input polynomials. -// Each input must be either a poly1d object or a 1D sequence of polynomial -// coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The sum of the inputs. If either input is a poly1d object, then the -// output is also a poly1d object. Otherwise, it is a 1D array of -// polynomial coefficients from highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// -// Examples -// -------- -// >>> np.polyadd([1, 2], [9, 5, 4]) -// array([9, 6, 6]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2]) -// >>> p2 = np.poly1d([9, 5, 4]) -// >>> print(p1) -// 1 x + 2 -// >>> print(p2) -// 2 -// 9 x + 5 x + 4 -// >>> print(np.polyadd(p1, p2)) -// 2 -// 9 x + 6 x + 6 -// -// -// -//go:linkname Polyadd py.polyadd -func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object -// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// fmin, amin, nanmin -// -// Notes -// ----- -// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when -// neither x1 nor x2 are nans, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.maximum([2, 3, 4], [1, 5, 2]) -// array([2, 5, 4]) -// -// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.maximum(np.Inf, 1) -// inf -// -//go:linkname Maximum py.maximum -func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an array. -// -// This returns a tuple of indices that can be used to access the main -// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape -// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for -// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` -// for ``i = [0..n-1]``. -// -// Parameters -// ---------- -// n : int -// The size, along each dimension, of the arrays for which the returned -// indices can be used. -// -// ndim : int, optional -// The number of dimensions. -// -// See Also -// -------- -// diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Create a set of indices to access the diagonal of a (4, 4) array: -// -// >>> di = np.diag_indices(4) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// >>> a[di] = 100 -// >>> a -// array([[100, 1, 2, 3], -// [ 4, 100, 6, 7], -// [ 8, 9, 100, 11], -// [ 12, 13, 14, 100]]) -// -// Now, we create indices to manipulate a 3-D array: -// -// >>> d3 = np.diag_indices(2, 3) -// >>> d3 -// (array([0, 1]), array([0, 1]), array([0, 1])) -// -// And use it to set the diagonal of an array of zeros to 1: -// -// >>> a = np.zeros((2, 2, 2), dtype=int) -// >>> a[d3] = 1 -// >>> a -// array([[[1, 0], -// [0, 0]], -// [[0, 0], -// [0, 1]]]) -// -// -// -//go:linkname DiagIndices py.diag_indices -func DiagIndices(n *py.Object, ndim *py.Object) *py.Object -// -// Print or write to a file the source code for a NumPy object. -// -// The source code is only returned for objects written in Python. Many -// functions and classes are defined in C and will therefore not return -// useful information. -// -// Parameters -// ---------- -// object : numpy object -// Input object. This can be any object (function, class, module, -// ...). -// output : file object, optional -// If `output` not supplied then source code is printed to screen -// (sys.stdout). File object must be created with either write 'w' or -// append 'a' modes. -// -// See Also -// -------- -// lookfor, info -// -// Examples -// -------- -// >>> np.source(np.interp) #doctest: +SKIP -// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py -// def interp(x, xp, fp, left=None, right=None): -// """.... (full docstring printed)""" -// if isinstance(x, (float, int, number)): -// return compiled_interp([x], xp, fp, left, right).item() -// else: -// return compiled_interp(x, xp, fp, left, right) -// -// The source code is only returned for objects written in Python. -// -// >>> np.source(np.array) #doctest: +SKIP -// Not available for this object. -// -// -// -//go:linkname Source py.source -func Source(object *py.Object, output *py.Object) *py.Object -// arange([start,] stop[, step,], dtype=None, *, like=None) -// -// Return evenly spaced values within a given interval. -// -// ``arange`` can be called with a varying number of positional arguments: -// -// * ``arange(stop)``: Values are generated within the half-open interval -// ``[0, stop)`` (in other words, the interval including `start` but -// excluding `stop`). -// * ``arange(start, stop)``: Values are generated within the half-open -// interval ``[start, stop)``. -// * ``arange(start, stop, step)`` Values are generated within the half-open -// interval ``[start, stop)``, with spacing between values given by -// ``step``. -// -// For integer arguments the function is roughly equivalent to the Python -// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` -// instance. -// -// When using a non-integer step, such as 0.1, it is often better to use -// `numpy.linspace`. -// -// See the Warning sections below for more information. -// -// Parameters -// ---------- -// start : integer or real, optional -// Start of interval. The interval includes this value. The default -// start value is 0. -// stop : integer or real -// End of interval. The interval does not include this value, except -// in some cases where `step` is not an integer and floating point -// round-off affects the length of `out`. -// step : integer or real, optional -// Spacing between values. For any output `out`, this is the distance -// between two adjacent values, ``out[i+1] - out[i]``. The default -// step size is 1. If `step` is specified as a position argument, -// `start` must also be given. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, infer the data -// type from the other input arguments. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arange : ndarray -// Array of evenly spaced values. -// -// For floating point arguments, the length of the result is -// ``ceil((stop - start)/step)``. Because of floating point overflow, -// this rule may result in the last element of `out` being greater -// than `stop`. -// -// Warnings -// -------- -// The length of the output might not be numerically stable. -// -// Another stability issue is due to the internal implementation of -// `numpy.arange`. -// The actual step value used to populate the array is -// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss -// can occur here, due to casting or due to using floating points when -// `start` is much larger than `step`. This can lead to unexpected -// behaviour. For example:: -// -// >>> np.arange(0, 5, 0.5, dtype=int) -// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -// >>> np.arange(-3, 3, 0.5, dtype=int) -// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) -// -// In such cases, the use of `numpy.linspace` should be preferred. -// -// The built-in :py:class:`range` generates :std:doc:`Python built-in integers -// that have arbitrary size `, while `numpy.arange` -// produces `numpy.int32` or `numpy.int64` numbers. This may result in -// incorrect results for large integer values:: -// -// >>> power = 40 -// >>> modulo = 10000 -// >>> x1 = [(n ** power) % modulo for n in range(8)] -// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] -// >>> print(x1) -// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct -// >>> print(x2) -// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect -// -// See Also -// -------- -// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. -// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. -// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.arange(3) -// array([0, 1, 2]) -// >>> np.arange(3.0) -// array([ 0., 1., 2.]) -// >>> np.arange(3,7) -// array([3, 4, 5, 6]) -// >>> np.arange(3,7,2) -// array([3, 5]) -// -//go:linkname Arange py.arange -func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object -// -// Return a string representation of a number in the given base system. -// -// Parameters -// ---------- -// number : int -// The value to convert. Positive and negative values are handled. -// base : int, optional -// Convert `number` to the `base` number system. The valid range is 2-36, -// the default value is 2. -// padding : int, optional -// Number of zeros padded on the left. Default is 0 (no padding). -// -// Returns -// ------- -// out : str -// String representation of `number` in `base` system. -// -// See Also -// -------- -// binary_repr : Faster version of `base_repr` for base 2. -// -// Examples -// -------- -// >>> np.base_repr(5) -// '101' -// >>> np.base_repr(6, 5) -// '11' -// >>> np.base_repr(7, base=5, padding=3) -// '00012' -// -// >>> np.base_repr(10, base=16) -// 'A' -// >>> np.base_repr(32, base=16) -// '20' -// -// -// -//go:linkname BaseRepr py.base_repr -func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object -// -// Return a full array with the same shape and type as a given array. -// -// Parameters -// ---------- -// a : array_like -// The shape and data-type of `a` define these same attributes of -// the returned array. -// fill_value : array_like -// Fill value. -// dtype : data-type, optional -// Overrides the data type of the result. -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, -// 'C' otherwise. 'K' means match the layout of `a` as closely -// as possible. -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `a`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of `fill_value` with the same shape and type as `a`. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full : Return a new array of given shape filled with value. -// -// Examples -// -------- -// >>> x = np.arange(6, dtype=int) -// >>> np.full_like(x, 1) -// array([1, 1, 1, 1, 1, 1]) -// >>> np.full_like(x, 0.1) -// array([0, 0, 0, 0, 0, 0]) -// >>> np.full_like(x, 0.1, dtype=np.double) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// >>> np.full_like(x, np.nan, dtype=np.double) -// array([nan, nan, nan, nan, nan, nan]) -// -// >>> y = np.arange(6, dtype=np.double) -// >>> np.full_like(y, 0.1) -// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) -// -// >>> y = np.zeros([2, 2, 3], dtype=int) -// >>> np.full_like(y, [0, 0, 255]) -// array([[[ 0, 0, 255], -// [ 0, 0, 255]], -// [[ 0, 0, 255], -// [ 0, 0, 255]]]) -// -// -//go:linkname FullLike py.full_like -func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Return the maximum of an array or maximum along an axis. -// -// `amax` is an alias of `~numpy.max`. -// -// See Also -// -------- -// max : alias of this function -// ndarray.max : equivalent method -// -// -//go:linkname Amax py.amax -func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric inverse tangent, element-wise. -// -// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. -// -// Parameters -// ---------- -// x : array_like -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Out has the same shape as `x`. Its real part is in -// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) -// and the positive `x`-axis. -// angle : Argument of complex values. -// -// Notes -// ----- -// `arctan` is a multi-valued function: for each `x` there are infinitely -// many numbers `z` such that tan(`z`) = `x`. The convention is to return -// the angle `z` whose real part lies in [-pi/2, pi/2]. -// -// For real-valued input data types, `arctan` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctan` is a complex analytic function that -// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous -// from the left on the former and from the right on the latter. -// -// The inverse tangent is also known as `atan` or tan^{-1}. -// -// References -// ---------- -// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, -// 10th printing, New York: Dover, 1964, pp. 79. -// https://personal.math.ubc.ca/~cbm/aands/page_79.htm -// -// Examples -// -------- -// We expect the arctan of 0 to be 0, and of 1 to be pi/4: -// -// >>> np.arctan([0, 1]) -// array([ 0. , 0.78539816]) -// -// >>> np.pi/4 -// 0.78539816339744828 -// -// Plot arctan: -// -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-10, 10) -// >>> plt.plot(x, np.arctan(x)) -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Arctan py.arctan -func Arctan(x *py.Object, out *py.Object) *py.Object -// -// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) -// -// First adjusts the date to fall on a valid day according to -// the ``roll`` rule, then applies offsets to the given dates -// counted in valid days. -// -// .. versionadded:: 1.7.0 -// -// Parameters -// ---------- -// dates : array_like of datetime64[D] -// The array of dates to process. -// offsets : array_like of int -// The array of offsets, which is broadcast with ``dates``. -// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional -// How to treat dates that do not fall on a valid day. The default -// is 'raise'. -// -// * 'raise' means to raise an exception for an invalid day. -// * 'nat' means to return a NaT (not-a-time) for an invalid day. -// * 'forward' and 'following' mean to take the first valid day -// later in time. -// * 'backward' and 'preceding' mean to take the first valid day -// earlier in time. -// * 'modifiedfollowing' means to take the first valid day -// later in time unless it is across a Month boundary, in which -// case to take the first valid day earlier in time. -// * 'modifiedpreceding' means to take the first valid day -// earlier in time unless it is across a Month boundary, in which -// case to take the first valid day later in time. -// weekmask : str or array_like of bool, optional -// A seven-element array indicating which of Monday through Sunday are -// valid days. May be specified as a length-seven list or array, like -// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string -// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for -// weekdays, optionally separated by white space. Valid abbreviations -// are: Mon Tue Wed Thu Fri Sat Sun -// holidays : array_like of datetime64[D], optional -// An array of dates to consider as invalid dates. They may be -// specified in any order, and NaT (not-a-time) dates are ignored. -// This list is saved in a normalized form that is suited for -// fast calculations of valid days. -// busdaycal : busdaycalendar, optional -// A `busdaycalendar` object which specifies the valid days. If this -// parameter is provided, neither weekmask nor holidays may be -// provided. -// out : array of datetime64[D], optional -// If provided, this array is filled with the result. -// -// Returns -// ------- -// out : array of datetime64[D] -// An array with a shape from broadcasting ``dates`` and ``offsets`` -// together, containing the dates with offsets applied. -// -// See Also -// -------- -// busdaycalendar : An object that specifies a custom set of valid days. -// is_busday : Returns a boolean array indicating valid days. -// busday_count : Counts how many valid days are in a half-open date range. -// -// Examples -// -------- -// >>> # First business day in October 2011 (not accounting for holidays) -// ... np.busday_offset('2011-10', 0, roll='forward') -// numpy.datetime64('2011-10-03') -// >>> # Last business day in February 2012 (not accounting for holidays) -// ... np.busday_offset('2012-03', -1, roll='forward') -// numpy.datetime64('2012-02-29') -// >>> # Third Wednesday in January 2011 -// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') -// numpy.datetime64('2011-01-19') -// >>> # 2012 Mother's Day in Canada and the U.S. -// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') -// numpy.datetime64('2012-05-13') -// -// >>> # First business day on or after a date -// ... np.busday_offset('2011-03-20', 0, roll='forward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 0, roll='forward') -// numpy.datetime64('2011-03-22') -// >>> # First business day after a date -// ... np.busday_offset('2011-03-20', 1, roll='backward') -// numpy.datetime64('2011-03-21') -// >>> np.busday_offset('2011-03-22', 1, roll='backward') -// numpy.datetime64('2011-03-23') -// -// -//go:linkname BusdayOffset py.busday_offset -func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object -// -// Return the indices for the upper-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The size of the arrays for which the returned indices will -// be valid. -// k : int, optional -// Diagonal offset (see `triu` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple, shape(2) of ndarrays, shape(`n`) -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. Can be used -// to slice a ndarray of shape(`n`, `n`). -// -// See also -// -------- -// tril_indices : similar function, for lower-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// triu, tril -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// upper triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> iu1 = np.triu_indices(4) -// >>> iu2 = np.triu_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[iu1] -// array([ 0, 1, 2, ..., 10, 11, 15]) -// -// And for assigning values: -// -// >>> a[iu1] = -1 -// >>> a -// array([[-1, -1, -1, -1], -// [ 4, -1, -1, -1], -// [ 8, 9, -1, -1], -// [12, 13, 14, -1]]) -// -// These cover only a small part of the whole array (two diagonals right -// of the main one): -// -// >>> a[iu2] = -10 -// >>> a -// array([[ -1, -1, -10, -10], -// [ 4, -1, -1, -10], -// [ 8, 9, -1, -1], -// [ 12, 13, 14, -1]]) -// -// -// -//go:linkname TriuIndices py.triu_indices -func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -//go:linkname GreaterEqual py.greater_equal -func GreaterEqual(__llgo_va_list ...interface{}) *py.Object -// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Round elements of the array to the nearest integer. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array is same shape and type as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// fix, ceil, floor, trunc -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.rint(a) -// array([-2., -2., -0., 0., 2., 2., 2.]) -// -//go:linkname Rint py.rint -func Rint(x *py.Object, out *py.Object) *py.Object -// -// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') -// -// Convert an array of datetimes into an array of strings. -// -// Parameters -// ---------- -// arr : array_like of datetime64 -// The array of UTC timestamps to format. -// unit : str -// One of None, 'auto', or a :ref:`datetime unit `. -// timezone : {'naive', 'UTC', 'local'} or tzinfo -// Timezone information to use when displaying the datetime. If 'UTC', end -// with a Z to indicate UTC time. If 'local', convert to the local timezone -// first, and suffix with a +-#### timezone offset. If a tzinfo object, -// then do as with 'local', but use the specified timezone. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} -// Casting to allow when changing between datetime units. -// -// Returns -// ------- -// str_arr : ndarray -// An array of strings the same shape as `arr`. -// -// Examples -// -------- -// >>> import pytz -// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') -// >>> d -// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', -// '2002-10-27T07:30'], dtype='datetime64[m]') -// -// Setting the timezone to UTC shows the same information, but with a Z suffix -// -// >>> np.datetime_as_string(d, timezone='UTC') -// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', -// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) -// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', -// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') -// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], -// dtype='>> np.datetime_as_string(d, unit='s') -// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', -// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') -// Traceback (most recent call last): -// ... -// TypeError: Cannot create a datetime string as units 'h' from a NumPy -// datetime with units 'm' according to the rule 'safe' -// -// -//go:linkname DatetimeAsString py.datetime_as_string -func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object -// -// Split an array into multiple sub-arrays vertically (row-wise). -// -// Please refer to the ``split`` documentation. ``vsplit`` is equivalent -// to ``split`` with `axis=0` (default), the array is always split along the -// first axis regardless of the array dimension. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.vsplit(x, 2) -// [array([[0., 1., 2., 3.], -// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]])] -// >>> np.vsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] -// -// With a higher dimensional array the split is still along the first axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.vsplit(x, 2) -// [array([[[0., 1.], -// [2., 3.]]]), array([[[4., 5.], -// [6., 7.]]])] -// -// -// -//go:linkname Vsplit py.vsplit -func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the indices for the lower-triangle of an (n, m) array. -// -// Parameters -// ---------- -// n : int -// The row dimension of the arrays for which the returned -// indices will be valid. -// k : int, optional -// Diagonal offset (see `tril` for details). -// m : int, optional -// .. versionadded:: 1.9.0 -// -// The column dimension of the arrays for which the returned -// arrays will be valid. -// By default `m` is taken equal to `n`. -// -// -// Returns -// ------- -// inds : tuple of arrays -// The indices for the triangle. The returned tuple contains two arrays, -// each with the indices along one dimension of the array. -// -// See also -// -------- -// triu_indices : similar function, for upper-triangular. -// mask_indices : generic function accepting an arbitrary mask function. -// tril, triu -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// Compute two different sets of indices to access 4x4 arrays, one for the -// lower triangular part starting at the main diagonal, and one starting two -// diagonals further right: -// -// >>> il1 = np.tril_indices(4) -// >>> il2 = np.tril_indices(4, 2) -// -// Here is how they can be used with a sample array: -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Both for indexing: -// -// >>> a[il1] -// array([ 0, 4, 5, ..., 13, 14, 15]) -// -// And for assigning values: -// -// >>> a[il1] = -1 -// >>> a -// array([[-1, 1, 2, 3], -// [-1, -1, 6, 7], -// [-1, -1, -1, 11], -// [-1, -1, -1, -1]]) -// -// These cover almost the whole array (two diagonals right of the main one): -// -// >>> a[il2] = -10 -// >>> a -// array([[-10, -10, -10, 3], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10], -// [-10, -10, -10, -10]]) -// -// -// -//go:linkname TrilIndices py.tril_indices -func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object -// -// Save several arrays into a single file in compressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// numpy.save : Save a single array to a binary file in NumPy format. -// numpy.savetxt : Save an array to a file as plain text. -// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format -// numpy.load : Load the files created by savez_compressed. -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is compressed with -// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable -// in ``.npy`` format. For a description of the ``.npy`` format, see -// :py:mod:`numpy.lib.format`. -// -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Examples -// -------- -// >>> test_array = np.random.rand(3, 2) -// >>> test_vector = np.random.rand(4) -// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) -// >>> loaded = np.load('/tmp/123.npz') -// >>> print(np.array_equal(test_array, loaded['a'])) -// True -// >>> print(np.array_equal(test_vector, loaded['b'])) -// True -// -// -// -//go:linkname SavezCompressed py.savez_compressed -func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// where(condition, [x, y], /) -// -// Return elements chosen from `x` or `y` depending on `condition`. -// -// .. note:: -// When only `condition` is provided, this function is a shorthand for -// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be -// preferred, as it behaves correctly for subclasses. The rest of this -// documentation covers only the case where all three arguments are -// provided. -// -// Parameters -// ---------- -// condition : array_like, bool -// Where True, yield `x`, otherwise yield `y`. -// x, y : array_like -// Values from which to choose. `x`, `y` and `condition` need to be -// broadcastable to some shape. -// -// Returns -// ------- -// out : ndarray -// An array with elements from `x` where `condition` is True, and elements -// from `y` elsewhere. -// -// See Also -// -------- -// choose -// nonzero : The function that is called when x and y are omitted -// -// Notes -// ----- -// If all the arrays are 1-D, `where` is equivalent to:: -// -// [xv if c else yv -// for c, xv, yv in zip(condition, x, y)] -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.where(a < 5, a, 10*a) -// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) -// -// This can be used on multidimensional arrays too: -// -// >>> np.where([[True, False], [True, True]], -// ... [[1, 2], [3, 4]], -// ... [[9, 8], [7, 6]]) -// array([[1, 8], -// [3, 4]]) -// -// The shapes of x, y, and the condition are broadcast together: -// -// >>> x, y = np.ogrid[:3, :4] -// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast -// array([[10, 0, 0, 0], -// [10, 11, 1, 1], -// [10, 11, 12, 2]]) -// -// >>> a = np.array([[0, 1, 2], -// ... [0, 2, 4], -// ... [0, 3, 6]]) -// >>> np.where(a < 4, a, -1) # -1 is broadcast -// array([[ 0, 1, 2], -// [ 0, 2, -1], -// [ 0, 3, -1]]) -// -// -//go:linkname Where py.where -func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object -// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// This is the NumPy implementation of the C library function fmod, the -// remainder has the same sign as the dividend `x1`. It is equivalent to -// the Matlab(TM) ``rem`` function and should not be confused with the -// Python modulus operator ``x1 % x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend. -// x2 : array_like -// Divisor. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The remainder of the division of `x1` by `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Equivalent to the Python ``%`` operator. -// divide -// -// Notes -// ----- -// The result of the modulo operation for negative dividend and divisors -// is bound by conventions. For `fmod`, the sign of result is the sign of -// the dividend, while for `remainder` the sign of the result is the sign -// of the divisor. The `fmod` function is equivalent to the Matlab(TM) -// ``rem`` function. -// -// Examples -// -------- -// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) -// array([-1, 0, -1, 1, 0, 1]) -// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) -// array([1, 0, 1, 1, 0, 1]) -// -// >>> np.fmod([5, 3], [2, 2.]) -// array([ 1., 1.]) -// >>> a = np.arange(-3, 3).reshape(3, 2) -// >>> a -// array([[-3, -2], -// [-1, 0], -// [ 1, 2]]) -// >>> np.fmod(a, [2,2]) -// array([[-1, 0], -// [-1, 0], -// [ 1, 0]]) -// -//go:linkname Fmod py.fmod -func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for finiteness (not infinity and not Not a Number). -// -// The result is returned as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray, bool -// True where ``x`` is not positive infinity, negative infinity, -// or NaN; false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isnan -// -// Notes -// ----- -// Not a Number, positive infinity and negative infinity are considered -// to be non-finite. -// -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// Also that positive infinity is not equivalent to negative infinity. But -// infinity is equivalent to positive infinity. Errors result if the -// second argument is also supplied when `x` is a scalar input, or if -// first and second arguments have different shapes. -// -// Examples -// -------- -// >>> np.isfinite(1) -// True -// >>> np.isfinite(0) -// True -// >>> np.isfinite(np.nan) -// False -// >>> np.isfinite(np.inf) -// False -// >>> np.isfinite(np.NINF) -// False -// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) -// array([False, True, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isfinite(x, y) -// array([0, 1, 0]) -// >>> y -// array([0, 1, 0]) -// -//go:linkname Isfinite py.isfinite -func Isfinite(x *py.Object, out *py.Object) *py.Object -// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then that -// element is returned. If both elements are NaNs then the first is -// returned. The latter distinction is important for complex NaNs, which -// are defined as at least one of the real or imaginary parts being a NaN. -// The net effect is that NaNs are propagated. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// fmax, amax, nanmax -// -// Notes -// ----- -// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when -// neither x1 nor x2 are NaNs, but it is faster and does proper -// broadcasting. -// -// Examples -// -------- -// >>> np.minimum([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([nan, nan, nan]) -// >>> np.minimum(-np.Inf, 1) -// -inf -// -//go:linkname Minimum py.minimum -func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// ravel_multi_index(multi_index, dims, mode='raise', order='C') -// -// Converts a tuple of index arrays into an array of flat -// indices, applying boundary modes to the multi-index. -// -// Parameters -// ---------- -// multi_index : tuple of array_like -// A tuple of integer arrays, one array for each dimension. -// dims : tuple of ints -// The shape of array into which the indices from ``multi_index`` apply. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices are handled. Can specify -// either one mode or a tuple of modes, one mode per index. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// In 'clip' mode, a negative index which would normally -// wrap will clip to 0 instead. -// order : {'C', 'F'}, optional -// Determines whether the multi-index should be viewed as -// indexing in row-major (C-style) or column-major -// (Fortran-style) order. -// -// Returns -// ------- -// raveled_indices : ndarray -// An array of indices into the flattened version of an array -// of dimensions ``dims``. -// -// See Also -// -------- -// unravel_index -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// Examples -// -------- -// >>> arr = np.array([[3,6,6],[4,5,1]]) -// >>> np.ravel_multi_index(arr, (7,6)) -// array([22, 41, 37]) -// >>> np.ravel_multi_index(arr, (7,6), order='F') -// array([31, 41, 13]) -// >>> np.ravel_multi_index(arr, (4,6), mode='clip') -// array([22, 23, 19]) -// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) -// array([12, 13, 13]) -// -// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) -// 1621 -// -// -//go:linkname RavelMultiIndex py.ravel_multi_index -func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object -// -// Compute the weighted average along the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Array containing data to be averaged. If `a` is not an array, a -// conversion is attempted. -// axis : None or int or tuple of ints, optional -// Axis or axes along which to average `a`. The default, -// axis=None, will average over all of the elements of the input array. -// If axis is negative it counts from the last to the first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, averaging is performed on all of the axes -// specified in the tuple instead of a single axis or all the axes as -// before. -// weights : array_like, optional -// An array of weights associated with the values in `a`. Each value in -// `a` contributes to the average according to its associated weight. -// The weights array can either be 1-D (in which case its length must be -// the size of `a` along the given axis) or of the same shape as `a`. -// If `weights=None`, then all data in `a` are assumed to have a -// weight equal to one. The 1-D calculation is:: -// -// avg = sum(a * weights) / sum(weights) -// -// The only constraint on `weights` is that `sum(weights)` must not be 0. -// returned : bool, optional -// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) -// is returned, otherwise only the average is returned. -// If `weights=None`, `sum_of_weights` is equivalent to the number of -// elements over which the average is taken. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// *Note:* `keepdims` will not work with instances of `numpy.matrix` -// or other classes whose methods do not support `keepdims`. -// -// .. versionadded:: 1.23.0 -// -// Returns -// ------- -// retval, [sum_of_weights] : array_type or double -// Return the average along the specified axis. When `returned` is `True`, -// return a tuple with the average as the first element and the sum -// of the weights as the second element. `sum_of_weights` is of the -// same type as `retval`. The result dtype follows a genereal pattern. -// If `weights` is None, the result dtype will be that of `a` , or ``float64`` -// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- -// integral, the result type will be the type of lowest precision capable of -// representing values of both `a` and `weights`. If `a` happens to be -// integral, the previous rules still applies but the result dtype will -// at least be ``float64``. -// -// Raises -// ------ -// ZeroDivisionError -// When all weights along axis are zero. See `numpy.ma.average` for a -// version robust to this type of error. -// TypeError -// When the length of 1D `weights` is not the same as the shape of `a` -// along axis. -// -// See Also -// -------- -// mean -// -// ma.average : average for masked arrays -- useful if your data contains -// "missing" values -// numpy.result_type : Returns the type that results from applying the -// numpy type promotion rules to the arguments. -// -// Examples -// -------- -// >>> data = np.arange(1, 5) -// >>> data -// array([1, 2, 3, 4]) -// >>> np.average(data) -// 2.5 -// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) -// 4.0 -// -// >>> data = np.arange(6).reshape((3, 2)) -// >>> data -// array([[0, 1], -// [2, 3], -// [4, 5]]) -// >>> np.average(data, axis=1, weights=[1./4, 3./4]) -// array([0.75, 2.75, 4.75]) -// >>> np.average(data, weights=[1./4, 3./4]) -// Traceback (most recent call last): -// ... -// TypeError: Axis must be specified when shapes of a and weights differ. -// -// >>> a = np.ones(5, dtype=np.float128) -// >>> w = np.ones(5, dtype=np.complex64) -// >>> avg = np.average(a, weights=w) -// >>> print(avg.dtype) -// complex256 -// -// With ``keepdims=True``, the following result has shape (3, 1). -// -// >>> np.average(data, axis=1, keepdims=True) -// array([[0.5], -// [2.5], -// [4.5]]) -// -// -//go:linkname Average py.average -func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object -// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, -// like=None) -// -// Create an array. -// -// Parameters -// ---------- -// object : array_like -// An array, any object exposing the array interface, an object whose -// ``__array__`` method returns an array, or any (nested) sequence. -// If object is a scalar, a 0-dimensional array containing object is -// returned. -// dtype : data-type, optional -// The desired data-type for the array. If not given, NumPy will try to use -// a default ``dtype`` that can represent the values (by applying promotion -// rules when necessary.) -// copy : bool, optional -// If true (default), then the object is copied. Otherwise, a copy will -// only be made if ``__array__`` returns a copy, if obj is a nested -// sequence, or if a copy is needed to satisfy any of the other -// requirements (``dtype``, ``order``, etc.). -// order : {'K', 'A', 'C', 'F'}, optional -// Specify the memory layout of the array. If object is not an array, the -// newly created array will be in C order (row major) unless 'F' is -// specified, in which case it will be in Fortran order (column major). -// If object is an array the following holds. -// -// ===== ========= =================================================== -// order no copy copy=True -// ===== ========= =================================================== -// 'K' unchanged F & C order preserved, otherwise most similar order -// 'A' unchanged F order if input is F and not C, otherwise C order -// 'C' C order C order -// 'F' F order F order -// ===== ========= =================================================== -// -// When ``copy=False`` and a copy is made for other reasons, the result is -// the same as if ``copy=True``, with some exceptions for 'A', see the -// Notes section. The default order is 'K'. -// subok : bool, optional -// If True, then sub-classes will be passed-through, otherwise -// the returned array will be forced to be a base-class array (default). -// ndmin : int, optional -// Specifies the minimum number of dimensions that the resulting -// array should have. Ones will be prepended to the shape as -// needed to meet this requirement. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// An array object satisfying the specified requirements. -// -// See Also -// -------- -// empty_like : Return an empty array with shape and type of input. -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// ones : Return a new array setting values to one. -// zeros : Return a new array setting values to zero. -// full : Return a new array of given shape filled with value. -// -// -// Notes -// ----- -// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, -// and a copy is forced by a change in dtype, then the order of the result is -// not necessarily 'C' as expected. This is likely a bug. -// -// Examples -// -------- -// >>> np.array([1, 2, 3]) -// array([1, 2, 3]) -// -// Upcasting: -// -// >>> np.array([1, 2, 3.0]) -// array([ 1., 2., 3.]) -// -// More than one dimension: -// -// >>> np.array([[1, 2], [3, 4]]) -// array([[1, 2], -// [3, 4]]) -// -// Minimum dimensions 2: -// -// >>> np.array([1, 2, 3], ndmin=2) -// array([[1, 2, 3]]) -// -// Type provided: -// -// >>> np.array([1, 2, 3], dtype=complex) -// array([ 1.+0.j, 2.+0.j, 3.+0.j]) -// -// Data-type consisting of more than one element: -// -// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] -// array([1, 3]) -// -// Creating an array from sub-classes: -// -// >>> np.array(np.mat('1 2; 3 4')) -// array([[1, 2], -// [3, 4]]) -// -// >>> np.array(np.mat('1 2; 3 4'), subok=True) -// matrix([[1, 2], -// [3, 4]]) -// -//go:linkname Array py.array -func Array(object *py.Object, dtype *py.Object) *py.Object -// fromstring(string, dtype=float, count=-1, *, sep, like=None) -// -// A new 1-D array initialized from text data in a string. -// -// Parameters -// ---------- -// string : str -// A string containing the data. -// dtype : data-type, optional -// The data type of the array; default: float. For binary input data, -// the data must be in exactly this format. Most builtin numeric types are -// supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int, optional -// Read this number of `dtype` elements from the data. If this is -// negative (the default), the count will be determined from the -// length of the data. -// sep : str, optional -// The string separating numbers in the data; extra whitespace between -// elements is also ignored. -// -// .. deprecated:: 1.14 -// Passing ``sep=''``, the default, is deprecated since it will -// trigger the deprecated binary mode of this function. This mode -// interprets `string` as binary bytes, rather than ASCII text with -// decimal numbers, an operation which is better spelt -// ``frombuffer(string, dtype, count)``. If `string` contains unicode -// text, the binary mode of `fromstring` will first encode it into -// bytes using utf-8, which will not produce sane results. -// -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// arr : ndarray -// The constructed array. -// -// Raises -// ------ -// ValueError -// If the string is not the correct size to satisfy the requested -// `dtype` and `count`. -// -// See Also -// -------- -// frombuffer, fromfile, fromiter -// -// Examples -// -------- -// >>> np.fromstring('1 2', dtype=int, sep=' ') -// array([1, 2]) -// >>> np.fromstring('1, 2', dtype=int, sep=',') -// array([1, 2]) -// -//go:linkname Fromstring py.fromstring -func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object -// -// Repeat each element of an array after themselves -// -// Parameters -// ---------- -// a : array_like -// Input array. -// repeats : int or array of ints -// The number of repetitions for each element. `repeats` is broadcasted -// to fit the shape of the given axis. -// axis : int, optional -// The axis along which to repeat values. By default, use the -// flattened input array, and return a flat output array. -// -// Returns -// ------- -// repeated_array : ndarray -// Output array which has the same shape as `a`, except along -// the given axis. -// -// See Also -// -------- -// tile : Tile an array. -// unique : Find the unique elements of an array. -// -// Examples -// -------- -// >>> np.repeat(3, 4) -// array([3, 3, 3, 3]) -// >>> x = np.array([[1,2],[3,4]]) -// >>> np.repeat(x, 2) -// array([1, 1, 2, 2, 3, 3, 4, 4]) -// >>> np.repeat(x, 3, axis=1) -// array([[1, 1, 1, 2, 2, 2], -// [3, 3, 3, 4, 4, 4]]) -// >>> np.repeat(x, [1, 2], axis=0) -// array([[1, 2], -// [3, 4], -// [3, 4]]) -// -// -// -//go:linkname Repeat py.repeat -func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object -// -// Return the sum along diagonals of the array. -// -// If `a` is 2-D, the sum along its diagonal with the given offset -// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. -// -// If `a` has more than two dimensions, then the axes specified by axis1 and -// axis2 are used to determine the 2-D sub-arrays whose traces are returned. -// The shape of the resulting array is the same as that of `a` with `axis1` -// and `axis2` removed. -// -// Parameters -// ---------- -// a : array_like -// Input array, from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be both positive -// and negative. Defaults to 0. -// axis1, axis2 : int, optional -// Axes to be used as the first and second axis of the 2-D sub-arrays -// from which the diagonals should be taken. Defaults are the first two -// axes of `a`. -// dtype : dtype, optional -// Determines the data-type of the returned array and of the accumulator -// where the elements are summed. If dtype has the value None and `a` is -// of integer type of precision less than the default integer -// precision, then the default integer precision is used. Otherwise, -// the precision is the same as that of `a`. -// out : ndarray, optional -// Array into which the output is placed. Its type is preserved and -// it must be of the right shape to hold the output. -// -// Returns -// ------- -// sum_along_diagonals : ndarray -// If `a` is 2-D, the sum along the diagonal is returned. If `a` has -// larger dimensions, then an array of sums along diagonals is returned. -// -// See Also -// -------- -// diag, diagonal, diagflat -// -// Examples -// -------- -// >>> np.trace(np.eye(3)) -// 3.0 -// >>> a = np.arange(8).reshape((2,2,2)) -// >>> np.trace(a) -// array([6, 8]) -// -// >>> a = np.arange(24).reshape((2,2,2,3)) -// >>> np.trace(a).shape -// (2, 3) -// -// -// -//go:linkname Trace py.trace -func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object -// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the base 10 logarithm of the input array, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The logarithm to the base 10 of `x`, element-wise. NaNs are -// returned where x is negative. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.log10 -// -// Notes -// ----- -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `10**z = x`. The convention is to return the -// `z` whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log10` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log10` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. -// `log10` handles the floating-point negative zero as an infinitesimal -// negative number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 67. -// https://personal.math.ubc.ca/~cbm/aands/page_67.htm -// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm -// -// Examples -// -------- -// >>> np.log10([1e-15, -3.]) -// array([-15., nan]) -// -//go:linkname Log10 py.log10 -func Log10(x *py.Object, out *py.Object) *py.Object -// -// Modified Bessel function of the first kind, order 0. -// -// Usually denoted :math:`I_0`. -// -// Parameters -// ---------- -// x : array_like of float -// Argument of the Bessel function. -// -// Returns -// ------- -// out : ndarray, shape = x.shape, dtype = float -// The modified Bessel function evaluated at each of the elements of `x`. -// -// See Also -// -------- -// scipy.special.i0, scipy.special.iv, scipy.special.ive -// -// Notes -// ----- -// The scipy implementation is recommended over this function: it is a -// proper ufunc written in C, and more than an order of magnitude faster. -// -// We use the algorithm published by Clenshaw [1]_ and referenced by -// Abramowitz and Stegun [2]_, for which the function domain is -// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev -// polynomial expansions are employed in each interval. Relative error on -// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a -// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). -// -// References -// ---------- -// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in -// *National Physical Laboratory Mathematical Tables*, vol. 5, London: -// Her Majesty's Stationery Office, 1962. -// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical -// Functions*, 10th printing, New York: Dover, 1964, pp. 379. -// https://personal.math.ubc.ca/~cbm/aands/page_379.htm -// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero -// -// Examples -// -------- -// >>> np.i0(0.) -// array(1.0) -// >>> np.i0([0, 1, 2, 3]) -// array([1. , 1.26606588, 2.2795853 , 4.88079259]) -// -// -// -//go:linkname I0 py.i0 -func I0(x *py.Object) *py.Object -// -// Round to nearest integer towards zero. -// -// Round an array of floats element-wise to nearest integer towards zero. -// The rounded values are returned as floats. -// -// Parameters -// ---------- -// x : array_like -// An array of floats to be rounded -// out : ndarray, optional -// A location into which the result is stored. If provided, it must have -// a shape that the input broadcasts to. If not provided or None, a -// freshly-allocated array is returned. -// -// Returns -// ------- -// out : ndarray of floats -// A float array with the same dimensions as the input. -// If second argument is not supplied then a float array is returned -// with the rounded values. -// -// If a second argument is supplied the result is stored there. -// The return value `out` is then a reference to that array. -// -// See Also -// -------- -// rint, trunc, floor, ceil -// around : Round to given number of decimals -// -// Examples -// -------- -// >>> np.fix(3.14) -// 3.0 -// >>> np.fix(3) -// 3.0 -// >>> np.fix([2.1, 2.9, -2.1, -2.9]) -// array([ 2., 2., -2., -2.]) -// -// -// -//go:linkname Fix py.fix -func Fix(x *py.Object, out *py.Object) *py.Object -// -// Find the coefficients of a polynomial with the given sequence of roots. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Returns the coefficients of the polynomial whose leading coefficient -// is one for the given sequence of zeros (multiple roots must be included -// in the sequence as many times as their multiplicity; see Examples). -// A square matrix (or array, which will be treated as a matrix) can also -// be given, in which case the coefficients of the characteristic polynomial -// of the matrix are returned. -// -// Parameters -// ---------- -// seq_of_zeros : array_like, shape (N,) or (N, N) -// A sequence of polynomial roots, or a square array or matrix object. -// -// Returns -// ------- -// c : ndarray -// 1D array of polynomial coefficients from highest to lowest degree: -// -// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` -// where c[0] always equals 1. -// -// Raises -// ------ -// ValueError -// If input is the wrong shape (the input must be a 1-D or square -// 2-D array). -// -// See Also -// -------- -// polyval : Compute polynomial values. -// roots : Return the roots of a polynomial. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// Specifying the roots of a polynomial still leaves one degree of -// freedom, typically represented by an undetermined leading -// coefficient. [1]_ In the case of this function, that coefficient - -// the first one in the returned array - is always taken as one. (If -// for some reason you have one other point, the only automatic way -// presently to leverage that information is to use ``polyfit``.) -// -// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` -// matrix **A** is given by -// -// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, -// -// where **I** is the `n`-by-`n` identity matrix. [2]_ -// -// References -// ---------- -// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, -// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. -// -// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," -// Academic Press, pg. 182, 1980. -// -// Examples -// -------- -// Given a sequence of a polynomial's zeros: -// -// >>> np.poly((0, 0, 0)) # Multiple root example -// array([1., 0., 0., 0.]) -// -// The line above represents z**3 + 0*z**2 + 0*z + 0. -// -// >>> np.poly((-1./2, 0, 1./2)) -// array([ 1. , 0. , -0.25, 0. ]) -// -// The line above represents z**3 - z/4 -// -// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) -// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random -// -// Given a square array object: -// -// >>> P = np.array([[0, 1./3], [-1./2, 0]]) -// >>> np.poly(P) -// array([1. , 0. , 0.16666667]) -// -// Note how in all cases the leading coefficient is always 1. -// -// -// -//go:linkname Poly py.poly -func Poly(seqOfZeros *py.Object) *py.Object -// -// Return indices that are non-zero in the flattened version of a. -// -// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// -// Returns -// ------- -// res : ndarray -// Output array, containing the indices of the elements of ``a.ravel()`` -// that are non-zero. -// -// See Also -// -------- -// nonzero : Return the indices of the non-zero elements of the input array. -// ravel : Return a 1-D array containing the elements of the input array. -// -// Examples -// -------- -// >>> x = np.arange(-2, 3) -// >>> x -// array([-2, -1, 0, 1, 2]) -// >>> np.flatnonzero(x) -// array([0, 1, 3, 4]) -// -// Use the indices of the non-zero elements as an index array to extract -// these elements: -// -// >>> x.ravel()[np.flatnonzero(x)] -// array([-2, -1, 1, 2]) -// -// -// -//go:linkname Flatnonzero py.flatnonzero -func Flatnonzero(a *py.Object) *py.Object -// -// Return the product of array elements over a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// axis : None or int or tuple of ints, optional -// Axis or axes along which a product is performed. The default, -// axis=None, will calculate the product of all the elements in the -// input array. If axis is negative it counts from the last to the -// first axis. -// -// .. versionadded:: 1.7.0 -// -// If axis is a tuple of ints, a product is performed on all of the -// axes specified in the tuple instead of a single axis or all the -// axes as before. -// dtype : dtype, optional -// The type of the returned array, as well as of the accumulator in -// which the elements are multiplied. The dtype of `a` is used by -// default unless `a` has an integer dtype of less precision than the -// default platform integer. In that case, if `a` is signed then the -// platform integer is used while if `a` is unsigned then an unsigned -// integer of the same precision as the platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in the -// result as dimensions with size one. With this option, the result -// will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `prod` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// initial : scalar, optional -// The starting value for this product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.15.0 -// -// where : array_like of bool, optional -// Elements to include in the product. See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// product_along_axis : ndarray, see `dtype` parameter above. -// An array shaped as `a` but with the specified axis removed. -// Returns a reference to `out` if specified. -// -// See Also -// -------- -// ndarray.prod : equivalent method -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. That means that, on a 32-bit platform: -// -// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) -// >>> np.prod(x) -// 16 # may vary -// -// The product of an empty array is the neutral element 1: -// -// >>> np.prod([]) -// 1.0 -// -// Examples -// -------- -// By default, calculate the product of all elements: -// -// >>> np.prod([1.,2.]) -// 2.0 -// -// Even when the input array is two-dimensional: -// -// >>> a = np.array([[1., 2.], [3., 4.]]) -// >>> np.prod(a) -// 24.0 -// -// But we can also specify the axis over which to multiply: -// -// >>> np.prod(a, axis=1) -// array([ 2., 12.]) -// >>> np.prod(a, axis=0) -// array([3., 8.]) -// -// Or select specific elements to include: -// -// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) -// 3.0 -// -// If the type of `x` is unsigned, then the output type is -// the unsigned platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.uint8) -// >>> np.prod(x).dtype == np.uint -// True -// -// If `x` is of a signed integer type, then the output type -// is the default platform integer: -// -// >>> x = np.array([1, 2, 3], dtype=np.int8) -// >>> np.prod(x).dtype == int -// True -// -// You can also start the product with a value other than one: -// -// >>> np.prod([1, 2], initial=5) -// 10 -// -// -//go:linkname Prod py.prod -func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object -// -// Check whether some values are true. -// -// Refer to `any` for full documentation. -// -// .. deprecated:: 1.25.0 -// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `any` instead. -// -// See Also -// -------- -// any : equivalent function; see for details. -// -// -//go:linkname Sometrue py.sometrue -func Sometrue(__llgo_va_list ...interface{}) *py.Object -// -// Return the Bartlett window. -// -// The Bartlett window is very similar to a triangular window, except -// that the end points are at zero. It is often used in signal -// processing for tapering a signal, without generating too much -// ripple in the frequency domain. -// -// Parameters -// ---------- -// M : int -// Number of points in the output window. If zero or less, an -// empty array is returned. -// -// Returns -// ------- -// out : array -// The triangular window, with the maximum value normalized to one -// (the value one appears only if the number of samples is odd), with -// the first and last samples equal to zero. -// -// See Also -// -------- -// blackman, hamming, hanning, kaiser -// -// Notes -// ----- -// The Bartlett window is defined as -// -// .. math:: w(n) = \frac{2}{M-1} \left( -// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| -// \right) -// -// Most references to the Bartlett window come from the signal processing -// literature, where it is used as one of many windowing functions for -// smoothing values. Note that convolution with this window produces linear -// interpolation. It is also known as an apodization (which means "removing -// the foot", i.e. smoothing discontinuities at the beginning and end of the -// sampled signal) or tapering function. The Fourier transform of the -// Bartlett window is the product of two sinc functions. Note the excellent -// discussion in Kanasewich [2]_. -// -// References -// ---------- -// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", -// Biometrika 37, 1-16, 1950. -// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", -// The University of Alberta Press, 1975, pp. 109-110. -// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal -// Processing", Prentice-Hall, 1999, pp. 468-471. -// .. [4] Wikipedia, "Window function", -// https://en.wikipedia.org/wiki/Window_function -// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, -// "Numerical Recipes", Cambridge University Press, 1986, page 429. -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> np.bartlett(12) -// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary -// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, -// 0.18181818, 0. ]) -// -// Plot the window and its frequency response (requires SciPy and matplotlib): -// -// >>> from numpy.fft import fft, fftshift -// >>> window = np.bartlett(51) -// >>> plt.plot(window) -// [] -// >>> plt.title("Bartlett window") -// Text(0.5, 1.0, 'Bartlett window') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("Sample") -// Text(0.5, 0, 'Sample') -// >>> plt.show() -// -// >>> plt.figure() -//
-// >>> A = fft(window, 2048) / 25.5 -// >>> mag = np.abs(fftshift(A)) -// >>> freq = np.linspace(-0.5, 0.5, len(A)) -// >>> with np.errstate(divide='ignore', invalid='ignore'): -// ... response = 20 * np.log10(mag) -// ... -// >>> response = np.clip(response, -100, 100) -// >>> plt.plot(freq, response) -// [] -// >>> plt.title("Frequency response of Bartlett window") -// Text(0.5, 1.0, 'Frequency response of Bartlett window') -// >>> plt.ylabel("Magnitude [dB]") -// Text(0, 0.5, 'Magnitude [dB]') -// >>> plt.xlabel("Normalized frequency [cycles per sample]") -// Text(0.5, 0, 'Normalized frequency [cycles per sample]') -// >>> _ = plt.axis('tight') -// >>> plt.show() -// -// -// -//go:linkname Bartlett py.bartlett -func Bartlett(M *py.Object) *py.Object -// -// Add documentation to an existing object, typically one defined in C -// -// The purpose is to allow easier editing of the docstrings without requiring -// a re-compile. This exists primarily for internal use within numpy itself. -// -// Parameters -// ---------- -// place : str -// The absolute name of the module to import from -// obj : str -// The name of the object to add documentation to, typically a class or -// function name -// doc : {str, Tuple[str, str], List[Tuple[str, str]]} -// If a string, the documentation to apply to `obj` -// -// If a tuple, then the first element is interpreted as an attribute of -// `obj` and the second as the docstring to apply - ``(method, docstring)`` -// -// If a list, then each element of the list should be a tuple of length -// two - ``[(method1, docstring1), (method2, docstring2), ...]`` -// warn_on_python : bool -// If True, the default, emit `UserWarning` if this is used to attach -// documentation to a pure-python object. -// -// Notes -// ----- -// This routine never raises an error if the docstring can't be written, but -// will raise an error if the object being documented does not exist. -// -// This routine cannot modify read-only docstrings, as appear -// in new-style classes or built-in functions. Because this -// routine never raises an error the caller must check manually -// that the docstrings were changed. -// -// Since this function grabs the ``char *`` from a c-level str object and puts -// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of -// C-API best-practices, by: -// -// - modifying a `PyTypeObject` after calling `PyType_Ready` -// - calling `Py_INCREF` on the str and losing the reference, so the str -// will never be released -// -// If possible it should be avoided. -// -// -//go:linkname AddNewdoc py.add_newdoc -func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object -// -// Show libraries and system information on which NumPy was built -// and is being used -// -// Parameters -// ---------- -// mode : {`'stdout'`, `'dicts'`}, optional. -// Indicates how to display the config information. -// `'stdout'` prints to console, `'dicts'` returns a dictionary -// of the configuration. -// -// Returns -// ------- -// out : {`dict`, `None`} -// If mode is `'dicts'`, a dict is returned, else None -// -// See Also -// -------- -// get_include : Returns the directory containing NumPy C -// header files. -// -// Notes -// ----- -// 1. The `'stdout'` mode will give more readable -// output if ``pyyaml`` is installed -// -// -// -//go:linkname ShowConfig py.show_config -func ShowConfig(mode *py.Object) *py.Object -// -// result_type(*arrays_and_dtypes) -// -// Returns the type that results from applying the NumPy -// type promotion rules to the arguments. -// -// Type promotion in NumPy works similarly to the rules in languages -// like C++, with some slight differences. When both scalars and -// arrays are used, the array's type takes precedence and the actual value -// of the scalar is taken into account. -// -// For example, calculating 3*a, where a is an array of 32-bit floats, -// intuitively should result in a 32-bit float output. If the 3 is a -// 32-bit integer, the NumPy rules indicate it can't convert losslessly -// into a 32-bit float, so a 64-bit float should be the result type. -// By examining the value of the constant, '3', we see that it fits in -// an 8-bit integer, which can be cast losslessly into the 32-bit float. -// -// Parameters -// ---------- -// arrays_and_dtypes : list of arrays and dtypes -// The operands of some operation whose result type is needed. -// -// Returns -// ------- -// out : dtype -// The result type. -// -// See also -// -------- -// dtype, promote_types, min_scalar_type, can_cast -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The specific algorithm used is as follows. -// -// Categories are determined by first checking which of boolean, -// integer (int/uint), or floating point (float/complex) the maximum -// kind of all the arrays and the scalars are. -// -// If there are only scalars or the maximum category of the scalars -// is higher than the maximum category of the arrays, -// the data types are combined with :func:`promote_types` -// to produce the return value. -// -// Otherwise, `min_scalar_type` is called on each scalar, and -// the resulting data types are all combined with :func:`promote_types` -// to produce the return value. -// -// The set of int values is not a subset of the uint values for types -// with the same number of bits, something not reflected in -// :func:`min_scalar_type`, but handled as a special case in `result_type`. -// -// Examples -// -------- -// >>> np.result_type(3, np.arange(7, dtype='i1')) -// dtype('int8') -// -// >>> np.result_type('i4', 'c8') -// dtype('complex128') -// -// >>> np.result_type(3.0, -2) -// dtype('float64') -// -// -// -//go:linkname ResultType py.result_type -func ResultType(__llgo_va_list ...interface{}) *py.Object -// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truth value of (x1 <= x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less_equal([4, 2, 1], [2, 2, 2]) -// array([False, True, True]) -// -// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on -// ndarrays. -// -// >>> a = np.array([4, 2, 1]) -// >>> b = np.array([2, 2, 2]) -// >>> a <= b -// array([False, True, True]) -// -//go:linkname LessEqual py.less_equal -func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname TrueDivide py.true_divide -func TrueDivide(__llgo_va_list ...interface{}) *py.Object -// -// einsum(subscripts, *operands, out=None, dtype=None, order='K', -// casting='safe', optimize=False) -// -// Evaluates the Einstein summation convention on the operands. -// -// Using the Einstein summation convention, many common multi-dimensional, -// linear algebraic array operations can be represented in a simple fashion. -// In *implicit* mode `einsum` computes these values. -// -// In *explicit* mode, `einsum` provides further flexibility to compute -// other array operations that might not be considered classical Einstein -// summation operations, by disabling, or forcing summation over specified -// subscript labels. -// -// See the notes and examples for clarification. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation as comma separated list of -// subscript labels. An implicit (classical Einstein summation) -// calculation is performed unless the explicit indicator '->' is -// included as well as subscript labels of the precise output form. -// operands : list of array_like -// These are the arrays for the operation. -// out : ndarray, optional -// If provided, the calculation is done into this array. -// dtype : {data-type, None}, optional -// If provided, forces the calculation to use the data type specified. -// Note that you may have to also give a more liberal `casting` -// parameter to allow the conversions. Default is None. -// order : {'C', 'F', 'A', 'K'}, optional -// Controls the memory layout of the output. 'C' means it should -// be C contiguous. 'F' means it should be Fortran contiguous, -// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. -// 'K' means it should be as close to the layout as the inputs as -// is possible, including arbitrarily permuted axes. -// Default is 'K'. -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Setting this to -// 'unsafe' is not recommended, as it can adversely affect accumulations. -// -// * 'no' means the data types should not be cast at all. -// * 'equiv' means only byte-order changes are allowed. -// * 'safe' means only casts which can preserve values are allowed. -// * 'same_kind' means only safe casts or casts within a kind, -// like float64 to float32, are allowed. -// * 'unsafe' means any data conversions may be done. -// -// Default is 'safe'. -// optimize : {False, True, 'greedy', 'optimal'}, optional -// Controls if intermediate optimization should occur. No optimization -// will occur if False and True will default to the 'greedy' algorithm. -// Also accepts an explicit contraction list from the ``np.einsum_path`` -// function. See ``np.einsum_path`` for more details. Defaults to False. -// -// Returns -// ------- -// output : ndarray -// The calculation based on the Einstein summation convention. -// -// See Also -// -------- -// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot -// einops : -// similar verbose interface is provided by -// `einops `_ package to cover -// additional operations: transpose, reshape/flatten, repeat/tile, -// squeeze/unsqueeze and reductions. -// opt_einsum : -// `opt_einsum `_ -// optimizes contraction order for einsum-like expressions -// in backend-agnostic manner. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// The Einstein summation convention can be used to compute -// many multi-dimensional, linear algebraic array operations. `einsum` -// provides a succinct way of representing these. -// -// A non-exhaustive list of these operations, -// which can be computed by `einsum`, is shown below along with examples: -// -// * Trace of an array, :py:func:`numpy.trace`. -// * Return a diagonal, :py:func:`numpy.diag`. -// * Array axis summations, :py:func:`numpy.sum`. -// * Transpositions and permutations, :py:func:`numpy.transpose`. -// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. -// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. -// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. -// * Tensor contractions, :py:func:`numpy.tensordot`. -// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. -// -// The subscripts string is a comma-separated list of subscript labels, -// where each label refers to a dimension of the corresponding operand. -// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` -// is equivalent to :py:func:`np.inner(a,b) `. If a label -// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a -// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` -// describes traditional matrix multiplication and is equivalent to -// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one -// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent -// to :py:func:`np.trace(a) `. -// -// In *implicit mode*, the chosen subscripts are important -// since the axes of the output are reordered alphabetically. This -// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while -// ``np.einsum('ji', a)`` takes its transpose. Additionally, -// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, -// ``np.einsum('ij,jh', a, b)`` returns the transpose of the -// multiplication since subscript 'h' precedes subscript 'i'. -// -// In *explicit mode* the output can be directly controlled by -// specifying output subscript labels. This requires the -// identifier '->' as well as the list of output subscript labels. -// This feature increases the flexibility of the function since -// summing can be disabled or forced when required. The call -// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, -// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. -// The difference is that `einsum` does not allow broadcasting by default. -// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the -// order of the output subscript labels and therefore returns matrix -// multiplication, unlike the example above in implicit mode. -// -// To enable and control broadcasting, use an ellipsis. Default -// NumPy-style broadcasting is done by adding an ellipsis -// to the left of each term, like ``np.einsum('...ii->...i', a)``. -// To take the trace along the first and last axes, -// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix -// product with the left-most indices instead of rightmost, one can do -// ``np.einsum('ij...,jk...->ik...', a, b)``. -// -// When there is only one operand, no axes are summed, and no output -// parameter is provided, a view into the operand is returned instead -// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` -// produces a view (changed in version 1.10.0). -// -// `einsum` also provides an alternative way to provide the subscripts -// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. -// If the output shape is not provided in this format `einsum` will be -// calculated in implicit mode, otherwise it will be performed explicitly. -// The examples below have corresponding `einsum` calls with the two -// parameter methods. -// -// .. versionadded:: 1.10.0 -// -// Views returned from einsum are now writeable whenever the input array -// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now -// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` -// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal -// of a 2D array. -// -// .. versionadded:: 1.12.0 -// -// Added the ``optimize`` argument which will optimize the contraction order -// of an einsum expression. For a contraction with three or more operands this -// can greatly increase the computational efficiency at the cost of a larger -// memory footprint during computation. -// -// Typically a 'greedy' algorithm is applied which empirical tests have shown -// returns the optimal path in the majority of cases. In some cases 'optimal' -// will return the superlative path through a more expensive, exhaustive search. -// For iterative calculations it may be advisable to calculate the optimal path -// once and reuse that path by supplying it as an argument. An example is given -// below. -// -// See :py:func:`numpy.einsum_path` for more details. -// -// Examples -// -------- -// >>> a = np.arange(25).reshape(5,5) -// >>> b = np.arange(5) -// >>> c = np.arange(6).reshape(2,3) -// -// Trace of a matrix: -// -// >>> np.einsum('ii', a) -// 60 -// >>> np.einsum(a, [0,0]) -// 60 -// >>> np.trace(a) -// 60 -// -// Extract the diagonal (requires explicit form): -// -// >>> np.einsum('ii->i', a) -// array([ 0, 6, 12, 18, 24]) -// >>> np.einsum(a, [0,0], [0]) -// array([ 0, 6, 12, 18, 24]) -// >>> np.diag(a) -// array([ 0, 6, 12, 18, 24]) -// -// Sum over an axis (requires explicit form): -// -// >>> np.einsum('ij->i', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [0,1], [0]) -// array([ 10, 35, 60, 85, 110]) -// >>> np.sum(a, axis=1) -// array([ 10, 35, 60, 85, 110]) -// -// For higher dimensional arrays summing a single axis can be done with ellipsis: -// -// >>> np.einsum('...j->...', a) -// array([ 10, 35, 60, 85, 110]) -// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) -// array([ 10, 35, 60, 85, 110]) -// -// Compute a matrix transpose, or reorder any number of axes: -// -// >>> np.einsum('ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum('ij->ji', c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.einsum(c, [1,0]) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// >>> np.transpose(c) -// array([[0, 3], -// [1, 4], -// [2, 5]]) -// -// Vector inner products: -// -// >>> np.einsum('i,i', b, b) -// 30 -// >>> np.einsum(b, [0], b, [0]) -// 30 -// >>> np.inner(b,b) -// 30 -// -// Matrix vector multiplication: -// -// >>> np.einsum('ij,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum(a, [0,1], b, [1]) -// array([ 30, 80, 130, 180, 230]) -// >>> np.dot(a, b) -// array([ 30, 80, 130, 180, 230]) -// >>> np.einsum('...j,j', a, b) -// array([ 30, 80, 130, 180, 230]) -// -// Broadcasting and scalar multiplication: -// -// >>> np.einsum('..., ...', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(',ij', 3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// >>> np.multiply(3, c) -// array([[ 0, 3, 6], -// [ 9, 12, 15]]) -// -// Vector outer product: -// -// >>> np.einsum('i,j', np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.einsum(np.arange(2)+1, [0], b, [1]) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// >>> np.outer(np.arange(2)+1, b) -// array([[0, 1, 2, 3, 4], -// [0, 2, 4, 6, 8]]) -// -// Tensor contraction: -// -// >>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> np.einsum('ijk,jil->kl', a, b) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> np.tensordot(a,b, axes=([1,0],[0,1])) -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// -// Writeable returned arrays (since version 1.10.0): -// -// >>> a = np.zeros((3, 3)) -// >>> np.einsum('ii->i', a)[:] = 1 -// >>> a -// array([[1., 0., 0.], -// [0., 1., 0.], -// [0., 0., 1.]]) -// -// Example of ellipsis use: -// -// >>> a = np.arange(6).reshape((3,2)) -// >>> b = np.arange(12).reshape((4,3)) -// >>> np.einsum('ki,jk->ij', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('ki,...k->i...', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// >>> np.einsum('k...,jk', a, b) -// array([[10, 28, 46, 64], -// [13, 40, 67, 94]]) -// -// Chained array operations. For more complicated contractions, speed ups -// might be achieved by repeatedly computing a 'greedy' path or pre-computing the -// 'optimal' path and repeatedly applying it, using an -// `einsum_path` insertion (since version 1.12.0). Performance improvements can be -// particularly significant with larger arrays: -// -// >>> a = np.ones(64).reshape(2,4,8) -// -// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) -// -// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') -// -// Greedy `einsum` (faster optimal path approximation): ~160ms -// -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') -// -// Optimal `einsum` (best usage pattern in some use cases): ~110ms -// -// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] -// >>> for iteration in range(500): -// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) -// -// -// -//go:linkname Einsum py.einsum -func Einsum(__llgo_va_list ...interface{}) *py.Object -// -// Stack 1-D arrays as columns into a 2-D array. -// -// Take a sequence of 1-D arrays and stack them as columns -// to make a single 2-D array. 2-D arrays are stacked as-is, -// just like with `hstack`. 1-D arrays are turned into 2-D columns -// first. -// -// Parameters -// ---------- -// tup : sequence of 1-D or 2-D arrays. -// Arrays to stack. All of them must have the same first dimension. -// -// Returns -// ------- -// stacked : 2-D array -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// stack, hstack, vstack, concatenate -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((2,3,4)) -// >>> np.column_stack((a,b)) -// array([[1, 2], -// [2, 3], -// [3, 4]]) -// -// -// -//go:linkname ColumnStack py.column_stack -func ColumnStack(tup *py.Object) *py.Object -// -// Load data from a text file, with missing values handled as specified. -// -// Each line past the first `skip_header` lines is split at the `delimiter` -// character, and characters following the `comments` character are discarded. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : dtype, optional -// Data type of the resulting array. -// If None, the dtypes will be determined by the contents of each -// column, individually. -// comments : str, optional -// The character used to indicate the start of a comment. -// All the characters occurring on a line after a comment are discarded. -// delimiter : str, int, or sequence, optional -// The string used to separate values. By default, any consecutive -// whitespaces act as delimiter. An integer or sequence of integers -// can also be provided as width(s) of each field. -// skiprows : int, optional -// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. -// skip_header : int, optional -// The number of lines to skip at the beginning of the file. -// skip_footer : int, optional -// The number of lines to skip at the end of the file. -// converters : variable, optional -// The set of functions that convert the data of a column to a value. -// The converters can also be used to provide a default value -// for missing data: ``converters = {3: lambda s: float(s or 0)}``. -// missing : variable, optional -// `missing` was removed in numpy 1.10. Please use `missing_values` -// instead. -// missing_values : variable, optional -// The set of strings corresponding to missing data. -// filling_values : variable, optional -// The set of values to be used as default when the data are missing. -// usecols : sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. -// names : {None, True, str, sequence}, optional -// If `names` is True, the field names are read from the first line after -// the first `skip_header` lines. This line can optionally be preceded -// by a comment delimiter. If `names` is a sequence or a single-string of -// comma-separated names, the names will be used to define the field names -// in a structured dtype. If `names` is None, the names of the dtype -// fields will be used, if any. -// excludelist : sequence, optional -// A list of names to exclude. This list is appended to the default list -// ['return','file','print']. Excluded names are appended with an -// underscore: for example, `file` would become `file_`. -// deletechars : str, optional -// A string combining invalid characters that must be deleted from the -// names. -// defaultfmt : str, optional -// A format used to define default field names, such as "f%i" or "f_%02i". -// autostrip : bool, optional -// Whether to automatically strip white spaces from the variables. -// replace_space : char, optional -// Character(s) used in replacement of white spaces in the variable -// names. By default, use a '_'. -// case_sensitive : {True, False, 'upper', 'lower'}, optional -// If True, field names are case sensitive. -// If False or 'upper', field names are converted to upper case. -// If 'lower', field names are converted to lower case. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = genfromtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// usemask : bool, optional -// If True, return a masked array. -// If False, return a regular array. -// loose : bool, optional -// If True, do not raise errors for invalid values. -// invalid_raise : bool, optional -// If True, an exception is raised if an inconsistency is detected in the -// number of columns. -// If False, a warning is emitted and the offending lines are skipped. -// max_rows : int, optional -// The maximum number of rows to read. Must not be used with skip_footer -// at the same time. If given, the value must be at least 1. Default is -// to read the entire file. -// -// .. versionadded:: 1.10.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply when `fname` is -// a file object. The special value 'bytes' enables backward compatibility -// workarounds that ensure that you receive byte arrays when possible -// and passes latin1 encoded strings to converters. Override this value to -// receive unicode arrays and pass strings as input to converters. If set -// to None the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// ndmin : int, optional -// Same parameter as `loadtxt` -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. If `usemask` is True, this is a -// masked array. -// -// See Also -// -------- -// numpy.loadtxt : equivalent function when no data is missing. -// -// Notes -// ----- -// * When spaces are used as delimiters, or when no delimiter has been given -// as input, there should not be any missing data between two fields. -// * When the variables are named (either by a flexible dtype or with `names`), -// there must not be any header in the file (else a ValueError -// exception is raised). -// * Individual values are not stripped of spaces by default. -// When using a custom converter, make sure the function does remove spaces. -// -// References -// ---------- -// .. [1] NumPy User Guide, section `I/O with NumPy -// `_. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> import numpy as np -// -// Comma delimited file with mixed dtype -// -// >>> s = StringIO(u"1,1.3,abcde") -// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), -// ... ('mystring','S5')], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only -// >>> data = np.genfromtxt(s, dtype=None, -// ... names = ['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> _ = s.seek(0) -// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", -// ... names=['myint','myfloat','mystring'], delimiter=",") -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('myint', '>> s = StringIO(u"11.3abcde") -// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], -// ... delimiter=[1,3,5]) -// >>> data -// array((1, 1.3, b'abcde'), -// dtype=[('intvar', '>> f = StringIO(''' -// ... text,# of chars -// ... hello world,11 -// ... numpy,5''') -// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') -// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], -// dtype=[('f0', 'S12'), ('f1', 'S12')]) -// -// -// -//go:linkname Genfromtxt py.genfromtxt -func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object -// -// Take elements from an array along an axis. -// -// When axis is not None, this function does the same thing as "fancy" -// indexing (indexing arrays using arrays); however, it can be easier to use -// if you need elements along a given axis. A call such as -// ``np.take(arr, indices, axis=3)`` is equivalent to -// ``arr[:,:,:,indices,...]``. -// -// Explained without fancy indexing, this is equivalent to the following use -// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of -// indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// Nj = indices.shape -// for ii in ndindex(Ni): -// for jj in ndindex(Nj): -// for kk in ndindex(Nk): -// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] -// -// Parameters -// ---------- -// a : array_like (Ni..., M, Nk...) -// The source array. -// indices : array_like (Nj...) -// The indices of the values to extract. -// -// .. versionadded:: 1.8.0 -// -// Also allow scalars for indices. -// axis : int, optional -// The axis over which to select values. By default, the flattened -// input array is used. -// out : ndarray, optional (Ni..., Nj..., Nk...) -// If provided, the result will be placed in this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if `mode='raise'`; use other modes for better performance. -// mode : {'raise', 'wrap', 'clip'}, optional -// Specifies how out-of-bounds indices will behave. -// -// * 'raise' -- raise an error (default) -// * 'wrap' -- wrap around -// * 'clip' -- clip to the range -// -// 'clip' mode means that all indices that are too large are replaced -// by the index that addresses the last element along that axis. Note -// that this disables indexing with negative numbers. -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The returned array has the same type as `a`. -// -// See Also -// -------- -// compress : Take elements using a boolean mask -// ndarray.take : equivalent method -// take_along_axis : Take elements by matching the array and the index arrays -// -// Notes -// ----- -// -// By eliminating the inner loop in the description above, and using `s_` to -// build simple slice objects, `take` can be expressed in terms of applying -// fancy indexing to each 1-d slice:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nj): -// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] -// -// For this reason, it is equivalent to (but faster than) the following use -// of `apply_along_axis`:: -// -// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) -// -// Examples -// -------- -// >>> a = [4, 3, 5, 7, 6, 8] -// >>> indices = [0, 1, 4] -// >>> np.take(a, indices) -// array([4, 3, 6]) -// -// In this example if `a` is an ndarray, "fancy" indexing can be used. -// -// >>> a = np.array(a) -// >>> a[indices] -// array([4, 3, 6]) -// -// If `indices` is not one dimensional, the output also has these dimensions. -// -// >>> np.take(a, [[0, 1], [2, 3]]) -// array([[4, 3], -// [5, 7]]) -// -// -//go:linkname Take py.take -func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object -// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Base-2 logarithm of `x`. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Base-2 logarithm of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// log, log10, log1p, emath.log2 -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Logarithm is a multivalued function: for each `x` there is an infinite -// number of `z` such that `2**z = x`. The convention is to return the `z` -// whose imaginary part lies in `(-pi, pi]`. -// -// For real-valued input data types, `log2` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `log2` is a complex analytical function that -// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` -// handles the floating-point negative zero as an infinitesimal negative -// number, conforming to the C99 standard. -// -// In the cases where the input has a negative real part and a very small -// negative complex part (approaching 0), the result is so close to `-pi` -// that it evaluates to exactly `-pi`. -// -// Examples -// -------- -// >>> x = np.array([0, 1, 2, 2**4]) -// >>> np.log2(x) -// array([-Inf, 0., 1., 4.]) -// -// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) -// >>> np.log2(xi) -// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) -// -//go:linkname Log2 py.log2 -func Log2(x *py.Object, out *py.Object) *py.Object -// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Angle in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding angle in degrees. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : Convert angles from degrees to radians. -// unwrap : Remove large jumps in angle by wrapping. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// rad2deg(x) is ``180 * x / pi``. -// -// Examples -// -------- -// >>> np.rad2deg(np.pi/2) -// 90.0 -// -//go:linkname Rad2deg py.rad2deg -func Rad2deg(x *py.Object, out *py.Object) *py.Object -// -// Display a message on a device. -// -// Parameters -// ---------- -// mesg : str -// Message to display. -// device : object -// Device to write message. If None, defaults to ``sys.stdout`` which is -// very similar to ``print``. `device` needs to have ``write()`` and -// ``flush()`` methods. -// linefeed : bool, optional -// Option whether to print a line feed or not. Defaults to True. -// -// Raises -// ------ -// AttributeError -// If `device` does not have a ``write()`` or ``flush()`` method. -// -// Examples -// -------- -// Besides ``sys.stdout``, a file-like object can also be used as it has -// both required methods: -// -// >>> from io import StringIO -// >>> buf = StringIO() -// >>> np.disp(u'"Display" in a file', device=buf) -// >>> buf.getvalue() -// '"Display" in a file\n' -// -// -// -//go:linkname Disp py.disp -func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object -// -// Load ASCII data stored in a comma-separated file. -// -// The returned array is a record array (if ``usemask=False``, see -// `recarray`) or a masked record array (if ``usemask=True``, -// see `ma.mrecords.MaskedRecords`). -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function to load ASCII data. -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromcsv py.recfromcsv -func Recfromcsv(fname *py.Object) *py.Object -// -// Return the cumulative sum of array elements over a given axis treating Not a -// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are -// encountered and leading NaNs are replaced by zeros. -// -// Zeros are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative sum is computed. The default -// (None) is to compute the cumsum over the flattened array. -// dtype : dtype, optional -// Type of the returned array and of the accumulator in which the -// elements are summed. If `dtype` is not specified, it defaults -// to the dtype of `a`, unless `a` has an integer dtype with a -// precision less than that of the default platform integer. In -// that case, the default platform integer is used. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for -// more details. -// -// Returns -// ------- -// nancumsum : ndarray. -// A new array holding the result is returned unless `out` is -// specified, in which it is returned. The result has the same -// size as `a`, and the same shape as `a` if `axis` is not None -// or `a` is a 1-d array. -// -// See Also -// -------- -// numpy.cumsum : Cumulative sum across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumsum(1) -// array([1]) -// >>> np.nancumsum([1]) -// array([1]) -// >>> np.nancumsum([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumsum(a) -// array([1., 3., 6., 6.]) -// >>> np.nancumsum(a, axis=0) -// array([[1., 2.], -// [4., 2.]]) -// >>> np.nancumsum(a, axis=1) -// array([[1., 3.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumsum py.nancumsum -func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// Return a contiguous flattened array. -// -// A 1-D array, containing the elements of the input, is returned. A copy is -// made only if needed. -// -// As of NumPy 1.10, the returned array will have the same type as the input -// array. (for example, a masked array will be returned for a masked array -// input) -// -// Parameters -// ---------- -// a : array_like -// Input array. The elements in `a` are read in the order specified by -// `order`, and packed as a 1-D array. -// order : {'C','F', 'A', 'K'}, optional -// -// The elements of `a` are read using this index order. 'C' means -// to index the elements in row-major, C-style order, -// with the last axis index changing fastest, back to the first -// axis index changing slowest. 'F' means to index the elements -// in column-major, Fortran-style order, with the -// first index changing fastest, and the last index changing -// slowest. Note that the 'C' and 'F' options take no account of -// the memory layout of the underlying array, and only refer to -// the order of axis indexing. 'A' means to read the elements in -// Fortran-like index order if `a` is Fortran *contiguous* in -// memory, C-like order otherwise. 'K' means to read the -// elements in the order they occur in memory, except for -// reversing the data when strides are negative. By default, 'C' -// index order is used. -// -// Returns -// ------- -// y : array_like -// y is a contiguous 1-D array of the same subtype as `a`, -// with shape ``(a.size,)``. -// Note that matrices are special cased for backward compatibility, -// if `a` is a matrix, then y is a 1-D ndarray. -// -// See Also -// -------- -// ndarray.flat : 1-D iterator over an array. -// ndarray.flatten : 1-D array copy of the elements of an array -// in row-major order. -// ndarray.reshape : Change the shape of an array without changing its data. -// -// Notes -// ----- -// In row-major, C-style order, in two dimensions, the row index -// varies the slowest, and the column index the quickest. This can -// be generalized to multiple dimensions, where row-major order -// implies that the index along the first axis varies slowest, and -// the index along the last quickest. The opposite holds for -// column-major, Fortran-style index ordering. -// -// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` -// may be preferable. However, ``ravel`` supports ``K`` in the optional -// ``order`` argument while ``reshape`` does not. -// -// Examples -// -------- -// It is equivalent to ``reshape(-1, order=order)``. -// -// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.ravel(x) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> x.reshape(-1) -// array([1, 2, 3, 4, 5, 6]) -// -// >>> np.ravel(x, order='F') -// array([1, 4, 2, 5, 3, 6]) -// -// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: -// -// >>> np.ravel(x.T) -// array([1, 4, 2, 5, 3, 6]) -// >>> np.ravel(x.T, order='A') -// array([1, 2, 3, 4, 5, 6]) -// -// When ``order`` is 'K', it will preserve orderings that are neither 'C' -// nor 'F', but won't reverse axes: -// -// >>> a = np.arange(3)[::-1]; a -// array([2, 1, 0]) -// >>> a.ravel(order='C') -// array([2, 1, 0]) -// >>> a.ravel(order='K') -// array([2, 1, 0]) -// -// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a -// array([[[ 0, 2, 4], -// [ 1, 3, 5]], -// [[ 6, 8, 10], -// [ 7, 9, 11]]]) -// >>> a.ravel(order='C') -// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) -// >>> a.ravel(order='K') -// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) -// -// -// -//go:linkname Ravel py.ravel -func Ravel(a *py.Object, order *py.Object) *py.Object -// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 == x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// not_equal, greater_equal, less_equal, greater, less -// -// Examples -// -------- -// >>> np.equal([0, 1, 3], np.arange(3)) -// array([ True, True, False]) -// -// What is compared are values, not types. So an int (1) and an array of -// length one can evaluate as True: -// -// >>> np.equal(1, np.ones(1)) -// array([ True]) -// -// The ``==`` operator can be used as a shorthand for ``np.equal`` on -// ndarrays. -// -// >>> a = np.array([2, 4, 6]) -// >>> b = np.array([2, 4, 2]) -// >>> a == b -// array([ True, True, False]) -// -//go:linkname Equal py.equal -func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 XOR x2, element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical XOR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result of the logical XOR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_or, logical_not, bitwise_xor -// -// Examples -// -------- -// >>> np.logical_xor(True, False) -// True -// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_xor(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// Simple example showing support of broadcasting -// -// >>> np.logical_xor(0, np.eye(2)) -// array([[ True, False], -// [False, True]]) -// -//go:linkname LogicalXor py.logical_xor -func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Remainder py.remainder -func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in positional notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed, or if `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// fractional : boolean, optional -// If `True`, the cutoffs of `precision` and `min_digits` refer to the -// total number of digits after the decimal point, including leading -// zeros. -// If `False`, `precision` and `min_digits` refer to the total number of -// significant digits, before or after the decimal point, ignoring leading -// zeros. -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// pad_right : non-negative integer, optional -// Pad the right side of the string with whitespace until at least that -// many characters are to the right of the decimal point. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. Only has an effect if `unique=True` -// in which case additional digits past those necessary to uniquely -// identify the value may be printed, rounding the last additional digit. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_scientific -// -// Examples -// -------- -// >>> np.format_float_positional(np.float32(np.pi)) -// '3.1415927' -// >>> np.format_float_positional(np.float16(np.pi)) -// '3.14' -// >>> np.format_float_positional(np.float16(0.3)) -// '0.3' -// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) -// '0.3000488281' -// -// -//go:linkname FormatFloatPositional py.format_float_positional -func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object -// -// Return the character for the minimum-size type to which given types can -// be safely cast. -// -// The returned type character must represent the smallest size dtype such -// that an array of the returned type can handle the data from an array of -// all types in `typechars` (or if `typechars` is an array, then its -// dtype.char). -// -// Parameters -// ---------- -// typechars : list of str or array_like -// If a list of strings, each string should represent a dtype. -// If array_like, the character representation of the array dtype is used. -// typeset : str or list of str, optional -// The set of characters that the returned character is chosen from. -// The default set is 'GDFgdf'. -// default : str, optional -// The default character, this is returned if none of the characters in -// `typechars` matches a character in `typeset`. -// -// Returns -// ------- -// typechar : str -// The character representing the minimum-size type that was found. -// -// See Also -// -------- -// dtype, sctype2char, maximum_sctype -// -// Examples -// -------- -// >>> np.mintypecode(['d', 'f', 'S']) -// 'd' -// >>> x = np.array([1.1, 2-3.j]) -// >>> np.mintypecode(x) -// 'D' -// -// >>> np.mintypecode('abceh', default='G') -// 'G' -// -// -// -//go:linkname Mintypecode py.mintypecode -func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object -// -// Test whether each element of a 1-D array is also present in a second array. -// -// Returns a boolean array the same length as `ar1` that is True -// where an element of `ar1` is in `ar2` and False otherwise. -// -// We recommend using :func:`isin` instead of `in1d` for new code. -// -// Parameters -// ---------- -// ar1 : (M,) array_like -// Input array. -// ar2 : array_like -// The values against which to test each value of `ar1`. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted (that is, -// False where an element of `ar1` is in `ar2` and True otherwise). -// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent -// to (but is faster than) ``np.invert(in1d(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// .. versionadded:: 1.8.0 -// -// Returns -// ------- -// in1d : (M,) ndarray, bool -// The values `ar1[in1d]` are in `ar2`. -// -// See Also -// -------- -// isin : Version of this function that preserves the -// shape of ar1. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// `in1d` can be considered as an element-wise function version of the -// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly -// equivalent to ``np.array([item in b for item in a])``. -// However, this idea fails if `ar2` is a set, or similar (non-sequence) -// container: As ``ar2`` is converted to an array, in those cases -// ``asarray(ar2)`` is an object array rather than the expected array of -// contained values. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// >>> test = np.array([0, 1, 2, 5, 0]) -// >>> states = [0, 2] -// >>> mask = np.in1d(test, states) -// >>> mask -// array([ True, False, True, False, True]) -// >>> test[mask] -// array([0, 2, 0]) -// >>> mask = np.in1d(test, states, invert=True) -// >>> mask -// array([False, True, False, True, False]) -// >>> test[mask] -// array([1, 5]) -// -// -//go:linkname In1d py.in1d -func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// packbits(a, /, axis=None, bitorder='big') -// -// Packs the elements of a binary-valued array into bits in a uint8 array. -// -// The result is padded to full bytes by inserting zero bits at the end. -// -// Parameters -// ---------- -// a : array_like -// An array of integers or booleans whose elements should be packed to -// bits. -// axis : int, optional -// The dimension over which bit-packing is done. -// ``None`` implies packing the flattened array. -// bitorder : {'big', 'little'}, optional -// The order of the input bits. 'big' will mimic bin(val), -// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will -// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// packed : ndarray -// Array of type uint8 whose elements represent bits corresponding to the -// logical (0 or nonzero) value of the input elements. The shape of -// `packed` has the same number of dimensions as the input (unless `axis` -// is None, in which case the output is 1-D). -// -// See Also -// -------- -// unpackbits: Unpacks elements of a uint8 array into a binary-valued output -// array. -// -// Examples -// -------- -// >>> a = np.array([[[1,0,1], -// ... [0,1,0]], -// ... [[1,1,0], -// ... [0,0,1]]]) -// >>> b = np.packbits(a, axis=-1) -// >>> b -// array([[[160], -// [ 64]], -// [[192], -// [ 32]]], dtype=uint8) -// -// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, -// and 32 = 0010 0000. -// -// -// -//go:linkname Packbits py.packbits -func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object -// asarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an array. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes lists, lists of tuples, tuples, tuples of tuples, tuples -// of lists and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'K'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array interpretation of `a`. No copy is performed if the input -// is already an ndarray with matching dtype and order. If `a` is a -// subclass of ndarray, a base class ndarray is returned. -// -// See Also -// -------- -// asanyarray : Similar function which passes through subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asarray(a) -// array([1, 2]) -// -// Existing arrays are not copied: -// -// >>> a = np.array([1, 2]) -// >>> np.asarray(a) is a -// True -// -// If `dtype` is set, array is copied only if dtype does not match: -// -// >>> a = np.array([1, 2], dtype=np.float32) -// >>> np.asarray(a, dtype=np.float32) is a -// True -// >>> np.asarray(a, dtype=np.float64) is a -// False -// -// Contrary to `asanyarray`, ndarray subclasses are not passed through: -// -// >>> issubclass(np.recarray, np.ndarray) -// True -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asarray(a) is a -// False -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asarray py.asarray -func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(__llgo_va_list ...interface{}) *py.Object -// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise maximum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// maxima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The maximum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmin : -// Element-wise minimum of two arrays, ignores NaNs. -// maximum : -// Element-wise maximum of two arrays, propagates NaNs. -// amax : -// The maximum value of an array along a given axis, propagates NaNs. -// nanmax : -// The maximum value of an array along a given axis, ignores NaNs. -// -// minimum, amin, nanmin -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmax([2, 3, 4], [1, 5, 2]) -// array([ 2., 5., 4.]) -// -// >>> np.fmax(np.eye(2), [0.5, 2]) -// array([[ 1. , 2. ], -// [ 0.5, 2. ]]) -// -// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmax py.fmax -func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the real part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The real component of the complex argument. If `val` is real, the type -// of `val` is used for the output. If `val` has complex elements, the -// returned type is float. -// -// See Also -// -------- -// real_if_close, imag, angle -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.real -// array([1., 3., 5.]) -// >>> a.real = 9 -// >>> a -// array([9.+2.j, 9.+4.j, 9.+6.j]) -// >>> a.real = np.array([9, 8, 7]) -// >>> a -// array([9.+2.j, 8.+4.j, 7.+6.j]) -// >>> np.real(1 + 1j) -// 1.0 -// -// -// -//go:linkname Real py.real -func Real(val *py.Object) *py.Object -// -// Apply a function repeatedly over multiple axes. -// -// `func` is called as `res = func(a, axis)`, where `axis` is the first -// element of `axes`. The result `res` of the function call must have -// either the same dimensions as `a` or one less dimension. If `res` -// has one less dimension than `a`, a dimension is inserted before -// `axis`. The call to `func` is then repeated for each axis in `axes`, -// with `res` as the first argument. -// -// Parameters -// ---------- -// func : function -// This function must take two arguments, `func(a, axis)`. -// a : array_like -// Input array. -// axes : array_like -// Axes over which `func` is applied; the elements must be integers. -// -// Returns -// ------- -// apply_over_axis : ndarray -// The output array. The number of dimensions is the same as `a`, -// but the shape can be different. This depends on whether `func` -// changes the shape of its output with respect to its input. -// -// See Also -// -------- -// apply_along_axis : -// Apply a function to 1-D slices of an array along the given axis. -// -// Notes -// ----- -// This function is equivalent to tuple axis arguments to reorderable ufuncs -// with keepdims=True. Tuple axis arguments to ufuncs have been available since -// version 1.7.0. -// -// Examples -// -------- -// >>> a = np.arange(24).reshape(2,3,4) -// >>> a -// array([[[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11]], -// [[12, 13, 14, 15], -// [16, 17, 18, 19], -// [20, 21, 22, 23]]]) -// -// Sum over axes 0 and 2. The result has same number of dimensions -// as the original array: -// -// >>> np.apply_over_axes(np.sum, a, [0,2]) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// Tuple axis arguments to ufuncs are equivalent: -// -// >>> np.sum(a, axis=(0,2), keepdims=True) -// array([[[ 60], -// [ 92], -// [124]]]) -// -// -// -//go:linkname ApplyOverAxes py.apply_over_axes -func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object -// -// Check if the array is Fortran contiguous but *not* C contiguous. -// -// This function is obsolete and, because of changes due to relaxed stride -// checking, its return value for the same array may differ for versions -// of NumPy >= 1.10.0 and previous versions. If you only want to check if an -// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// -// Returns -// ------- -// isfortran : bool -// Returns True if the array is Fortran contiguous but *not* C contiguous. -// -// -// Examples -// -------- -// -// np.array allows to specify whether the array is written in C-contiguous -// order (last index varies the fastest), or FORTRAN-contiguous order in -// memory (first index varies the fastest). -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// -// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') -// >>> b -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(b) -// True -// -// -// The transpose of a C-ordered array is a FORTRAN-ordered array. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') -// >>> a -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> np.isfortran(a) -// False -// >>> b = a.T -// >>> b -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// >>> np.isfortran(b) -// True -// -// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. -// -// >>> np.isfortran(np.array([1, 2], order='F')) -// False -// -// -// -//go:linkname Isfortran py.isfortran -func Isfortran(a *py.Object) *py.Object -// -// Compute the outer product of two vectors. -// -// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, -// the outer product [1]_ is:: -// -// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] -// [a_1*b_0 . -// [ ... . -// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] -// -// Parameters -// ---------- -// a : (M,) array_like -// First input vector. Input is flattened if -// not already 1-dimensional. -// b : (N,) array_like -// Second input vector. Input is flattened if -// not already 1-dimensional. -// out : (M, N) ndarray, optional -// A location where the result is stored -// -// .. versionadded:: 1.9.0 -// -// Returns -// ------- -// out : (M, N) ndarray -// ``out[i, j] = a[i] * b[j]`` -// -// See also -// -------- -// inner -// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. -// ufunc.outer : A generalization to dimensions other than 1D and other -// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` -// is the equivalent. -// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` -// is the equivalent. -// -// References -// ---------- -// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd -// ed., Baltimore, MD, Johns Hopkins University Press, 1996, -// pg. 8. -// -// Examples -// -------- -// Make a (*very* coarse) grid for computing a Mandelbrot set: -// -// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) -// >>> rl -// array([[-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.], -// [-2., -1., 0., 1., 2.]]) -// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) -// >>> im -// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], -// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], -// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], -// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], -// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) -// >>> grid = rl + im -// >>> grid -// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], -// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], -// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], -// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], -// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) -// -// An example using a "vector" of letters: -// -// >>> x = np.array(['a', 'b', 'c'], dtype=object) -// >>> np.outer(x, [1, 2, 3]) -// array([['a', 'aa', 'aaa'], -// ['b', 'bb', 'bbb'], -// ['c', 'cc', 'ccc']], dtype=object) -// -// -// -//go:linkname Outer py.outer -func Outer(__llgo_va_list ...interface{}) *py.Object -// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the ceiling of the input, element-wise. -// -// The ceil of the scalar `x` is the smallest integer `i`, such that -// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The ceiling of each element in `x`, with `float` dtype. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// floor, trunc, rint, fix -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.ceil(a) -// array([-1., -1., -0., 1., 2., 2., 2.]) -// -//go:linkname Ceil py.ceil -func Ceil(x *py.Object, out *py.Object) *py.Object -// -// Return the angle of the complex argument. -// -// Parameters -// ---------- -// z : array_like -// A complex number or sequence of complex numbers. -// deg : bool, optional -// Return angle in degrees if True, radians if False (default). -// -// Returns -// ------- -// angle : ndarray or scalar -// The counterclockwise angle from the positive real axis on the complex -// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. -// -// .. versionchanged:: 1.16.0 -// This function works on subclasses of ndarray like `ma.array`. -// -// See Also -// -------- -// arctan2 -// absolute -// -// Notes -// ----- -// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` -// returns the value 0. -// -// Examples -// -------- -// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians -// array([ 0. , 1.57079633, 0.78539816]) # may vary -// >>> np.angle(1+1j, deg=True) # in degrees -// 45.0 -// -// -// -//go:linkname Angle py.angle -func Angle(z *py.Object, deg *py.Object) *py.Object -// -// Load ASCII data from a file and return it in a record array. -// -// If ``usemask=False`` a standard `recarray` is returned, -// if ``usemask=True`` a MaskedRecords array is returned. -// -// Parameters -// ---------- -// fname, kwargs : For a description of input parameters, see `genfromtxt`. -// -// See Also -// -------- -// numpy.genfromtxt : generic function -// -// Notes -// ----- -// By default, `dtype` is None, which means that the data-type of the output -// array will be determined from the data. -// -// -// -//go:linkname Recfromtxt py.recfromtxt -func Recfromtxt(fname *py.Object) *py.Object -// -// Return a new array with the specified shape. -// -// If the new array is larger than the original array, then the new -// array is filled with repeated copies of `a`. Note that this behavior -// is different from a.resize(new_shape) which fills with zeros instead -// of repeated copies of `a`. -// -// Parameters -// ---------- -// a : array_like -// Array to be resized. -// -// new_shape : int or tuple of int -// Shape of resized array. -// -// Returns -// ------- -// reshaped_array : ndarray -// The new array is formed from the data in the old array, repeated -// if necessary to fill out the required number of elements. The -// data are repeated iterating over the array in C-order. -// -// See Also -// -------- -// numpy.reshape : Reshape an array without changing the total size. -// numpy.pad : Enlarge and pad an array. -// numpy.repeat : Repeat elements of an array. -// ndarray.resize : resize an array in-place. -// -// Notes -// ----- -// When the total size of the array does not change `~numpy.reshape` should -// be used. In most other cases either indexing (to reduce the size) -// or padding (to increase the size) may be a more appropriate solution. -// -// Warning: This functionality does **not** consider axes separately, -// i.e. it does not apply interpolation/extrapolation. -// It fills the return array with the required number of elements, iterating -// over `a` in C-order, disregarding axes (and cycling back from the start if -// the new shape is larger). This functionality is therefore not suitable to -// resize images, or data where each axis represents a separate and distinct -// entity. -// -// Examples -// -------- -// >>> a=np.array([[0,1],[2,3]]) -// >>> np.resize(a,(2,3)) -// array([[0, 1, 2], -// [3, 0, 1]]) -// >>> np.resize(a,(1,4)) -// array([[0, 1, 2, 3]]) -// >>> np.resize(a,(2,4)) -// array([[0, 1, 2, 3], -// [0, 1, 2, 3]]) -// -// -// -//go:linkname Resize py.resize -func Resize(a *py.Object, newShape *py.Object) *py.Object -// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaT (not a time) and return result as a boolean array. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like -// Input array with datetime or timedelta data type. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaT, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isnan, isinf, isneginf, isposinf, isfinite -// -// Examples -// -------- -// >>> np.isnat(np.datetime64("NaT")) -// True -// >>> np.isnat(np.datetime64("2016-01-01")) -// False -// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) -// array([ True, False]) -// -//go:linkname Isnat py.isnat -func Isnat(x *py.Object, out *py.Object) *py.Object -// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of x1 OR x2 element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Logical OR is applied to the elements of `x1` and `x2`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// Boolean result of the logical OR operation applied to the elements -// of `x1` and `x2`; the shape is determined by broadcasting. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and, logical_not, logical_xor -// bitwise_or -// -// Examples -// -------- -// >>> np.logical_or(True, False) -// True -// >>> np.logical_or([True, False], [False, False]) -// array([ True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_or(x < 1, x > 3) -// array([ True, False, False, False, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on -// boolean ndarrays. -// -// >>> a = np.array([True, False]) -// >>> b = np.array([False, False]) -// >>> a | b -// array([ True, False]) -// -//go:linkname LogicalOr py.logical_or -func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Trigonometric sine, element-wise. -// -// Parameters -// ---------- -// x : array_like -// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : array_like -// The sine of each element of x. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// arcsin, sinh, cos -// -// Notes -// ----- -// The sine is one of the fundamental functions of trigonometry (the -// mathematical study of triangles). Consider a circle of radius 1 -// centered on the origin. A ray comes in from the :math:`+x` axis, makes -// an angle at the origin (measured counter-clockwise from that axis), and -// departs from the origin. The :math:`y` coordinate of the outgoing -// ray's intersection with the unit circle is the sine of that angle. It -// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The -// function has zeroes where the angle is a multiple of :math:`\pi`. -// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. -// The numerous properties of the sine and related functions are included -// in any standard trigonometry text. -// -// Examples -// -------- -// Print sine of one angle: -// -// >>> np.sin(np.pi/2.) -// 1.0 -// -// Print sines of an array of angles given in degrees: -// -// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) -// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) -// -// Plot the sine function: -// -// >>> import matplotlib.pylab as plt -// >>> x = np.linspace(-np.pi, np.pi, 201) -// >>> plt.plot(x, np.sin(x)) -// >>> plt.xlabel('Angle [rad]') -// >>> plt.ylabel('sin(x)') -// >>> plt.axis('tight') -// >>> plt.show() -// -//go:linkname Sin py.sin -func Sin(x *py.Object, out *py.Object) *py.Object -// -// Return the indices of the bins to which each value in input array belongs. -// -// ========= ============= ============================ -// `right` order of bins returned index `i` satisfies -// ========= ============= ============================ -// ``False`` increasing ``bins[i-1] <= x < bins[i]`` -// ``True`` increasing ``bins[i-1] < x <= bins[i]`` -// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` -// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` -// ========= ============= ============================ -// -// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is -// returned as appropriate. -// -// Parameters -// ---------- -// x : array_like -// Input array to be binned. Prior to NumPy 1.10.0, this array had to -// be 1-dimensional, but can now have any shape. -// bins : array_like -// Array of bins. It has to be 1-dimensional and monotonic. -// right : bool, optional -// Indicating whether the intervals include the right or the left bin -// edge. Default behavior is (right==False) indicating that the interval -// does not include the right edge. The left bin end is open in this -// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for -// monotonically increasing bins. -// -// Returns -// ------- -// indices : ndarray of ints -// Output array of indices, of same shape as `x`. -// -// Raises -// ------ -// ValueError -// If `bins` is not monotonic. -// TypeError -// If the type of the input is complex. -// -// See Also -// -------- -// bincount, histogram, unique, searchsorted -// -// Notes -// ----- -// If values in `x` are such that they fall outside the bin range, -// attempting to index `bins` with the indices that `digitize` returns -// will result in an IndexError. -// -// .. versionadded:: 1.10.0 -// -// `np.digitize` is implemented in terms of `np.searchsorted`. This means -// that a binary search is used to bin the values, which scales much better -// for larger number of bins than the previous linear search. It also removes -// the requirement for the input array to be 1-dimensional. -// -// For monotonically _increasing_ `bins`, the following are equivalent:: -// -// np.digitize(x, bins, right=True) -// np.searchsorted(bins, x, side='left') -// -// Note that as the order of the arguments are reversed, the side must be too. -// The `searchsorted` call is marginally faster, as it does not do any -// monotonicity checks. Perhaps more importantly, it supports all dtypes. -// -// Examples -// -------- -// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) -// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) -// >>> inds = np.digitize(x, bins) -// >>> inds -// array([1, 4, 3, 2]) -// >>> for n in range(x.size): -// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) -// ... -// 0.0 <= 0.2 < 1.0 -// 4.0 <= 6.4 < 10.0 -// 2.5 <= 3.0 < 4.0 -// 1.0 <= 1.6 < 2.5 -// -// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) -// >>> bins = np.array([0, 5, 10, 15, 20]) -// >>> np.digitize(x,bins,right=True) -// array([1, 2, 3, 4, 4]) -// >>> np.digitize(x,bins,right=False) -// array([1, 3, 3, 4, 5]) -// -// -//go:linkname Digitize py.digitize -func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object -// -// Construct an array by repeating A the number of times given by reps. -// -// If `reps` has length ``d``, the result will have dimension of -// ``max(d, A.ndim)``. -// -// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new -// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, -// or shape (1, 1, 3) for 3-D replication. If this is not the desired -// behavior, promote `A` to d-dimensions manually before calling this -// function. -// -// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. -// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as -// (1, 1, 2, 2). -// -// Note : Although tile may be used for broadcasting, it is strongly -// recommended to use numpy's broadcasting operations and functions. -// -// Parameters -// ---------- -// A : array_like -// The input array. -// reps : array_like -// The number of repetitions of `A` along each axis. -// -// Returns -// ------- -// c : ndarray -// The tiled output array. -// -// See Also -// -------- -// repeat : Repeat elements of an array. -// broadcast_to : Broadcast an array to a new shape -// -// Examples -// -------- -// >>> a = np.array([0, 1, 2]) -// >>> np.tile(a, 2) -// array([0, 1, 2, 0, 1, 2]) -// >>> np.tile(a, (2, 2)) -// array([[0, 1, 2, 0, 1, 2], -// [0, 1, 2, 0, 1, 2]]) -// >>> np.tile(a, (2, 1, 2)) -// array([[[0, 1, 2, 0, 1, 2]], -// [[0, 1, 2, 0, 1, 2]]]) -// -// >>> b = np.array([[1, 2], [3, 4]]) -// >>> np.tile(b, 2) -// array([[1, 2, 1, 2], -// [3, 4, 3, 4]]) -// >>> np.tile(b, (2, 1)) -// array([[1, 2], -// [3, 4], -// [1, 2], -// [3, 4]]) -// -// >>> c = np.array([1,2,3,4]) -// >>> np.tile(c,(4,1)) -// array([[1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4], -// [1, 2, 3, 4]]) -// -// -//go:linkname Tile py.tile -func Tile(A *py.Object, reps *py.Object) *py.Object -// -// Returns pointers to the end-points of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. It must conform to the Python-side of the array -// interface. -// -// Returns -// ------- -// (low, high) : tuple of 2 integers -// The first integer is the first byte of the array, the second -// integer is just past the last byte of the array. If `a` is not -// contiguous it will not use every byte between the (`low`, `high`) -// values. -// -// Examples -// -------- -// >>> I = np.eye(2, dtype='f'); I.dtype -// dtype('float32') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// >>> I = np.eye(2); I.dtype -// dtype('float64') -// >>> low, high = np.byte_bounds(I) -// >>> high - low == I.size*I.itemsize -// True -// -// -// -//go:linkname ByteBounds py.byte_bounds -func ByteBounds(a *py.Object) *py.Object -// -// Return a partitioned copy of an array. -// -// Creates a copy of the array with its elements rearranged in such a -// way that the value of the element in k-th position is in the position -// the value would be in a sorted array. In the partitioned array, all -// elements before the k-th element are less than or equal to that -// element, and all the elements after the k-th element are greater than -// or equal to that element. The ordering of the elements in the two -// partitions is undefined. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// kth : int or sequence of ints -// Element index to partition by. The k-th value of the element -// will be in its final sorted position and all smaller elements -// will be moved before it and all equal or greater elements behind -// it. The order of all elements in the partitions is undefined. If -// provided with a sequence of k-th it will partition all elements -// indexed by k-th of them into their sorted position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect'. -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string. Not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// partitioned_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.partition : Method to sort an array in-place. -// argpartition : Indirect partition. -// sort : Full sorting -// -// Notes -// ----- -// The various selection algorithms are characterized by their average -// speed, worst case performance, work space size, and whether they are -// stable. A stable sort keeps items with the same key in the same -// relative order. The available algorithms have the following -// properties: -// -// ================= ======= ============= ============ ======= -// kind speed worst case work space stable -// ================= ======= ============= ============ ======= -// 'introselect' 1 O(n) 0 no -// ================= ======= ============= ============ ======= -// -// All the partition algorithms make temporary copies of the data when -// partitioning along any but the last axis. Consequently, -// partitioning along the last axis is faster and uses less space than -// partitioning along any other axis. -// -// The sort order for complex numbers is lexicographic. If both the -// real and imaginary parts are non-nan then the order is determined by -// the real parts except when they are equal, in which case the order -// is determined by the imaginary parts. -// -// Examples -// -------- -// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) -// >>> p = np.partition(a, 4) -// >>> p -// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) -// -// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal -// to ``p[4]``, and all elements in ``p[5:]`` are greater than or -// equal to ``p[4]``. The partition is:: -// -// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] -// -// The next example shows the use of multiple values passed to `kth`. -// -// >>> p2 = np.partition(a, (4, 8)) -// >>> p2 -// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) -// -// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` -// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` -// are greater than or equal to ``p2[4]`` and less than or equal to -// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or -// equal to ``p2[8]``. The partition is:: -// -// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] -// -// -//go:linkname Partition py.partition -func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the complex conjugate, element-wise. -// -// The complex conjugate of a complex number is obtained by changing the -// sign of its imaginary part. -// -// Parameters -// ---------- -// x : array_like -// Input value. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The complex conjugate of `x`, with same dtype as `y`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// `conj` is an alias for `conjugate`: -// -// >>> np.conj is np.conjugate -// True -// -// Examples -// -------- -// >>> np.conjugate(1+2j) -// (1-2j) -// -// >>> x = np.eye(2) + 1j * np.eye(2) -// >>> np.conjugate(x) -// array([[ 1.-1.j, 0.-0.j], -// [ 0.-0.j, 1.-1.j]]) -// -//go:linkname Conj py.conj -func Conj(__llgo_va_list ...interface{}) *py.Object -// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the exponential of all elements in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise exponential of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. -// exp2 : Calculate ``2**x`` for all elements in the array. -// -// Notes -// ----- -// The irrational number ``e`` is also known as Euler's number. It is -// approximately 2.718281, and is the base of the natural logarithm, -// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, -// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. -// -// For complex arguments, ``x = a + ib``, we can write -// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already -// known (it is the real argument, described above). The second term, -// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with -// magnitude 1 and a periodic phase. -// -// References -// ---------- -// .. [1] Wikipedia, "Exponential function", -// https://en.wikipedia.org/wiki/Exponential_function -// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions -// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, -// https://personal.math.ubc.ca/~cbm/aands/page_69.htm -// -// Examples -// -------- -// Plot the magnitude and phase of ``exp(x)`` in the complex plane: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) -// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane -// >>> out = np.exp(xx) -// -// >>> plt.subplot(121) -// >>> plt.imshow(np.abs(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') -// >>> plt.title('Magnitude of exp(x)') -// -// >>> plt.subplot(122) -// >>> plt.imshow(np.angle(out), -// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') -// >>> plt.title('Phase (angle) of exp(x)') -// >>> plt.show() -// -//go:linkname Exp py.exp -func Exp(x *py.Object, out *py.Object) *py.Object -// frompyfunc(func, /, nin, nout, *[, identity]) -// -// Takes an arbitrary Python function and returns a NumPy ufunc. -// -// Can be used, for example, to add broadcasting to a built-in Python -// function (see Examples section). -// -// Parameters -// ---------- -// func : Python function object -// An arbitrary Python function. -// nin : int -// The number of input arguments. -// nout : int -// The number of objects returned by `func`. -// identity : object, optional -// The value to use for the `~numpy.ufunc.identity` attribute of the resulting -// object. If specified, this is equivalent to setting the underlying -// C ``identity`` field to ``PyUFunc_IdentityValue``. -// If omitted, the identity is set to ``PyUFunc_None``. Note that this is -// _not_ equivalent to setting the identity to ``None``, which implies the -// operation is reorderable. -// -// Returns -// ------- -// out : ufunc -// Returns a NumPy universal function (``ufunc``) object. -// -// See Also -// -------- -// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. -// -// Notes -// ----- -// The returned ufunc always returns PyObject arrays. -// -// Examples -// -------- -// Use frompyfunc to add broadcasting to the Python function ``oct``: -// -// >>> oct_array = np.frompyfunc(oct, 1, 1) -// >>> oct_array(np.array((10, 30, 100))) -// array(['0o12', '0o36', '0o144'], dtype=object) -// >>> np.array((oct(10), oct(30), oct(100))) # for comparison -// array(['0o12', '0o36', '0o144'], dtype='`. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// greater, less_equal, greater_equal, equal, not_equal -// -// Examples -// -------- -// >>> np.less([1, 2], [2, 2]) -// array([ True, False]) -// -// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. -// -// >>> a = np.array([1, 2]) -// >>> b = np.array([2, 2]) -// >>> a < b -// array([ True, False]) -// -//go:linkname Less py.less -func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute tangent element-wise. -// -// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding tangent values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972. -// -// Examples -// -------- -// >>> from math import pi -// >>> np.tan(np.array([-pi,pi/2,pi])) -// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) -// >>> -// >>> # Example of providing the optional output parameter illustrating -// >>> # that what is returned is a reference to said parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.cos([0.1], out1) -// >>> out2 is out1 -// True -// >>> -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Tan py.tan -func Tan(x *py.Object, out *py.Object) *py.Object -// -// Evaluate a piecewise-defined function. -// -// Given a set of conditions and corresponding functions, evaluate each -// function on the input data wherever its condition is true. -// -// Parameters -// ---------- -// x : ndarray or scalar -// The input domain. -// condlist : list of bool arrays or bool scalars -// Each boolean array corresponds to a function in `funclist`. Wherever -// `condlist[i]` is True, `funclist[i](x)` is used as the output value. -// -// Each boolean array in `condlist` selects a piece of `x`, -// and should therefore be of the same shape as `x`. -// -// The length of `condlist` must correspond to that of `funclist`. -// If one extra function is given, i.e. if -// ``len(funclist) == len(condlist) + 1``, then that extra function -// is the default value, used wherever all conditions are false. -// funclist : list of callables, f(x,*args,**kw), or scalars -// Each function is evaluated over `x` wherever its corresponding -// condition is True. It should take a 1d array as input and give an 1d -// array or a scalar value as output. If, instead of a callable, -// a scalar is provided then a constant function (``lambda x: scalar``) is -// assumed. -// args : tuple, optional -// Any further arguments given to `piecewise` are passed to the functions -// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then -// each function is called as ``f(x, 1, 'a')``. -// kw : dict, optional -// Keyword arguments used in calling `piecewise` are passed to the -// functions upon execution, i.e., if called -// ``piecewise(..., ..., alpha=1)``, then each function is called as -// ``f(x, alpha=1)``. -// -// Returns -// ------- -// out : ndarray -// The output is the same shape and type as x and is found by -// calling the functions in `funclist` on the appropriate portions of `x`, -// as defined by the boolean arrays in `condlist`. Portions not covered -// by any condition have a default value of 0. -// -// -// See Also -// -------- -// choose, select, where -// -// Notes -// ----- -// This is similar to choose or select, except that functions are -// evaluated on elements of `x` that satisfy the corresponding condition from -// `condlist`. -// -// The result is:: -// -// |-- -// |funclist[0](x[condlist[0]]) -// out = |funclist[1](x[condlist[1]]) -// |... -// |funclist[n2](x[condlist[n2]]) -// |-- -// -// Examples -// -------- -// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. -// -// >>> x = np.linspace(-2.5, 2.5, 6) -// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) -// array([-1., -1., -1., 1., 1., 1.]) -// -// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for -// ``x >= 0``. -// -// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) -// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) -// -// Apply the same function to a scalar value. -// -// >>> y = -2 -// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) -// array(2) -// -// -// -//go:linkname Piecewise py.piecewise -func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object -// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) -// -// Construct an array from data in a text or binary file. -// -// A highly efficient way of reading binary data with a known data-type, -// as well as parsing simply formatted text files. Data written using the -// `tofile` method can be read using this function. -// -// Parameters -// ---------- -// file : file or str or Path -// Open file object or filename. -// -// .. versionchanged:: 1.17.0 -// `pathlib.Path` objects are now accepted. -// -// dtype : data-type -// Data type of the returned array. -// For binary files, it is used to determine the size and byte-order -// of the items in the file. -// Most builtin numeric types are supported and extension types may be supported. -// -// .. versionadded:: 1.18.0 -// Complex dtypes. -// -// count : int -// Number of items to read. ``-1`` means all items (i.e., the complete -// file). -// sep : str -// Separator between items if file is a text file. -// Empty ("") separator means the file should be treated as binary. -// Spaces (" ") in the separator match zero or more whitespace characters. -// A separator consisting only of spaces must match at least one -// whitespace. -// offset : int -// The offset (in bytes) from the file's current position. Defaults to 0. -// Only permitted for binary files. -// -// .. versionadded:: 1.17.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// See also -// -------- -// load, save -// ndarray.tofile -// loadtxt : More flexible way of loading data from a text file. -// -// Notes -// ----- -// Do not rely on the combination of `tofile` and `fromfile` for -// data storage, as the binary files generated are not platform -// independent. In particular, no byte-order or data-type information is -// saved. Data can be stored in the platform independent ``.npy`` format -// using `save` and `load` instead. -// -// Examples -// -------- -// Construct an ndarray: -// -// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), -// ... ('temp', float)]) -// >>> x = np.zeros((1,), dtype=dt) -// >>> x['time']['min'] = 10; x['temp'] = 98.25 -// >>> x -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> import tempfile -// >>> fname = tempfile.mkstemp()[1] -// >>> x.tofile(fname) -// -// Read the raw data from disk: -// -// >>> np.fromfile(fname, dtype=dt) -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> np.save(fname, x) -// >>> np.load(fname + '.npy') -// array([((10, 0), 98.25)], -// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) -// >>> b = np.arange(24.).reshape(4,3,2) -// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) -// >>> c.shape -// (5, 2) -// >>> c -// array([[4400., 4730.], -// [4532., 4874.], -// [4664., 5018.], -// [4796., 5162.], -// [4928., 5306.]]) -// >>> # A slower but equivalent way of computing the same... -// >>> d = np.zeros((5,2)) -// >>> for i in range(5): -// ... for j in range(2): -// ... for k in range(3): -// ... for n in range(4): -// ... d[i,j] += a[k,n,i] * b[n,k,j] -// >>> c == d -// array([[ True, True], -// [ True, True], -// [ True, True], -// [ True, True], -// [ True, True]]) -// -// An extended example taking advantage of the overloading of + and \*: -// -// >>> a = np.array(range(1, 9)) -// >>> a.shape = (2, 2, 2) -// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) -// >>> A.shape = (2, 2) -// >>> a; A -// array([[[1, 2], -// [3, 4]], -// [[5, 6], -// [7, 8]]]) -// array([['a', 'b'], -// ['c', 'd']], dtype=object) -// -// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction -// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, 1) -// array([[['acc', 'bdd'], -// ['aaacccc', 'bbbdddd']], -// [['aaaaacccccc', 'bbbbbdddddd'], -// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) -// array([[[[['a', 'b'], -// ['c', 'd']], -// ... -// -// >>> np.tensordot(a, A, (0, 1)) -// array([[['abbbbb', 'cddddd'], -// ['aabbbbbb', 'ccdddddd']], -// [['aaabbbbbbb', 'cccddddddd'], -// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, (2, 1)) -// array([[['abb', 'cdd'], -// ['aaabbbb', 'cccdddd']], -// [['aaaaabbbbbb', 'cccccdddddd'], -// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) -// -// >>> np.tensordot(a, A, ((0, 1), (0, 1))) -// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) -// -// >>> np.tensordot(a, A, ((2, 1), (1, 0))) -// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) -// -// -// -//go:linkname Tensordot py.tensordot -func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object -// -// Perform an indirect partition along the given axis using the -// algorithm specified by the `kind` keyword. It returns an array of -// indices of the same shape as `a` that index data along the given -// axis in partitioned order. -// -// .. versionadded:: 1.8.0 -// -// Parameters -// ---------- -// a : array_like -// Array to sort. -// kth : int or sequence of ints -// Element index to partition by. The k-th element will be in its -// final sorted position and all smaller elements will be moved -// before it and all larger elements behind it. The order of all -// elements in the partitions is undefined. If provided with a -// sequence of k-th it will partition all of them into their sorted -// position at once. -// -// .. deprecated:: 1.22.0 -// Passing booleans as index is deprecated. -// axis : int or None, optional -// Axis along which to sort. The default is -1 (the last axis). If -// None, the flattened array is used. -// kind : {'introselect'}, optional -// Selection algorithm. Default is 'introselect' -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument -// specifies which fields to compare first, second, etc. A single -// field can be specified as a string, and not all fields need be -// specified, but unspecified fields will still be used, in the -// order in which they come up in the dtype, to break ties. -// -// Returns -// ------- -// index_array : ndarray, int -// Array of indices that partition `a` along the specified axis. -// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. -// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` -// always yields the partitioned `a`, irrespective of dimensionality. -// -// See Also -// -------- -// partition : Describes partition algorithms used. -// ndarray.partition : Inplace partition. -// argsort : Full indirect sort. -// take_along_axis : Apply ``index_array`` from argpartition -// to an array as if by calling partition. -// -// Notes -// ----- -// See `partition` for notes on the different selection algorithms. -// -// Examples -// -------- -// One dimensional array: -// -// >>> x = np.array([3, 4, 2, 1]) -// >>> x[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// >>> x[np.argpartition(x, (1, 3))] -// array([1, 2, 3, 4]) -// -// >>> x = [3, 4, 2, 1] -// >>> np.array(x)[np.argpartition(x, 3)] -// array([2, 1, 3, 4]) -// -// Multi-dimensional array: -// -// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) -// >>> index_array = np.argpartition(x, kth=1, axis=-1) -// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) -// array([[2, 3, 4], -// [1, 1, 3]]) -// -// -// -//go:linkname Argpartition py.argpartition -func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object -// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the largest integer smaller or equal to the division of the inputs. -// It is equivalent to the Python ``//`` operator and pairs with the -// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` -// up to roundoff. -// -// Parameters -// ---------- -// x1 : array_like -// Numerator. -// x2 : array_like -// Denominator. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// y = floor(`x1`/`x2`) -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// remainder : Remainder complementary to floor_divide. -// divmod : Simultaneous floor division and remainder. -// divide : Standard division. -// floor : Round a number to the nearest integer toward minus infinity. -// ceil : Round a number to the nearest integer toward infinity. -// -// Examples -// -------- -// >>> np.floor_divide(7,3) -// 2 -// >>> np.floor_divide([1., 2., 3., 4.], 2.5) -// array([ 0., 0., 1., 1.]) -// -// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` -// on ndarrays. -// -// >>> x1 = np.array([1., 2., 3., 4.]) -// >>> x1 // 2.5 -// array([0., 0., 1., 1.]) -// -//go:linkname FloorDivide py.floor_divide -func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for NaN and return result as a boolean array. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or bool -// True where ``x`` is NaN, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isinf, isneginf, isposinf, isfinite, isnat -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). This means that Not a Number is not equivalent to infinity. -// -// Examples -// -------- -// >>> np.isnan(np.nan) -// True -// >>> np.isnan(np.inf) -// False -// >>> np.isnan([np.log(-1.),1.,np.log(0)]) -// array([ True, False, False]) -// -//go:linkname Isnan py.isnan -func Isnan(x *py.Object, out *py.Object) *py.Object -// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Logarithm of the sum of exponentiations of the inputs. -// -// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in -// statistics where the calculated probabilities of events may be so small -// as to exceed the range of normal floating point numbers. In such cases -// the logarithm of the calculated probability is stored. This function -// allows adding probabilities stored in such a fashion. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray -// Logarithm of ``exp(x1) + exp(x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> prob1 = np.log(1e-50) -// >>> prob2 = np.log(2.5e-50) -// >>> prob12 = np.logaddexp(prob1, prob2) -// >>> prob12 -// -113.87649168120691 -// >>> np.exp(prob12) -// 3.5000000000000057e-50 -// -//go:linkname Logaddexp py.logaddexp -func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// add_docstring(obj, docstring) -// -// Add a docstring to a built-in obj if possible. -// If the obj already has a docstring raise a RuntimeError -// If this routine does not know how to add a docstring to the object -// raise a TypeError -// -//go:linkname AddDocstring py.add_docstring -func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname RowStack py.row_stack -func RowStack(tup *py.Object) *py.Object -// from_dlpack(x, /) -// -// Create a NumPy array from an object implementing the ``__dlpack__`` -// protocol. Generally, the returned NumPy array is a read-only view -// of the input object. See [1]_ and [2]_ for more details. -// -// Parameters -// ---------- -// x : object -// A Python object that implements the ``__dlpack__`` and -// ``__dlpack_device__`` methods. -// -// Returns -// ------- -// out : ndarray -// -// References -// ---------- -// .. [1] Array API documentation, -// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack -// -// .. [2] Python specification for DLPack, -// https://dmlc.github.io/dlpack/latest/python_spec.html -// -// Examples -// -------- -// >>> import torch -// >>> x = torch.arange(10) -// >>> # create a view of the torch tensor "x" in NumPy -// >>> y = np.from_dlpack(x) -// -//go:linkname FromDlpack py.from_dlpack -func FromDlpack(x *py.Object) *py.Object -// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from radians to degrees. -// -// Parameters -// ---------- -// x : array_like -// Input array in radians. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray of floats -// The corresponding degree values; if `out` was supplied this is a -// reference to it. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// rad2deg : equivalent function -// -// Examples -// -------- -// Convert a radian array to degrees -// -// >>> rad = np.arange(12.)*np.pi/6 -// >>> np.degrees(rad) -// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., -// 270., 300., 330.]) -// -// >>> out = np.zeros((rad.shape)) -// >>> r = np.degrees(rad, out) -// >>> np.all(r == out) -// True -// -//go:linkname Degrees py.degrees -func Degrees(x *py.Object, out *py.Object) *py.Object -// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns an element-wise indication of the sign of a number. -// -// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan -// is returned for nan inputs. -// -// For complex inputs, the `sign` function returns -// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. -// -// complex(nan, 0) is returned for complex nan inputs. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The sign of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// There is more than one definition of sign in common use for complex -// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` -// which is different from a common alternative, :math:`x/|x|`. -// -// Examples -// -------- -// >>> np.sign([-5., 4.5]) -// array([-1., 1.]) -// >>> np.sign(0) -// 0 -// >>> np.sign(5-2j) -// (1+0j) -// -//go:linkname Sign py.sign -func Sign(x *py.Object, out *py.Object) *py.Object -// -// Get the current way of handling floating-point errors. -// -// Returns -// ------- -// res : dict -// A dictionary with keys "divide", "over", "under", and "invalid", -// whose values are from the strings "ignore", "print", "log", "warn", -// "raise", and "call". The keys represent possible floating-point -// exceptions, and the values define how these exceptions are handled. -// -// See Also -// -------- -// geterrcall, seterr, seterrcall -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterr() -// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// >>> oldsettings = np.seterr(all='warn', over='raise') -// >>> np.geterr() -// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} -// >>> np.arange(3.) / np.arange(3.) -// array([nan, 1., 1.]) -// -// -// -//go:linkname Geterr py.geterr -func Geterr() *py.Object -// -// Append values to the end of an array. -// -// Parameters -// ---------- -// arr : array_like -// Values are appended to a copy of this array. -// values : array_like -// These values are appended to a copy of `arr`. It must be of the -// correct shape (the same shape as `arr`, excluding `axis`). If -// `axis` is not specified, `values` can be any shape and will be -// flattened before use. -// axis : int, optional -// The axis along which `values` are appended. If `axis` is not -// given, both `arr` and `values` are flattened before use. -// -// Returns -// ------- -// append : ndarray -// A copy of `arr` with `values` appended to `axis`. Note that -// `append` does not occur in-place: a new array is allocated and -// filled. If `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// insert : Insert elements into an array. -// delete : Delete elements from an array. -// -// Examples -// -------- -// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) -// array([1, 2, 3, ..., 7, 8, 9]) -// -// When `axis` is specified, `values` must have the correct shape. -// -// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) -// array([[1, 2, 3], -// [4, 5, 6], -// [7, 8, 9]]) -// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) -// Traceback (most recent call last): -// ... -// ValueError: all the input arrays must have same number of dimensions, but -// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 -// dimension(s) -// -// -// -//go:linkname Append py.append -func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// Return the directory that contains the NumPy \*.h header files. -// -// Extension modules that need to compile against NumPy should use this -// function to locate the appropriate include directory. -// -// Notes -// ----- -// When using ``distutils``, for example in ``setup.py``:: -// -// import numpy as np -// ... -// Extension('extension_name', ... -// include_dirs=[np.get_include()]) -// ... -// -// -// -//go:linkname GetInclude py.get_include -func GetInclude() *py.Object -// Save several arrays into a single file in uncompressed ``.npz`` format. -// -// Provide arrays as keyword arguments to store them under the -// corresponding name in the output file: ``savez(fn, x=x, y=y)``. -// -// If arrays are specified as positional arguments, i.e., ``savez(fn, -// x, y)``, their names will be `arr_0`, `arr_1`, etc. -// -// Parameters -// ---------- -// file : str or file -// Either the filename (string) or an open file (file-like object) -// where the data will be saved. If file is a string or a Path, the -// ``.npz`` extension will be appended to the filename if it is not -// already there. -// args : Arguments, optional -// Arrays to save to the file. Please use keyword arguments (see -// `kwds` below) to assign names to arrays. Arrays specified as -// args will be named "arr_0", "arr_1", and so on. -// kwds : Keyword arguments, optional -// Arrays to save to the file. Each array will be saved to the -// output file with its corresponding keyword name. -// -// Returns -// ------- -// None -// -// See Also -// -------- -// save : Save a single array to a binary file in NumPy format. -// savetxt : Save an array to a file as plain text. -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// The ``.npz`` file format is a zipped archive of files named after the -// variables they contain. The archive is not compressed and each file -// in the archive contains one variable in ``.npy`` format. For a -// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. -// -// When opening the saved ``.npz`` file with `load` a `NpzFile` object is -// returned. This is a dictionary-like object which can be queried for -// its list of arrays (with the ``.files`` attribute), and for the arrays -// themselves. -// -// Keys passed in `kwds` are used as filenames inside the ZIP archive. -// Therefore, keys should be valid filenames; e.g., avoid keys that begin with -// ``/`` or contain ``.``. -// -// When naming variables with keyword arguments, it is not possible to name a -// variable ``file``, as this would cause the ``file`` argument to be defined -// twice in the call to ``savez``. -// -// Examples -// -------- -// >>> from tempfile import TemporaryFile -// >>> outfile = TemporaryFile() -// >>> x = np.arange(10) -// >>> y = np.sin(x) -// -// Using `savez` with \*args, the arrays are saved with default names. -// -// >>> np.savez(outfile, x, y) -// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file -// >>> npzfile = np.load(outfile) -// >>> npzfile.files -// ['arr_0', 'arr_1'] -// >>> npzfile['arr_0'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// Using `savez` with \**kwds, the arrays are saved with the keyword names. -// -// >>> outfile = TemporaryFile() -// >>> np.savez(outfile, x=x, y=y) -// >>> _ = outfile.seek(0) -// >>> npzfile = np.load(outfile) -// >>> sorted(npzfile.files) -// ['x', 'y'] -// >>> npzfile['x'] -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// -// -//go:linkname Savez py.savez -func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Construct an array from a text file, using regular expression parsing. -// -// The returned array is always a structured array, and is constructed from -// all matches of the regular expression in the file. Groups in the regular -// expression are converted to fields of the structured array. -// -// Parameters -// ---------- -// file : path or file -// Filename or file object to read. -// -// .. versionchanged:: 1.22.0 -// Now accepts `os.PathLike` implementations. -// regexp : str or regexp -// Regular expression used to parse the file. -// Groups in the regular expression correspond to fields in the dtype. -// dtype : dtype or list of dtypes -// Dtype for the structured array; must be a structured datatype. -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// output : ndarray -// The output array, containing the part of the content of `file` that -// was matched by `regexp`. `output` is always a structured array. -// -// Raises -// ------ -// TypeError -// When `dtype` is not a valid dtype for a structured array. -// -// See Also -// -------- -// fromstring, loadtxt -// -// Notes -// ----- -// Dtypes for structured arrays can be specified in several forms, but all -// forms specify at least the data type and field name. For details see -// `basics.rec`. -// -// Examples -// -------- -// >>> from io import StringIO -// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") -// -// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] -// >>> output = np.fromregex(text, regexp, -// ... [('num', np.int64), ('key', 'S3')]) -// >>> output -// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], -// dtype=[('num', '>> output['num'] -// array([1312, 1534, 444]) -// -// -// -//go:linkname Fromregex py.fromregex -func Fromregex(__llgo_va_list ...interface{}) *py.Object -// -// Range of values (maximum - minimum) along an axis. -// -// The name of the function comes from the acronym for 'peak to peak'. -// -// .. warning:: -// `ptp` preserves the data type of the array. This means the -// return value for an input of signed integers with n bits -// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer -// with n bits. In that case, peak-to-peak values greater than -// ``2**(n-1)-1`` will be returned as negative values. An example -// with a work-around is shown below. -// -// Parameters -// ---------- -// a : array_like -// Input values. -// axis : None or int or tuple of ints, optional -// Axis along which to find the peaks. By default, flatten the -// array. `axis` may be negative, in -// which case it counts from the last to the first axis. -// -// .. versionadded:: 1.15.0 -// -// If this is a tuple of ints, a reduction is performed on multiple -// axes, instead of a single axis or all the axes as before. -// out : array_like -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type of the output values will be cast if necessary. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `ptp` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// Returns -// ------- -// ptp : ndarray or scalar -// The range of a given array - `scalar` if array is one-dimensional -// or a new array holding the result along the given axis -// -// Examples -// -------- -// >>> x = np.array([[4, 9, 2, 10], -// ... [6, 9, 7, 12]]) -// -// >>> np.ptp(x, axis=1) -// array([8, 6]) -// -// >>> np.ptp(x, axis=0) -// array([2, 0, 5, 2]) -// -// >>> np.ptp(x) -// 10 -// -// This example shows that a negative value can be returned when -// the input is an array of signed integers. -// -// >>> y = np.array([[1, 127], -// ... [0, 127], -// ... [-1, 127], -// ... [-2, 127]], dtype=np.int8) -// >>> np.ptp(y, axis=1) -// array([ 126, 127, -128, -127], dtype=int8) -// -// A work-around is to use the `view()` method to view the result as -// unsigned integers with the same bit width: -// -// >>> np.ptp(y, axis=1).view(np.uint8) -// array([126, 127, 128, 129], dtype=uint8) -// -// -// -//go:linkname Ptp py.ptp -func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object -// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the truncated value of the input, element-wise. -// -// The truncated value of the scalar `x` is the nearest integer `i` which -// is closer to zero than `x` is. In short, the fractional part of the -// signed number `x` is discarded. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The truncated value of each element in `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// ceil, floor, rint, fix -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// Examples -// -------- -// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) -// >>> np.trunc(a) -// array([-1., -1., -0., 0., 1., 1., 2.]) -// -//go:linkname Trunc py.trunc -func Trunc(x *py.Object, out *py.Object) *py.Object -// -// Return the string representation of a scalar dtype. -// -// Parameters -// ---------- -// sctype : scalar dtype or object -// If a scalar dtype, the corresponding string character is -// returned. If an object, `sctype2char` tries to infer its scalar type -// and then return the corresponding string character. -// -// Returns -// ------- -// typechar : str -// The string character corresponding to the scalar type. -// -// Raises -// ------ -// ValueError -// If `sctype` is an object for which the type can not be inferred. -// -// See Also -// -------- -// obj2sctype, issctype, issubsctype, mintypecode -// -// Examples -// -------- -// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: -// ... print(np.sctype2char(sctype)) -// l # may vary -// d -// D -// S -// O -// -// >>> x = np.array([1., 2-1.j]) -// >>> np.sctype2char(x) -// 'D' -// >>> np.sctype2char(list) -// 'O' -// -// -// -//go:linkname Sctype2char py.sctype2char -func Sctype2char(sctype *py.Object) *py.Object -// -// Return numbers spaced evenly on a log scale (a geometric progression). -// -// This is similar to `logspace`, but with endpoints specified directly. -// Each output sample is a constant multiple of the previous. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The final value of the sequence, unless `endpoint` is False. -// In that case, ``num + 1`` values are spaced over the -// interval in log-space, of which all but the last (a sequence of -// length `num`) are returned. -// num : integer, optional -// Number of samples to generate. Default is 50. -// endpoint : boolean, optional -// If true, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// dtype : dtype -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// `num` samples, equally spaced on a log scale. -// -// See Also -// -------- -// logspace : Similar to geomspace, but with endpoints specified using log -// and base. -// linspace : Similar to geomspace, but with arithmetic instead of geometric -// progression. -// arange : Similar to linspace, with the step size specified instead of the -// number of samples. -// :ref:`how-to-partition` -// -// Notes -// ----- -// If the inputs or dtype are complex, the output will follow a logarithmic -// spiral in the complex plane. (There are an infinite number of spirals -// passing through two points; the output will follow the shortest such path.) -// -// Examples -// -------- -// >>> np.geomspace(1, 1000, num=4) -// array([ 1., 10., 100., 1000.]) -// >>> np.geomspace(1, 1000, num=3, endpoint=False) -// array([ 1., 10., 100.]) -// >>> np.geomspace(1, 1000, num=4, endpoint=False) -// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) -// >>> np.geomspace(1, 256, num=9) -// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) -// -// Note that the above may not produce exact integers: -// -// >>> np.geomspace(1, 256, num=9, dtype=int) -// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) -// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) -// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) -// -// Negative, decreasing, and complex inputs are allowed: -// -// >>> np.geomspace(1000, 1, num=4) -// array([1000., 100., 10., 1.]) -// >>> np.geomspace(-1000, -1, num=4) -// array([-1000., -100., -10., -1.]) -// >>> np.geomspace(1j, 1000j, num=4) # Straight line -// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) -// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle -// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, -// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, -// 1.00000000e+00+0.00000000e+00j]) -// -// Graphical illustration of `endpoint` parameter: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 10 -// >>> y = np.zeros(N) -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') -// [] -// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') -// [] -// >>> plt.axis([0.5, 2000, 0, 3]) -// [0.5, 2000, 0, 3] -// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') -// >>> plt.show() -// -// -// -//go:linkname Geomspace py.geomspace -func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Stack arrays in sequence vertically (row wise). -// -// This is equivalent to concatenation along the first axis after 1-D arrays -// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by -// `vsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// ``np.row_stack`` is an alias for `vstack`. They are the same function. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the first axis. -// 1-D arrays must have the same length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays, will be at least 2-D. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// hstack : Stack arrays in sequence horizontally (column wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// vsplit : Split an array into multiple sub-arrays vertically (row-wise). -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3]) -// >>> b = np.array([4, 5, 6]) -// >>> np.vstack((a,b)) -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// >>> a = np.array([[1], [2], [3]]) -// >>> b = np.array([[4], [5], [6]]) -// >>> np.vstack((a,b)) -// array([[1], -// [2], -// [3], -// [4], -// [5], -// [6]]) -// -// -// -//go:linkname Vstack py.vstack -func Vstack(tup *py.Object) *py.Object -// -// Returns a bool array, where True if input element is real. -// -// If element has complex type with zero complex part, the return value -// for that element is True. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray, bool -// Boolean array of same shape as `x`. -// -// Notes -// ----- -// `isreal` may behave unexpectedly for string or object arrays (see examples) -// -// See Also -// -------- -// iscomplex -// isrealobj : Return True if x is not a complex type. -// -// Examples -// -------- -// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) -// >>> np.isreal(a) -// array([False, True, True, True, True, False]) -// -// The function does not work on string arrays. -// -// >>> a = np.array([2j, "a"], dtype="U") -// >>> np.isreal(a) # Warns about non-elementwise comparison -// False -// -// Returns True for all elements in input array of ``dtype=object`` even if -// any of the elements is complex. -// -// >>> a = np.array([1, "2", 3+4j], dtype=object) -// >>> np.isreal(a) -// array([ True, True, True]) -// -// isreal should not be used with object arrays -// -// >>> a = np.array([1+2j, 2+1j], dtype=object) -// >>> np.isreal(a) -// array([ True, True]) -// -// -// -//go:linkname Isreal py.isreal -func Isreal(x *py.Object) *py.Object -// add_ufunc_docstring(ufunc, new_docstring) -// -// Replace the docstring for a ufunc with new_docstring. -// This method will only work if the current docstring for -// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) -// -// Parameters -// ---------- -// ufunc : numpy.ufunc -// A ufunc whose current doc is NULL. -// new_docstring : string -// The new docstring for the ufunc. -// -// Notes -// ----- -// This method allocates memory for new_docstring on -// the heap. Technically this creates a mempory leak, since this -// memory will not be reclaimed until the end of the program -// even if the ufunc itself is removed. However this will only -// be a problem if the user is repeatedly creating ufuncs with -// no documentation, adding documentation via add_newdoc_ufunc, -// and then throwing away the ufunc. -// -//go:linkname AddNewdocUfunc py.add_newdoc_ufunc -func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object -// -// Build a matrix object from a string, nested sequence, or array. -// -// Parameters -// ---------- -// obj : str or array_like -// Input data. If a string, variables in the current scope may be -// referenced by name. -// ldict : dict, optional -// A dictionary that replaces local operands in current frame. -// Ignored if `obj` is not a string or `gdict` is None. -// gdict : dict, optional -// A dictionary that replaces global operands in current frame. -// Ignored if `obj` is not a string. -// -// Returns -// ------- -// out : matrix -// Returns a matrix object, which is a specialized 2-D array. -// -// See Also -// -------- -// block : -// A generalization of this function for N-d arrays, that returns normal -// ndarrays. -// -// Examples -// -------- -// >>> A = np.mat('1 1; 1 1') -// >>> B = np.mat('2 2; 2 2') -// >>> C = np.mat('3 4; 5 6') -// >>> D = np.mat('7 8; 9 0') -// -// All the following expressions construct the same block matrix: -// -// >>> np.bmat([[A, B], [C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// >>> np.bmat('A,B; C,D') -// matrix([[1, 1, 2, 2], -// [1, 1, 2, 2], -// [3, 4, 7, 8], -// [5, 6, 9, 0]]) -// -// -// -//go:linkname Bmat py.bmat -func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object -// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) -// -// Interpret a buffer as a 1-dimensional array. -// -// Parameters -// ---------- -// buffer : buffer_like -// An object that exposes the buffer interface. -// dtype : data-type, optional -// Data-type of the returned array; default: float. -// count : int, optional -// Number of items to read. ``-1`` means all data in the buffer. -// offset : int, optional -// Start reading the buffer from this offset (in bytes); default: 0. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// -// See also -// -------- -// ndarray.tobytes -// Inverse of this operation, construct Python bytes from the raw data -// bytes in the array. -// -// Notes -// ----- -// If the buffer has data that is not in machine byte-order, this should -// be specified as part of the data-type, e.g.:: -// -// >>> dt = np.dtype(int) -// >>> dt = dt.newbyteorder('>') -// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP -// -// The data of the resulting array will not be byteswapped, but will be -// interpreted correctly. -// -// This function creates a view into the original object. This should be safe -// in general, but it may make sense to copy the result when the original -// object is mutable or untrusted. -// -// Examples -// -------- -// >>> s = b'hello world' -// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) -// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') -// -// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) -// array([1, 2], dtype=uint8) -// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) -// array([1, 2, 3], dtype=uint8) -// -//go:linkname Frombuffer py.frombuffer -func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object -// -// Return the cumulative product of elements along a given axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// cumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case a reference to out is returned. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// Arithmetic is modular when using integer types, and no error is -// raised on overflow. -// -// Examples -// -------- -// >>> a = np.array([1,2,3]) -// >>> np.cumprod(a) # intermediate results 1, 1*2 -// ... # total product 1*2*3 = 6 -// array([1, 2, 6]) -// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) -// >>> np.cumprod(a, dtype=float) # specify type of output -// array([ 1., 2., 6., 24., 120., 720.]) -// -// The cumulative product for each column (i.e., over the rows) of `a`: -// -// >>> np.cumprod(a, axis=0) -// array([[ 1, 2, 3], -// [ 4, 10, 18]]) -// -// The cumulative product for each row (i.e. over the columns) of `a`: -// -// >>> np.cumprod(a,axis=1) -// array([[ 1, 2, 6], -// [ 4, 20, 120]]) -// -// -// -//go:linkname Cumprod py.cumprod -func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// -// Return the cross product of two (arrays of) vectors. -// -// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular -// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors -// are defined by the last axis of `a` and `b` by default, and these axes -// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is -// 2, the third component of the input vector is assumed to be zero and the -// cross product calculated accordingly. In cases where both input vectors -// have dimension 2, the z-component of the cross product is returned. -// -// Parameters -// ---------- -// a : array_like -// Components of the first vector(s). -// b : array_like -// Components of the second vector(s). -// axisa : int, optional -// Axis of `a` that defines the vector(s). By default, the last axis. -// axisb : int, optional -// Axis of `b` that defines the vector(s). By default, the last axis. -// axisc : int, optional -// Axis of `c` containing the cross product vector(s). Ignored if -// both input vectors have dimension 2, as the return is scalar. -// By default, the last axis. -// axis : int, optional -// If defined, the axis of `a`, `b` and `c` that defines the vector(s) -// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. -// -// Returns -// ------- -// c : ndarray -// Vector cross product(s). -// -// Raises -// ------ -// ValueError -// When the dimension of the vector(s) in `a` and/or `b` does not -// equal 2 or 3. -// -// See Also -// -------- -// inner : Inner product -// outer : Outer product. -// ix_ : Construct index arrays. -// -// Notes -// ----- -// .. versionadded:: 1.9.0 -// -// Supports full broadcasting of the inputs. -// -// Examples -// -------- -// Vector cross-product. -// -// >>> x = [1, 2, 3] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([-3, 6, -3]) -// -// One vector with dimension 2. -// -// >>> x = [1, 2] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Equivalently: -// -// >>> x = [1, 2, 0] -// >>> y = [4, 5, 6] -// >>> np.cross(x, y) -// array([12, -6, -3]) -// -// Both vectors with dimension 2. -// -// >>> x = [1,2] -// >>> y = [4,5] -// >>> np.cross(x, y) -// array(-3) -// -// Multiple vector cross-products. Note that the direction of the cross -// product vector is defined by the *right-hand rule*. -// -// >>> x = np.array([[1,2,3], [4,5,6]]) -// >>> y = np.array([[4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[-3, 6, -3], -// [ 3, -6, 3]]) -// -// The orientation of `c` can be changed using the `axisc` keyword. -// -// >>> np.cross(x, y, axisc=0) -// array([[-3, 3], -// [ 6, -6], -// [-3, 3]]) -// -// Change the vector definition of `x` and `y` using `axisa` and `axisb`. -// -// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) -// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) -// >>> np.cross(x, y) -// array([[ -6, 12, -6], -// [ 0, 0, 0], -// [ 6, -12, 6]]) -// >>> np.cross(x, y, axisa=0, axisb=0) -// array([[-24, 48, -24], -// [-30, 60, -30], -// [-36, 72, -36]]) -// -// -// -//go:linkname Cross py.cross -func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object -//go:linkname Arccosh py.arccosh -func Arccosh(__llgo_va_list ...interface{}) *py.Object -// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise OR of two arrays element-wise. -// -// Computes the bit-wise OR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``|``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_or -// bitwise_and -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 has the binary representation ``00001101``. Likewise, -// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is -// then ``00011101``, or 29: -// -// >>> np.bitwise_or(13, 16) -// 29 -// >>> np.binary_repr(29) -// '11101' -// -// >>> np.bitwise_or(32, 2) -// 34 -// >>> np.bitwise_or([33, 4], 1) -// array([33, 5]) -// >>> np.bitwise_or([33, 4], [1, 2]) -// array([33, 6]) -// -// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) -// array([ 6, 5, 255]) -// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) -// array([ 6, 5, 255]) -// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), -// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) -// array([ 6, 5, 255, 2147483647]) -// >>> np.bitwise_or([True, True], [False, True]) -// array([ True, True]) -// -// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([4, 4, 4]) -// >>> x1 | x2 -// array([ 6, 5, 255]) -// -//go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Change the sign of x1 to that of x2, element-wise. -// -// If `x2` is a scalar, its sign will be copied to all elements of `x1`. -// -// Parameters -// ---------- -// x1 : array_like -// Values to change the sign of. -// x2 : array_like -// The sign of `x2` is copied to `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The values of `x1` with the sign of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> np.copysign(1.3, -1) -// -1.3 -// >>> 1/np.copysign(0, 1) -// inf -// >>> 1/np.copysign(0, -1) -// -inf -// -// >>> np.copysign([-1, 0, 1], -1.1) -// array([-1., -0., -1.]) -// >>> np.copysign([-1, 0, 1], np.arange(3)-1) -// array([-1., 0., 1.]) -// -//go:linkname Copysign py.copysign -func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the next floating-point value after x1 towards x2, element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Values to find the next representable value of. -// x2 : array_like -// The direction where to look for the next representable value of `x1`. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The next representable values of `x1` in the direction of `x2`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Examples -// -------- -// >>> eps = np.finfo(np.float64).eps -// >>> np.nextafter(1, 2) == eps + 1 -// True -// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] -// array([ True, True]) -// -//go:linkname Nextafter py.nextafter -func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return Pearson product-moment correlation coefficients. -// -// Please refer to the documentation for `cov` for more detail. The -// relationship between the correlation coefficient matrix, `R`, and the -// covariance matrix, `C`, is -// -// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } -// -// The values of `R` are between -1 and 1, inclusive. -// -// Parameters -// ---------- -// x : array_like -// A 1-D or 2-D array containing multiple variables and observations. -// Each row of `x` represents a variable, and each column a single -// observation of all those variables. Also see `rowvar` below. -// y : array_like, optional -// An additional set of variables and observations. `y` has the same -// shape as `x`. -// rowvar : bool, optional -// If `rowvar` is True (default), then each row represents a -// variable, with observations in the columns. Otherwise, the relationship -// is transposed: each column represents a variable, while the rows -// contain observations. -// bias : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// ddof : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.10.0 -// dtype : data-type, optional -// Data-type of the result. By default, the return data-type will have -// at least `numpy.float64` precision. -// -// .. versionadded:: 1.20 -// -// Returns -// ------- -// R : ndarray -// The correlation coefficient matrix of the variables. -// -// See Also -// -------- -// cov : Covariance matrix -// -// Notes -// ----- -// Due to floating point rounding the resulting array may not be Hermitian, -// the diagonal elements may not be 1, and the elements may not satisfy the -// inequality abs(a) <= 1. The real and imaginary parts are clipped to the -// interval [-1, 1] in an attempt to improve on that situation but is not -// much help in the complex case. -// -// This function accepts but discards arguments `bias` and `ddof`. This is -// for backwards compatibility with previous versions of this function. These -// arguments had no effect on the return values of the function and can be -// safely ignored in this and previous versions of numpy. -// -// Examples -// -------- -// In this example we generate two random arrays, ``xarr`` and ``yarr``, and -// compute the row-wise and column-wise Pearson correlation coefficients, -// ``R``. Since ``rowvar`` is true by default, we first find the row-wise -// Pearson correlation coefficients between the variables of ``xarr``. -// -// >>> import numpy as np -// >>> rng = np.random.default_rng(seed=42) -// >>> xarr = rng.random((3, 3)) -// >>> xarr -// array([[0.77395605, 0.43887844, 0.85859792], -// [0.69736803, 0.09417735, 0.97562235], -// [0.7611397 , 0.78606431, 0.12811363]]) -// >>> R1 = np.corrcoef(xarr) -// >>> R1 -// array([[ 1. , 0.99256089, -0.68080986], -// [ 0.99256089, 1. , -0.76492172], -// [-0.68080986, -0.76492172, 1. ]]) -// -// If we add another set of variables and observations ``yarr``, we can -// compute the row-wise Pearson correlation coefficients between the -// variables in ``xarr`` and ``yarr``. -// -// >>> yarr = rng.random((3, 3)) -// >>> yarr -// array([[0.45038594, 0.37079802, 0.92676499], -// [0.64386512, 0.82276161, 0.4434142 ], -// [0.22723872, 0.55458479, 0.06381726]]) -// >>> R2 = np.corrcoef(xarr, yarr) -// >>> R2 -// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , -// -0.99004057], -// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, -// -0.99981569], -// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, -// 0.77714685], -// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, -// -0.83571711], -// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , -// 0.97517215], -// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, -// 1. ]]) -// -// Finally if we use the option ``rowvar=False``, the columns are now -// being treated as the variables and we will find the column-wise Pearson -// correlation coefficients between variables in ``xarr`` and ``yarr``. -// -// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) -// >>> R3 -// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , -// 0.22423734], -// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, -// -0.44069024], -// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, -// 0.75137473], -// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, -// 0.47536961], -// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , -// -0.46666491], -// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, -// 1. ]]) -// -// -// -//go:linkname Corrcoef py.corrcoef -func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object -// -// Return the indices to access (n, n) arrays, given a masking function. -// -// Assume `mask_func` is a function that, for a square array a of size -// ``(n, n)`` with a possible offset argument `k`, when called as -// ``mask_func(a, k)`` returns a new array with zeros in certain locations -// (functions like `triu` or `tril` do precisely this). Then this function -// returns the indices where the non-zero values would be located. -// -// Parameters -// ---------- -// n : int -// The returned indices will be valid to access arrays of shape (n, n). -// mask_func : callable -// A function whose call signature is similar to that of `triu`, `tril`. -// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. -// `k` is an optional argument to the function. -// k : scalar -// An optional argument which is passed through to `mask_func`. Functions -// like `triu`, `tril` take a second argument that is interpreted as an -// offset. -// -// Returns -// ------- -// indices : tuple of arrays. -// The `n` arrays of indices corresponding to the locations where -// ``mask_func(np.ones((n, n)), k)`` is True. -// -// See Also -// -------- -// triu, tril, triu_indices, tril_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// These are the indices that would allow you to access the upper triangular -// part of any 3x3 array: -// -// >>> iu = np.mask_indices(3, np.triu) -// -// For example, if `a` is a 3x3 array: -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> a[iu] -// array([0, 1, 2, 4, 5, 8]) -// -// An offset can be passed also to the masking function. This gets us the -// indices starting on the first diagonal right of the main one: -// -// >>> iu1 = np.mask_indices(3, np.triu, 1) -// -// with which we now extract only three elements: -// -// >>> a[iu1] -// array([1, 2, 5]) -// -// -// -//go:linkname MaskIndices py.mask_indices -func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object -// -// lexsort(keys, axis=-1) -// -// Perform an indirect stable sort using a sequence of keys. -// -// Given multiple sorting keys, which can be interpreted as columns in a -// spreadsheet, lexsort returns an array of integer indices that describes -// the sort order by multiple columns. The last key in the sequence is used -// for the primary sort order, the second-to-last key for the secondary sort -// order, and so on. The keys argument must be a sequence of objects that -// can be converted to arrays of the same shape. If a 2D array is provided -// for the keys argument, its rows are interpreted as the sorting keys and -// sorting is according to the last row, second last row etc. -// -// Parameters -// ---------- -// keys : (k, N) array or tuple containing k (N,)-shaped sequences -// The `k` different "columns" to be sorted. The last column (or row if -// `keys` is a 2D array) is the primary sort key. -// axis : int, optional -// Axis to be indirectly sorted. By default, sort over the last axis. -// -// Returns -// ------- -// indices : (N,) ndarray of ints -// Array of indices that sort the keys along the specified axis. -// -// See Also -// -------- -// argsort : Indirect sort. -// ndarray.sort : In-place sort. -// sort : Return a sorted copy of an array. -// -// Examples -// -------- -// Sort names: first by surname, then by name. -// -// >>> surnames = ('Hertz', 'Galilei', 'Hertz') -// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') -// >>> ind = np.lexsort((first_names, surnames)) -// >>> ind -// array([1, 2, 0]) -// -// >>> [surnames[i] + ", " + first_names[i] for i in ind] -// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] -// -// Sort two columns of numbers: -// -// >>> a = [1,5,1,4,3,4,4] # First column -// >>> b = [9,4,0,4,0,2,1] # Second column -// >>> ind = np.lexsort((b,a)) # Sort by a, then by b -// >>> ind -// array([2, 0, 4, 6, 5, 3, 1]) -// -// >>> [(a[i],b[i]) for i in ind] -// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] -// -// Note that sorting is first according to the elements of ``a``. -// Secondary sorting is according to the elements of ``b``. -// -// A normal ``argsort`` would have yielded: -// -// >>> [(a[i],b[i]) for i in np.argsort(a)] -// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] -// -// Structured arrays are sorted lexically by ``argsort``: -// -// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], -// ... dtype=np.dtype([('x', int), ('y', int)])) -// -// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) -// array([2, 0, 4, 6, 5, 3, 1]) -// -// -// -//go:linkname Lexsort py.lexsort -func Lexsort(keys *py.Object, axis *py.Object) *py.Object -// -// Return an array representing the indices of a grid. -// -// Compute an array where the subarrays contain index values 0, 1, ... -// varying only along the corresponding axis. -// -// Parameters -// ---------- -// dimensions : sequence of ints -// The shape of the grid. -// dtype : dtype, optional -// Data type of the result. -// sparse : boolean, optional -// Return a sparse representation of the grid instead of a dense -// representation. Default is False. -// -// .. versionadded:: 1.17 -// -// Returns -// ------- -// grid : one ndarray or tuple of ndarrays -// If sparse is False: -// Returns one array of grid indices, -// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. -// If sparse is True: -// Returns a tuple of arrays, with -// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with -// dimensions[i] in the ith place -// -// See Also -// -------- -// mgrid, ogrid, meshgrid -// -// Notes -// ----- -// The output shape in the dense case is obtained by prepending the number -// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` -// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is -// ``(N, r0, ..., rN-1)``. -// -// The subarrays ``grid[k]`` contains the N-D array of indices along the -// ``k-th`` axis. Explicitly:: -// -// grid[k, i0, i1, ..., iN-1] = ik -// -// Examples -// -------- -// >>> grid = np.indices((2, 3)) -// >>> grid.shape -// (2, 2, 3) -// >>> grid[0] # row indices -// array([[0, 0, 0], -// [1, 1, 1]]) -// >>> grid[1] # column indices -// array([[0, 1, 2], -// [0, 1, 2]]) -// -// The indices can be used as an index into an array. -// -// >>> x = np.arange(20).reshape(5, 4) -// >>> row, col = np.indices((2, 3)) -// >>> x[row, col] -// array([[0, 1, 2], -// [4, 5, 6]]) -// -// Note that it would be more straightforward in the above example to -// extract the required elements directly with ``x[:2, :3]``. -// -// If sparse is set to true, the grid will be returned in a sparse -// representation. -// -// >>> i, j = np.indices((2, 3), sparse=True) -// >>> i.shape -// (2, 1) -// >>> j.shape -// (1, 3) -// >>> i # row indices -// array([[0], -// [1]]) -// >>> j # column indices -// array([[0, 1, 2]]) -// -// -// -//go:linkname Indices py.indices -func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object -// -// Compute the standard deviation along the specified axis. -// -// Returns the standard deviation, a measure of the spread of a distribution, -// of the array elements. The standard deviation is computed for the -// flattened array by default, otherwise over the specified axis. -// -// Parameters -// ---------- -// a : array_like -// Calculate the standard deviation of these values. -// axis : None or int or tuple of ints, optional -// Axis or axes along which the standard deviation is computed. The -// default is to compute the standard deviation of the flattened array. -// -// .. versionadded:: 1.7.0 -// -// If this is a tuple of ints, a standard deviation is performed over -// multiple axes, instead of a single axis or all the axes as before. -// dtype : dtype, optional -// Type to use in computing the standard deviation. For arrays of -// integer type the default is float64, for arrays of float types it is -// the same as the array type. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output but the type (of the calculated -// values) will be cast if necessary. -// ddof : int, optional -// Means Delta Degrees of Freedom. The divisor used in calculations -// is ``N - ddof``, where ``N`` represents the number of elements. -// By default `ddof` is zero. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the input array. -// -// If the default value is passed, then `keepdims` will not be -// passed through to the `std` method of sub-classes of -// `ndarray`, however any non-default value will be. If the -// sub-class' method does not implement `keepdims` any -// exceptions will be raised. -// -// where : array_like of bool, optional -// Elements to include in the standard deviation. -// See `~numpy.ufunc.reduce` for details. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// standard_deviation : ndarray, see dtype parameter above. -// If `out` is None, return a new array containing the standard deviation, -// otherwise return a reference to the output array. -// -// See Also -// -------- -// var, mean, nanmean, nanstd, nanvar -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// The standard deviation is the square root of the average of the squared -// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where -// ``x = abs(a - a.mean())**2``. -// -// The average squared deviation is typically calculated as ``x.sum() / N``, -// where ``N = len(x)``. If, however, `ddof` is specified, the divisor -// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` -// provides an unbiased estimator of the variance of the infinite population. -// ``ddof=0`` provides a maximum likelihood estimate of the variance for -// normally distributed variables. The standard deviation computed in this -// function is the square root of the estimated variance, so even with -// ``ddof=1``, it will not be an unbiased estimate of the standard deviation -// per se. -// -// Note that, for complex numbers, `std` takes the absolute -// value before squaring, so that the result is always real and nonnegative. -// -// For floating-point input, the *std* is computed using the same -// precision the input has. Depending on the input data, this can cause -// the results to be inaccurate, especially for float32 (see example below). -// Specifying a higher-accuracy accumulator using the `dtype` keyword can -// alleviate this issue. -// -// Examples -// -------- -// >>> a = np.array([[1, 2], [3, 4]]) -// >>> np.std(a) -// 1.1180339887498949 # may vary -// >>> np.std(a, axis=0) -// array([1., 1.]) -// >>> np.std(a, axis=1) -// array([0.5, 0.5]) -// -// In single precision, std() can be inaccurate: -// -// >>> a = np.zeros((2, 512*512), dtype=np.float32) -// >>> a[0, :] = 1.0 -// >>> a[1, :] = 0.1 -// >>> np.std(a) -// 0.45000005 -// -// Computing the standard deviation in float64 is more accurate: -// -// >>> np.std(a, dtype=np.float64) -// 0.44999999925494177 # may vary -// -// Specifying a where argument: -// -// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) -// >>> np.std(a) -// 2.614064523559687 # may vary -// >>> np.std(a, where=[[True], [True], [False]]) -// 2.0 -// -// -// -//go:linkname Std py.std -func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object -//go:linkname Absolute py.absolute -func Absolute(__llgo_va_list ...interface{}) *py.Object -//go:linkname Add py.add -func Add(__llgo_va_list ...interface{}) *py.Object -// geterrobj() -// -// Return the current object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `geterrobj` is used internally by the other -// functions that get and set error handling behavior (`geterr`, `seterr`, -// `geterrcall`, `seterrcall`). -// -// Returns -// ------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// seterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrobj() # first get the defaults -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> old_bufsize = np.setbufsize(20000) -// >>> old_err = np.seterr(divide='raise') -// >>> old_handler = np.seterrcall(err_handler) -// >>> np.geterrobj() -// [8192, 521, ] -// -// >>> old_err = np.seterr(all='ignore') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '0' -// >>> old_err = np.seterr(divide='warn', over='log', under='call', -// ... invalid='print') -// >>> np.base_repr(np.geterrobj()[1], 8) -// '4351' -// -//go:linkname Geterrobj py.geterrobj -func Geterrobj() *py.Object -// -// Get help information for an array, function, class, or module. -// -// Parameters -// ---------- -// object : object or str, optional -// Input object or name to get information about. If `object` is -// an `ndarray` instance, information about the array is printed. -// If `object` is a numpy object, its docstring is given. If it is -// a string, available modules are searched for matching objects. -// If None, information about `info` itself is returned. -// maxwidth : int, optional -// Printing width. -// output : file like object, optional -// File like object that the output is written to, default is -// ``None``, in which case ``sys.stdout`` will be used. -// The object has to be opened in 'w' or 'a' mode. -// toplevel : str, optional -// Start search at this level. -// -// See Also -// -------- -// source, lookfor -// -// Notes -// ----- -// When used interactively with an object, ``np.info(obj)`` is equivalent -// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython -// prompt. -// -// Examples -// -------- -// >>> np.info(np.polyval) # doctest: +SKIP -// polyval(p, x) -// Evaluate the polynomial p at x. -// ... -// -// When using a string for `object` it is possible to get multiple results. -// -// >>> np.info('fft') # doctest: +SKIP -// *** Found in numpy *** -// Core FFT routines -// ... -// *** Found in numpy.fft *** -// fft(a, n=None, axis=-1) -// ... -// *** Repeat reference found in numpy.fft.fftpack *** -// *** Total of 3 references found. *** -// -// When the argument is an array, information about the array is printed. -// -// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) -// >>> np.info(a) -// class: ndarray -// shape: (2, 3) -// strides: (24, 8) -// itemsize: 8 -// aligned: True -// contiguous: True -// fortran: False -// data pointer: 0x562b6e0d2860 # may vary -// byteorder: little -// byteswap: False -// type: complex64 -// -// -// -//go:linkname Info py.info -func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object -// fromiter(iter, dtype, count=-1, *, like=None) -// -// Create a new 1-dimensional array from an iterable object. -// -// Parameters -// ---------- -// iter : iterable object -// An iterable object providing data for the array. -// dtype : data-type -// The data-type of the returned array. -// -// .. versionchanged:: 1.23 -// Object and subarray dtypes are now supported (note that the final -// result is not 1-D for a subarray dtype). -// -// count : int, optional -// The number of items to read from *iterable*. The default is -1, -// which means all data is read. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The output array. -// -// Notes -// ----- -// Specify `count` to improve performance. It allows ``fromiter`` to -// pre-allocate the output array, instead of resizing it on demand. -// -// Examples -// -------- -// >>> iterable = (x*x for x in range(5)) -// >>> np.fromiter(iterable, float) -// array([ 0., 1., 4., 9., 16.]) -// -// A carefully constructed subarray dtype will lead to higher dimensional -// results: -// -// >>> iterable = ((x+1, x+2) for x in range(5)) -// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) -// array([[1, 2], -// [2, 3], -// [3, 4], -// [4, 5], -// [5, 6]]) -// -//go:linkname Fromiter py.fromiter -func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object -// Context manager for setting print options. -// -// Set print options for the scope of the `with` block, and restore the old -// options at the end. See `set_printoptions` for the full description of -// available options. -// -// Examples -// -------- -// -// >>> from numpy.testing import assert_equal -// >>> with np.printoptions(precision=2): -// ... np.array([2.0]) / 3 -// array([0.67]) -// -// The `as`-clause of the `with`-statement gives the current print options: -// -// >>> with np.printoptions(precision=2) as opts: -// ... assert_equal(opts, np.get_printoptions()) -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// -// -//go:linkname Printoptions py.printoptions -func Printoptions(__llgo_va_list ...interface{}) *py.Object -// -// Return an ndarray of the provided type that satisfies requirements. -// -// This function is useful to be sure that an array with the correct flags -// is returned for passing to compiled code (perhaps through ctypes). -// -// Parameters -// ---------- -// a : array_like -// The object to be converted to a type-and-requirement-satisfying array. -// dtype : data-type -// The required data-type. If None preserve the current dtype. If your -// application requires the data to be in native byteorder, include -// a byteorder specification as a part of the dtype specification. -// requirements : str or sequence of str -// The requirements list can be any of the following -// -// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array -// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array -// * 'ALIGNED' ('A') - ensure a data-type aligned array -// * 'WRITEABLE' ('W') - ensure a writable array -// * 'OWNDATA' ('O') - ensure an array that owns its own data -// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Array with specified requirements and type if given. -// -// See Also -// -------- -// asarray : Convert input to an ndarray. -// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. -// ascontiguousarray : Convert input to a contiguous array. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// ndarray.flags : Information about the memory layout of the array. -// -// Notes -// ----- -// The returned array will be guaranteed to have the listed requirements -// by making a copy if needed. -// -// Examples -// -------- -// >>> x = np.arange(6).reshape(2,3) -// >>> x.flags -// C_CONTIGUOUS : True -// F_CONTIGUOUS : False -// OWNDATA : False -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) -// >>> y.flags -// C_CONTIGUOUS : False -// F_CONTIGUOUS : True -// OWNDATA : True -// WRITEABLE : True -// ALIGNED : True -// WRITEBACKIFCOPY : False -// -// -// -//go:linkname Require py.require -func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object -// -// Take values from the input array by matching 1d index and data slices. -// -// This iterates over matching 1d slices oriented along the specified axis in -// the index and data arrays, and uses the former to look up values in the -// latter. These slices can be different lengths. -// -// Functions returning an index along an axis, like `argsort` and -// `argpartition`, produce suitable indices for this function. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// arr : ndarray (Ni..., M, Nk...) -// Source array -// indices : ndarray (Ni..., J, Nk...) -// Indices to take along each 1d slice of `arr`. This must match the -// dimension of arr, but dimensions Ni and Nj only need to broadcast -// against `arr`. -// axis : int -// The axis to take 1d slices along. If axis is None, the input array is -// treated as if it had first been flattened to 1d, for consistency with -// `sort` and `argsort`. -// -// Returns -// ------- -// out: ndarray (Ni..., J, Nk...) -// The indexed result. -// -// Notes -// ----- -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: -// -// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] -// J = indices.shape[axis] # Need not equal M -// out = np.empty(Ni + (J,) + Nk) -// -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// a_1d = a [ii + s_[:,] + kk] -// indices_1d = indices[ii + s_[:,] + kk] -// out_1d = out [ii + s_[:,] + kk] -// for j in range(J): -// out_1d[j] = a_1d[indices_1d[j]] -// -// Equivalently, eliminating the inner loop, the last two lines would be:: -// -// out_1d[:] = a_1d[indices_1d] -// -// See Also -// -------- -// take : Take along an axis, using the same indices for every 1d slice -// put_along_axis : -// Put values into the destination array by matching 1d index and data slices -// -// Examples -// -------- -// -// For this sample array -// -// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) -// -// We can sort either by using sort directly, or argsort and this function -// -// >>> np.sort(a, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// >>> ai = np.argsort(a, axis=1) -// >>> ai -// array([[0, 2, 1], -// [1, 2, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 20, 30], -// [40, 50, 60]]) -// -// The same works for max and min, if you maintain the trivial dimension -// with ``keepdims``: -// -// >>> np.max(a, axis=1, keepdims=True) -// array([[30], -// [60]]) -// >>> ai = np.argmax(a, axis=1, keepdims=True) -// >>> ai -// array([[1], -// [0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[30], -// [60]]) -// -// If we want to get the max and min at the same time, we can stack the -// indices first -// -// >>> ai_min = np.argmin(a, axis=1, keepdims=True) -// >>> ai_max = np.argmax(a, axis=1, keepdims=True) -// >>> ai = np.concatenate([ai_min, ai_max], axis=1) -// >>> ai -// array([[0, 1], -// [1, 0]]) -// >>> np.take_along_axis(a, ai, axis=1) -// array([[10, 30], -// [40, 60]]) -// -// -//go:linkname TakeAlongAxis py.take_along_axis -func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object -// asanyarray(a, dtype=None, order=None, *, like=None) -// -// Convert the input to an ndarray, but pass ndarray subclasses through. -// -// Parameters -// ---------- -// a : array_like -// Input data, in any form that can be converted to an array. This -// includes scalars, lists, lists of tuples, tuples, tuples of tuples, -// tuples of lists, and ndarrays. -// dtype : data-type, optional -// By default, the data-type is inferred from the input data. -// order : {'C', 'F', 'A', 'K'}, optional -// Memory layout. 'A' and 'K' depend on the order of input array a. -// 'C' row-major (C-style), -// 'F' column-major (Fortran-style) memory representation. -// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise -// 'K' (keep) preserve input order -// Defaults to 'C'. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray or an ndarray subclass -// Array interpretation of `a`. If `a` is an ndarray or a subclass -// of ndarray, it is returned as-is and no copy is performed. -// -// See Also -// -------- -// asarray : Similar function which always returns ndarrays. -// ascontiguousarray : Convert input to a contiguous array. -// asfarray : Convert input to a floating point ndarray. -// asfortranarray : Convert input to an ndarray with column-major -// memory order. -// asarray_chkfinite : Similar function which checks input for NaNs and -// Infs. -// fromiter : Create an array from an iterator. -// fromfunction : Construct an array by executing a function on grid -// positions. -// -// Examples -// -------- -// Convert a list into an array: -// -// >>> a = [1, 2] -// >>> np.asanyarray(a) -// array([1, 2]) -// -// Instances of `ndarray` subclasses are passed through as-is: -// -// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) -// >>> np.asanyarray(a) is a -// True -// -//go:linkname Asanyarray py.asanyarray -func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object -// -// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) -// -// Return a new array with the same shape and type as a given array. -// -// Parameters -// ---------- -// prototype : array_like -// The shape and data-type of `prototype` define these same attributes -// of the returned array. -// dtype : data-type, optional -// Overrides the data type of the result. -// -// .. versionadded:: 1.6.0 -// order : {'C', 'F', 'A', or 'K'}, optional -// Overrides the memory layout of the result. 'C' means C-order, -// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran -// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` -// as closely as possible. -// -// .. versionadded:: 1.6.0 -// subok : bool, optional. -// If True, then the newly created array will use the sub-class -// type of `prototype`, otherwise it will be a base-class array. Defaults -// to True. -// shape : int or sequence of ints, optional. -// Overrides the shape of the result. If order='K' and the number of -// dimensions is unchanged, will try to keep order, otherwise, -// order='C' is implied. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// out : ndarray -// Array of uninitialized (arbitrary) data with the same -// shape and type as `prototype`. -// -// See Also -// -------- -// ones_like : Return an array of ones with shape and type of input. -// zeros_like : Return an array of zeros with shape and type of input. -// full_like : Return a new array with shape of input filled with value. -// empty : Return a new uninitialized array. -// -// Notes -// ----- -// This function does *not* initialize the returned array; to do that use -// `zeros_like` or `ones_like` instead. It may be marginally faster than -// the functions that do set the array values. -// -// Examples -// -------- -// >>> a = ([1,2,3], [4,5,6]) # a is array-like -// >>> np.empty_like(a) -// array([[-1073741821, -1073741821, 3], # uninitialized -// [ 0, 0, -1073741821]]) -// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) -// >>> np.empty_like(a) -// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized -// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) -// -// -// -//go:linkname EmptyLike py.empty_like -func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object -// -// Returns the indices of the maximum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmax, argmin -// amax : The maximum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmax to an array as if by calling max. -// -// Notes -// ----- -// In case of multiple occurrences of the maximum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmax(a) -// 5 -// >>> np.argmax(a, axis=0) -// array([1, 1, 1]) -// >>> np.argmax(a, axis=1) -// array([2, 2]) -// -// Indexes of the maximal elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) -// >>> ind -// (1, 2) -// >>> a[ind] -// 15 -// -// >>> b = np.arange(6) -// >>> b[1] = 5 -// >>> b -// array([0, 5, 2, 3, 4, 5]) -// >>> np.argmax(b) # Only the first occurrence is returned. -// 1 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmax(x, axis=-1) -// >>> # Same as np.amax(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[4], -// [3]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([4, 3]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmax(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmax py.argmax -func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Return the cumulative product over the given axis. -// -// .. deprecated:: 1.25.0 -// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be -// removed in NumPy 2.0. Please use `cumprod` instead. -// -// See Also -// -------- -// cumprod : equivalent function; see for details. -// -// -//go:linkname Cumproduct py.cumproduct -func Cumproduct(__llgo_va_list ...interface{}) *py.Object -// -// Interchange two axes of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis1 : int -// First axis. -// axis2 : int -// Second axis. -// -// Returns -// ------- -// a_swapped : ndarray -// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is -// returned; otherwise a new array is created. For earlier NumPy -// versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// Examples -// -------- -// >>> x = np.array([[1,2,3]]) -// >>> np.swapaxes(x,0,1) -// array([[1], -// [2], -// [3]]) -// -// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) -// >>> x -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// -// >>> np.swapaxes(x,0,2) -// array([[[0, 4], -// [2, 6]], -// [[1, 5], -// [3, 7]]]) -// -// -// -//go:linkname Swapaxes py.swapaxes -func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute bit-wise inversion, or bit-wise NOT, element-wise. -// -// Computes the bit-wise NOT of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``~``. -// -// For signed integer inputs, the two's complement is returned. In a -// two's-complement system negative numbers are represented by the two's -// complement of the absolute value. This is the most common method of -// representing signed integers on computers [1]_. A N-bit -// two's-complement system can represent every integer in the range -// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. -// -// Parameters -// ---------- -// x : array_like -// Only integer and boolean types are handled. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// bitwise_and, bitwise_or, bitwise_xor -// logical_not -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Notes -// ----- -// `bitwise_not` is an alias for `invert`: -// -// >>> np.bitwise_not is np.invert -// True -// -// References -// ---------- -// .. [1] Wikipedia, "Two's complement", -// https://en.wikipedia.org/wiki/Two's_complement -// -// Examples -// -------- -// We've seen that 13 is represented by ``00001101``. -// The invert or bit-wise NOT of 13 is then: -// -// >>> x = np.invert(np.array(13, dtype=np.uint8)) -// >>> x -// 242 -// >>> np.binary_repr(x, width=8) -// '11110010' -// -// The result depends on the bit-width: -// -// >>> x = np.invert(np.array(13, dtype=np.uint16)) -// >>> x -// 65522 -// >>> np.binary_repr(x, width=16) -// '1111111111110010' -// -// When using signed integer types the result is the two's complement of -// the result for the unsigned type: -// -// >>> np.invert(np.array([13], dtype=np.int8)) -// array([-14], dtype=int8) -// >>> np.binary_repr(-14, width=8) -// '11110010' -// -// Booleans are accepted as well: -// -// >>> np.invert(np.array([True, False])) -// array([False, True]) -// -// The ``~`` operator can be used as a shorthand for ``np.invert`` on -// ndarrays. -// -// >>> x1 = np.array([True, False]) -// >>> ~x1 -// array([False, True]) -// -//go:linkname Invert py.invert -func Invert(x *py.Object, out *py.Object) *py.Object -// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Convert angles from degrees to radians. -// -// Parameters -// ---------- -// x : array_like -// Input array in degrees. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding radian values. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// deg2rad : equivalent function -// -// Examples -// -------- -// Convert a degree array to radians -// -// >>> deg = np.arange(12.) * 30. -// >>> np.radians(deg) -// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , -// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, -// 5.23598776, 5.75958653]) -// -// >>> out = np.zeros((deg.shape)) -// >>> ret = np.radians(deg, out) -// >>> ret is out -// True -// -//go:linkname Radians py.radians -func Radians(x *py.Object, out *py.Object) *py.Object -// fastCopyAndTranspose(a) -// -// .. deprecated:: 1.24 -// -// fastCopyAndTranspose is deprecated and will be removed. Use the copy and -// transpose methods instead, e.g. ``arr.T.copy()`` -// -//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose -func FastCopyAndTranspose(a *py.Object) *py.Object -// -// Evenly round to the given number of decimals. -// -// Parameters -// ---------- -// a : array_like -// Input data. -// decimals : int, optional -// Number of decimal places to round to (default: 0). If -// decimals is negative, it specifies the number of positions to -// the left of the decimal point. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape as the expected output, but the type of the output -// values will be cast if necessary. See :ref:`ufuncs-output-type` for more -// details. -// -// Returns -// ------- -// rounded_array : ndarray -// An array of the same type as `a`, containing the rounded values. -// Unless `out` was specified, a new array is created. A reference to -// the result is returned. -// -// The real and imaginary parts of complex numbers are rounded -// separately. The result of rounding a float is a float. -// -// See Also -// -------- -// ndarray.round : equivalent method -// around : an alias for this function -// ceil, fix, floor, rint, trunc -// -// -// Notes -// ----- -// For values exactly halfway between rounded decimal values, NumPy -// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -// -0.5 and 0.5 round to 0.0, etc. -// -// ``np.round`` uses a fast but sometimes inexact algorithm to round -// floating-point datatypes. For positive `decimals` it is equivalent to -// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has -// error due to the inexact representation of decimal fractions in the IEEE -// floating point standard [1]_ and errors introduced when scaling by powers -// of ten. For instance, note the extra "1" in the following: -// -// >>> np.round(56294995342131.5, 3) -// 56294995342131.51 -// -// If your goal is to print such values with a fixed number of decimals, it is -// preferable to use numpy's float printing routines to limit the number of -// printed decimals: -// -// >>> np.format_float_positional(56294995342131.5, precision=3) -// '56294995342131.5' -// -// The float printing routines use an accurate but much more computationally -// demanding algorithm to compute the number of digits after the decimal -// point. -// -// Alternatively, Python's builtin `round` function uses a more accurate -// but slower algorithm for 64-bit floating point values: -// -// >>> round(56294995342131.5, 3) -// 56294995342131.5 -// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 -// (16.06, 16.05) -// -// -// References -// ---------- -// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, -// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF -// -// Examples -// -------- -// >>> np.round([0.37, 1.64]) -// array([0., 2.]) -// >>> np.round([0.37, 1.64], decimals=1) -// array([0.4, 1.6]) -// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value -// array([0., 2., 2., 4., 4.]) -// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned -// array([ 1, 2, 3, 11]) -// >>> np.round([1,2,3,11], decimals=-1) -// array([ 0, 0, 0, 10]) -// -// -// -//go:linkname Round py.round -func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise AND of two arrays element-wise. -// -// Computes the bit-wise AND of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``&``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_and -// bitwise_or -// bitwise_xor -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise AND of 13 and 17 is -// therefore ``000000001``, or 1: -// -// >>> np.bitwise_and(13, 17) -// 1 -// -// >>> np.bitwise_and(14, 13) -// 12 -// >>> np.binary_repr(12) -// '1100' -// >>> np.bitwise_and([14,3], 13) -// array([12, 1]) -// -// >>> np.bitwise_and([11,7], [4,25]) -// array([0, 1]) -// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) -// array([ 2, 4, 16]) -// >>> np.bitwise_and([True, True], [False, True]) -// array([False, True]) -// -// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on -// ndarrays. -// -// >>> x1 = np.array([2, 5, 255]) -// >>> x2 = np.array([3, 14, 16]) -// >>> x1 & x2 -// array([ 2, 4, 16]) -// -//go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the string representation of an array. -// -// Parameters -// ---------- -// arr : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// -// Returns -// ------- -// string : str -// The string representation of an array. -// -// See Also -// -------- -// array_str, array2string, set_printoptions -// -// Examples -// -------- -// >>> np.array_repr(np.array([1,2])) -// 'array([1, 2])' -// >>> np.array_repr(np.ma.array([0.])) -// 'MaskedArray([0.])' -// >>> np.array_repr(np.array([], np.int32)) -// 'array([], dtype=int32)' -// -// >>> x = np.array([1e-6, 4e-7, 2, 3]) -// >>> np.array_repr(x, precision=6, suppress_small=True) -// 'array([0.000001, 0. , 2. , 3. ])' -// -// -// -//go:linkname ArrayRepr py.array_repr -func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object -// -// Return a string representation of an array. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// max_line_width : int, optional -// Inserts newlines if text is longer than `max_line_width`. -// Defaults to ``numpy.get_printoptions()['linewidth']``. -// precision : int or None, optional -// Floating point precision. -// Defaults to ``numpy.get_printoptions()['precision']``. -// suppress_small : bool, optional -// Represent numbers "very close" to zero as zero; default is False. -// Very close is defined by precision: if the precision is 8, e.g., -// numbers smaller (in absolute value) than 5e-9 are represented as -// zero. -// Defaults to ``numpy.get_printoptions()['suppress']``. -// separator : str, optional -// Inserted between elements. -// prefix : str, optional -// suffix : str, optional -// The length of the prefix and suffix strings are used to respectively -// align and wrap the output. An array is typically printed as:: -// -// prefix + array2string(a) + suffix -// -// The output is left-padded by the length of the prefix string, and -// wrapping is forced at the column ``max_line_width - len(suffix)``. -// It should be noted that the content of prefix and suffix strings are -// not included in the output. -// style : _NoValue, optional -// Has no effect, do not use. -// -// .. deprecated:: 1.14.0 -// formatter : dict of callables, optional -// If not None, the keys should indicate the type(s) that the respective -// formatting function applies to. Callables should return a string. -// Types that are not specified (by their corresponding keys) are handled -// by the default formatters. Individual types for which a formatter -// can be set are: -// -// - 'bool' -// - 'int' -// - 'timedelta' : a `numpy.timedelta64` -// - 'datetime' : a `numpy.datetime64` -// - 'float' -// - 'longfloat' : 128-bit floats -// - 'complexfloat' -// - 'longcomplexfloat' : composed of two 128-bit floats -// - 'void' : type `numpy.void` -// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` -// -// Other keys that can be used to set a group of types at once are: -// -// - 'all' : sets all types -// - 'int_kind' : sets 'int' -// - 'float_kind' : sets 'float' and 'longfloat' -// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' -// - 'str_kind' : sets 'numpystr' -// threshold : int, optional -// Total number of array elements which trigger summarization -// rather than full repr. -// Defaults to ``numpy.get_printoptions()['threshold']``. -// edgeitems : int, optional -// Number of array items in summary at beginning and end of -// each dimension. -// Defaults to ``numpy.get_printoptions()['edgeitems']``. -// sign : string, either '-', '+', or ' ', optional -// Controls printing of the sign of floating-point types. If '+', always -// print the sign of positive values. If ' ', always prints a space -// (whitespace character) in the sign position of positive values. If -// '-', omit the sign character of positive values. -// Defaults to ``numpy.get_printoptions()['sign']``. -// floatmode : str, optional -// Controls the interpretation of the `precision` option for -// floating-point types. -// Defaults to ``numpy.get_printoptions()['floatmode']``. -// Can take the following values: -// -// - 'fixed': Always print exactly `precision` fractional digits, -// even if this would print more or fewer digits than -// necessary to specify the value uniquely. -// - 'unique': Print the minimum number of fractional digits necessary -// to represent each value uniquely. Different elements may -// have a different number of digits. The value of the -// `precision` option is ignored. -// - 'maxprec': Print at most `precision` fractional digits, but if -// an element can be uniquely represented with fewer digits -// only print it with that many. -// - 'maxprec_equal': Print at most `precision` fractional digits, -// but if every element in the array can be uniquely -// represented with an equal number of fewer digits, use that -// many digits for all elements. -// legacy : string or `False`, optional -// If set to the string `'1.13'` enables 1.13 legacy printing mode. This -// approximates numpy 1.13 print output by including a space in the sign -// position of floats and different behavior for 0d arrays. If set to -// `False`, disables legacy mode. Unrecognized strings will be ignored -// with a warning for forward compatibility. -// -// .. versionadded:: 1.14.0 -// -// Returns -// ------- -// array_str : str -// String representation of the array. -// -// Raises -// ------ -// TypeError -// if a callable in `formatter` does not return a string. -// -// See Also -// -------- -// array_str, array_repr, set_printoptions, get_printoptions -// -// Notes -// ----- -// If a formatter is specified for a certain type, the `precision` keyword is -// ignored for that type. -// -// This is a very flexible function; `array_repr` and `array_str` are using -// `array2string` internally so keywords with the same name should work -// identically in all three functions. -// -// Examples -// -------- -// >>> x = np.array([1e-16,1,2,3]) -// >>> np.array2string(x, precision=2, separator=',', -// ... suppress_small=True) -// '[0.,1.,2.,3.]' -// -// >>> x = np.arange(3.) -// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) -// '[0.00 1.00 2.00]' -// -// >>> x = np.arange(3) -// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) -// '[0x0 0x1 0x2]' -// -// -// -//go:linkname Array2string py.array2string -func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object -// -// Return the current callback function used on floating-point errors. -// -// When the error handling for a floating-point error (one of "divide", -// "over", "under", or "invalid") is set to 'call' or 'log', the function -// that is called or the log instance that is written to is returned by -// `geterrcall`. This function or log instance has been set with -// `seterrcall`. -// -// Returns -// ------- -// errobj : callable, log instance or None -// The current error handler. If no handler was set through `seterrcall`, -// ``None`` is returned. -// -// See Also -// -------- -// seterrcall, seterr, geterr -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> np.geterrcall() # we did not yet set a handler, returns None -// -// >>> oldsettings = np.seterr(all='call') -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// >>> oldhandler = np.seterrcall(err_handler) -// >>> np.array([1, 2, 3]) / 0.0 -// Floating point error (divide by zero), with flag 1 -// array([inf, inf, inf]) -// -// >>> cur_handler = np.geterrcall() -// >>> cur_handler is err_handler -// True -// -// -// -//go:linkname Geterrcall py.geterrcall -func Geterrcall() *py.Object -// -// Insert values along the given axis before the given indices. -// -// Parameters -// ---------- -// arr : array_like -// Input array. -// obj : int, slice or sequence of ints -// Object that defines the index or indices before which `values` is -// inserted. -// -// .. versionadded:: 1.8.0 -// -// Support for multiple insertions when `obj` is a single scalar or a -// sequence with one element (similar to calling insert multiple -// times). -// values : array_like -// Values to insert into `arr`. If the type of `values` is different -// from that of `arr`, `values` is converted to the type of `arr`. -// `values` should be shaped so that ``arr[...,obj,...] = values`` -// is legal. -// axis : int, optional -// Axis along which to insert `values`. If `axis` is None then `arr` -// is flattened first. -// -// Returns -// ------- -// out : ndarray -// A copy of `arr` with `values` inserted. Note that `insert` -// does not occur in-place: a new array is returned. If -// `axis` is None, `out` is a flattened array. -// -// See Also -// -------- -// append : Append elements at the end of an array. -// concatenate : Join a sequence of arrays along an existing axis. -// delete : Delete elements from an array. -// -// Notes -// ----- -// Note that for higher dimensional inserts ``obj=0`` behaves very different -// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from -// ``arr[:,[0],:] = values``. -// -// Examples -// -------- -// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) -// >>> a -// array([[1, 1], -// [2, 2], -// [3, 3]]) -// >>> np.insert(a, 1, 5) -// array([1, 5, 1, ..., 2, 3, 3]) -// >>> np.insert(a, 1, 5, axis=1) -// array([[1, 5, 1], -// [2, 5, 2], -// [3, 5, 3]]) -// -// Difference between sequence and scalars: -// -// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) -// array([[1, 1, 1], -// [2, 2, 2], -// [3, 3, 3]]) -// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), -// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) -// True -// -// >>> b = a.flatten() -// >>> b -// array([1, 1, 2, 2, 3, 3]) -// >>> np.insert(b, [2, 2], [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, slice(2, 4), [5, 6]) -// array([1, 1, 5, ..., 2, 3, 3]) -// -// >>> np.insert(b, [2, 2], [7.13, False]) # type casting -// array([1, 1, 7, ..., 2, 3, 3]) -// -// >>> x = np.arange(8).reshape(2, 4) -// >>> idx = (1, 3) -// >>> np.insert(x, idx, 999, axis=1) -// array([[ 0, 999, 1, 2, 999, 3], -// [ 4, 999, 5, 6, 999, 7]]) -// -// -// -//go:linkname Insert py.insert -func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object -// -// An array with ones at and below the given diagonal and zeros elsewhere. -// -// Parameters -// ---------- -// N : int -// Number of rows in the array. -// M : int, optional -// Number of columns in the array. -// By default, `M` is taken equal to `N`. -// k : int, optional -// The sub-diagonal at and below which the array is filled. -// `k` = 0 is the main diagonal, while `k` < 0 is below it, -// and `k` > 0 is above. The default is 0. -// dtype : dtype, optional -// Data type of the returned array. The default is float. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// tri : ndarray of shape (N, M) -// Array with its lower triangle filled with ones and zero elsewhere; -// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. -// -// Examples -// -------- -// >>> np.tri(3, 5, 2, dtype=int) -// array([[1, 1, 1, 0, 0], -// [1, 1, 1, 1, 0], -// [1, 1, 1, 1, 1]]) -// -// >>> np.tri(3, 5, -1) -// array([[0., 0., 0., 0., 0.], -// [1., 0., 0., 0., 0.], -// [1., 1., 0., 0., 0.]]) -// -// -// -//go:linkname Tri py.tri -func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object -// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the Heaviside step function. -// -// The Heaviside step function is defined as:: -// -// 0 if x1 < 0 -// heaviside(x1, x2) = x2 if x1 == 0 -// 1 if x1 > 0 -// -// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. -// -// Parameters -// ---------- -// x1 : array_like -// Input values. -// x2 : array_like -// The value of the function when x1 is 0. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// The output array, element-wise Heaviside step function of `x1`. -// This is a scalar if both `x1` and `x2` are scalars. -// -// Notes -// ----- -// .. versionadded:: 1.13.0 -// -// References -// ---------- -// .. Wikipedia, "Heaviside step function", -// https://en.wikipedia.org/wiki/Heaviside_step_function -// -// Examples -// -------- -// >>> np.heaviside([-1.5, 0, 2.0], 0.5) -// array([ 0. , 0.5, 1. ]) -// >>> np.heaviside([-1.5, 0, 2.0], 1) -// array([ 0., 1., 1.]) -// -//go:linkname Heaviside py.heaviside -func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// -// Return the current print options. -// -// Returns -// ------- -// print_opts : dict -// Dictionary of current print options with keys -// -// - precision : int -// - threshold : int -// - edgeitems : int -// - linewidth : int -// - suppress : bool -// - nanstr : str -// - infstr : str -// - formatter : dict of callables -// - sign : str -// -// For a full description of these options, see `set_printoptions`. -// -// See Also -// -------- -// set_printoptions, printoptions, set_string_function -// -// -// -//go:linkname GetPrintoptions py.get_printoptions -func GetPrintoptions() *py.Object -// -// Compute the q-th quantile of the data along the specified axis. -// -// .. versionadded:: 1.15.0 -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Probability or sequence of probabilities for the quantiles to compute. -// Values must be between 0 and 1 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the quantiles are computed. The default is -// to compute the quantile(s) along a flattened version of the array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// quantile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// quantile : scalar or ndarray -// If `q` is a single probability and `axis=None`, then the result -// is a scalar. If multiple probabilies levels are given, first axis of -// the result corresponds to the quantiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// percentile : equivalent to quantile, but with q in the range [0, 100]. -// median : equivalent to ``quantile(..., 0.5)`` -// nanquantile -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is -// the value ``q`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// quantile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=0.5``, the -// same as the minimum if ``q=0.0`` and the same as the maximum if -// ``q=1.0``. -// -// The optional `method` parameter specifies the method to use when the -// desired quantile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the quantile in the sorted sample: -// -// .. math:: -// i + g = q * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method gives continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method gives continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method gives continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.quantile(a, 0.5) -// 3.5 -// >>> np.quantile(a, 0.5, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.quantile(a, 0.5, axis=1) -// array([7., 2.]) -// >>> np.quantile(a, 0.5, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.quantile(a, 0.5, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.quantile(a, 0.5, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// >>> b = a.copy() -// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// See also `numpy.percentile` for a visualization of most methods. -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Quantile py.quantile -func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Protected string evaluation. -// -// Evaluate a string containing a Python literal expression without -// allowing the execution of arbitrary non-literal code. -// -// .. warning:: -// -// This function is identical to :py:meth:`ast.literal_eval` and -// has the same security implications. It may not always be safe -// to evaluate large input strings. -// -// Parameters -// ---------- -// source : str -// The string to evaluate. -// -// Returns -// ------- -// obj : object -// The result of evaluating `source`. -// -// Raises -// ------ -// SyntaxError -// If the code has invalid Python syntax, or if it contains -// non-literal code. -// -// Examples -// -------- -// >>> np.safe_eval('1') -// 1 -// >>> np.safe_eval('[1, 2, 3]') -// [1, 2, 3] -// >>> np.safe_eval('{"foo": ("bar", 10.0)}') -// {'foo': ('bar', 10.0)} -// -// >>> np.safe_eval('import os') -// Traceback (most recent call last): -// ... -// SyntaxError: invalid syntax -// -// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') -// Traceback (most recent call last): -// ... -// ValueError: malformed node or string: <_ast.Call object at 0x...> -// -// -// -//go:linkname SafeEval py.safe_eval -func SafeEval(source *py.Object) *py.Object -// -// Find the set difference of two arrays. -// -// Return the unique values in `ar1` that are not in `ar2`. -// -// Parameters -// ---------- -// ar1 : array_like -// Input array. -// ar2 : array_like -// Input comparison array. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setdiff1d : ndarray -// 1D array of values in `ar1` that are not in `ar2`. The result -// is sorted when `assume_unique=False`, but otherwise only sorted -// if the input is sorted. -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4, 1]) -// >>> b = np.array([3, 4, 5, 6]) -// >>> np.setdiff1d(a, b) -// array([1, 2]) -// -// -// -//go:linkname Setdiff1d py.setdiff1d -func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// -// Calculates ``element in test_elements``, broadcasting over `element` only. -// Returns a boolean array of the same shape as `element` that is True -// where an element of `element` is in `test_elements` and False otherwise. -// -// Parameters -// ---------- -// element : array_like -// Input array. -// test_elements : array_like -// The values against which to test each value of `element`. -// This argument is flattened if it is an array or array_like. -// See notes for behavior with non-array-like parameters. -// assume_unique : bool, optional -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// invert : bool, optional -// If True, the values in the returned array are inverted, as if -// calculating `element not in test_elements`. Default is False. -// ``np.isin(a, b, invert=True)`` is equivalent to (but faster -// than) ``np.invert(np.isin(a, b))``. -// kind : {None, 'sort', 'table'}, optional -// The algorithm to use. This will not affect the final result, -// but will affect the speed and memory use. The default, None, -// will select automatically based on memory considerations. -// -// * If 'sort', will use a mergesort-based approach. This will have -// a memory usage of roughly 6 times the sum of the sizes of -// `ar1` and `ar2`, not accounting for size of dtypes. -// * If 'table', will use a lookup table approach similar -// to a counting sort. This is only available for boolean and -// integer arrays. This will have a memory usage of the -// size of `ar1` plus the max-min value of `ar2`. `assume_unique` -// has no effect when the 'table' option is used. -// * If None, will automatically choose 'table' if -// the required memory allocation is less than or equal to -// 6 times the sum of the sizes of `ar1` and `ar2`, -// otherwise will use 'sort'. This is done to not use -// a large amount of memory by default, even though -// 'table' may be faster in most cases. If 'table' is chosen, -// `assume_unique` will have no effect. -// -// -// Returns -// ------- -// isin : ndarray, bool -// Has the same shape as `element`. The values `element[isin]` -// are in `test_elements`. -// -// See Also -// -------- -// in1d : Flattened version of this function. -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Notes -// ----- -// -// `isin` is an element-wise function version of the python keyword `in`. -// ``isin(a, b)`` is roughly equivalent to -// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. -// -// `element` and `test_elements` are converted to arrays if they are not -// already. If `test_elements` is a set (or other non-sequence collection) -// it will be converted to an object array with one element, rather than an -// array of the values contained in `test_elements`. This is a consequence -// of the `array` constructor's way of handling non-sequence collections. -// Converting the set to a list usually gives the desired behavior. -// -// Using ``kind='table'`` tends to be faster than `kind='sort'` if the -// following relationship is true: -// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, -// but may use greater memory. The default value for `kind` will -// be automatically selected based only on memory usage, so one may -// manually set ``kind='table'`` if memory constraints can be relaxed. -// -// .. versionadded:: 1.13.0 -// -// Examples -// -------- -// >>> element = 2*np.arange(4).reshape((2, 2)) -// >>> element -// array([[0, 2], -// [4, 6]]) -// >>> test_elements = [1, 2, 4, 8] -// >>> mask = np.isin(element, test_elements) -// >>> mask -// array([[False, True], -// [ True, False]]) -// >>> element[mask] -// array([2, 4]) -// -// The indices of the matched values can be obtained with `nonzero`: -// -// >>> np.nonzero(mask) -// (array([0, 1]), array([1, 0])) -// -// The test can also be inverted: -// -// >>> mask = np.isin(element, test_elements, invert=True) -// >>> mask -// array([[ True, False], -// [False, True]]) -// >>> element[mask] -// array([0, 6]) -// -// Because of how `array` handles sets, the following does not -// work as expected: -// -// >>> test_set = {1, 2, 4, 8} -// >>> np.isin(element, test_set) -// array([[False, False], -// [False, False]]) -// -// Casting the set to a list gives the expected result: -// -// >>> np.isin(element, list(test_set)) -// array([[False, True], -// [ True, False]]) -// -// -//go:linkname Isin py.isin -func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object -// -// Save an array to a text file. -// -// Parameters -// ---------- -// fname : filename or file handle -// If the filename ends in ``.gz``, the file is automatically saved in -// compressed gzip format. `loadtxt` understands gzipped files -// transparently. -// X : 1D or 2D array_like -// Data to be saved to a text file. -// fmt : str or sequence of strs, optional -// A single format (%10.5f), a sequence of formats, or a -// multi-format string, e.g. 'Iteration %d -- %10.5f', in which -// case `delimiter` is ignored. For complex `X`, the legal options -// for `fmt` are: -// -// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted -// like `' (%s+%sj)' % (fmt, fmt)` -// * a full string specifying every real and imaginary part, e.g. -// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns -// * a list of specifiers, one per column - in this case, the real -// and imaginary part must have separate specifiers, -// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns -// delimiter : str, optional -// String or character separating columns. -// newline : str, optional -// String or character separating lines. -// -// .. versionadded:: 1.5.0 -// header : str, optional -// String that will be written at the beginning of the file. -// -// .. versionadded:: 1.7.0 -// footer : str, optional -// String that will be written at the end of the file. -// -// .. versionadded:: 1.7.0 -// comments : str, optional -// String that will be prepended to the ``header`` and ``footer`` strings, -// to mark them as comments. Default: '# ', as expected by e.g. -// ``numpy.loadtxt``. -// -// .. versionadded:: 1.7.0 -// encoding : {None, str}, optional -// Encoding used to encode the outputfile. Does not apply to output -// streams. If the encoding is something other than 'bytes' or 'latin1' -// you will not be able to load the file in NumPy versions < 1.14. Default -// is 'latin1'. -// -// .. versionadded:: 1.14.0 -// -// -// See Also -// -------- -// save : Save an array to a binary file in NumPy ``.npy`` format -// savez : Save several arrays into an uncompressed ``.npz`` archive -// savez_compressed : Save several arrays into a compressed ``.npz`` archive -// -// Notes -// ----- -// Further explanation of the `fmt` parameter -// (``%[flag]width[.precision]specifier``): -// -// flags: -// ``-`` : left justify -// -// ``+`` : Forces to precede result with + or -. -// -// ``0`` : Left pad the number with zeros instead of space (see width). -// -// width: -// Minimum number of characters to be printed. The value is not truncated -// if it has more characters. -// -// precision: -// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of -// digits. -// - For ``e, E`` and ``f`` specifiers, the number of digits to print -// after the decimal point. -// - For ``g`` and ``G``, the maximum number of significant digits. -// - For ``s``, the maximum number of characters. -// -// specifiers: -// ``c`` : character -// -// ``d`` or ``i`` : signed decimal integer -// -// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. -// -// ``f`` : decimal floating point -// -// ``g,G`` : use the shorter of ``e,E`` or ``f`` -// -// ``o`` : signed octal -// -// ``s`` : string of characters -// -// ``u`` : unsigned decimal integer -// -// ``x,X`` : unsigned hexadecimal integer -// -// This explanation of ``fmt`` is not complete, for an exhaustive -// specification see [1]_. -// -// References -// ---------- -// .. [1] `Format Specification Mini-Language -// `_, -// Python Documentation. -// -// Examples -// -------- -// >>> x = y = z = np.arange(0.0,5.0,1.0) -// >>> np.savetxt('test.out', x, delimiter=',') # X is an array -// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays -// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation -// -// -// -//go:linkname Savetxt py.savetxt -func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object -// -// unpackbits(a, /, axis=None, count=None, bitorder='big') -// -// Unpacks elements of a uint8 array into a binary-valued output array. -// -// Each element of `a` represents a bit-field that should be unpacked -// into a binary-valued output array. The shape of the output array is -// either 1-D (if `axis` is ``None``) or the same shape as the input -// array with unpacking done along the axis specified. -// -// Parameters -// ---------- -// a : ndarray, uint8 type -// Input array. -// axis : int, optional -// The dimension over which bit-unpacking is done. -// ``None`` implies unpacking the flattened array. -// count : int or None, optional -// The number of elements to unpack along `axis`, provided as a way -// of undoing the effect of packing a size that is not a multiple -// of eight. A non-negative number means to only unpack `count` -// bits. A negative number means to trim off that many bits from -// the end. ``None`` means to unpack the entire array (the -// default). Counts larger than the available number of bits will -// add zero padding to the output. Negative counts must not -// exceed the available number of bits. -// -// .. versionadded:: 1.17.0 -// -// bitorder : {'big', 'little'}, optional -// The order of the returned bits. 'big' will mimic bin(val), -// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse -// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. -// Defaults to 'big'. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// unpacked : ndarray, uint8 type -// The elements are binary-valued (0 or 1). -// -// See Also -// -------- -// packbits : Packs the elements of a binary-valued array into bits in -// a uint8 array. -// -// Examples -// -------- -// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) -// >>> a -// array([[ 2], -// [ 7], -// [23]], dtype=uint8) -// >>> b = np.unpackbits(a, axis=1) -// >>> b -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) -// >>> c = np.unpackbits(a, axis=1, count=-3) -// >>> c -// array([[0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0], -// [0, 0, 0, 1, 0]], dtype=uint8) -// -// >>> p = np.packbits(b, axis=0) -// >>> np.unpackbits(p, axis=0) -// array([[0, 0, 0, 0, 0, 0, 1, 0], -// [0, 0, 0, 0, 0, 1, 1, 1], -// [0, 0, 0, 1, 0, 1, 1, 1], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0], -// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) -// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) -// True -// -// -// -//go:linkname Unpackbits py.unpackbits -func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object -// -// Return a sorted copy of an array. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// axis : int or None, optional -// Axis along which to sort. If None, the array is flattened before -// sorting. The default is -1, which sorts along the last axis. -// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional -// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' -// and 'mergesort' use timsort or radix sort under the covers and, in general, -// the actual implementation will vary with data type. The 'mergesort' option -// is retained for backwards compatibility. -// -// .. versionchanged:: 1.15.0. -// The 'stable' option was added. -// -// order : str or list of str, optional -// When `a` is an array with fields defined, this argument specifies -// which fields to compare first, second, etc. A single field can -// be specified as a string, and not all fields need be specified, -// but unspecified fields will still be used, in the order in which -// they come up in the dtype, to break ties. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// ndarray.sort : Method to sort an array in-place. -// argsort : Indirect sort. -// lexsort : Indirect stable sort on multiple keys. -// searchsorted : Find elements in a sorted array. -// partition : Partial sort. -// -// Notes -// ----- -// The various sorting algorithms are characterized by their average speed, -// worst case performance, work space size, and whether they are stable. A -// stable sort keeps items with the same key in the same relative -// order. The four algorithms implemented in NumPy have the following -// properties: -// -// =========== ======= ============= ============ ======== -// kind speed worst case work space stable -// =========== ======= ============= ============ ======== -// 'quicksort' 1 O(n^2) 0 no -// 'heapsort' 3 O(n*log(n)) 0 no -// 'mergesort' 2 O(n*log(n)) ~n/2 yes -// 'timsort' 2 O(n*log(n)) ~n/2 yes -// =========== ======= ============= ============ ======== -// -// .. note:: The datatype determines which of 'mergesort' or 'timsort' -// is actually used, even if 'mergesort' is specified. User selection -// at a finer scale is not currently available. -// -// All the sort algorithms make temporary copies of the data when -// sorting along any but the last axis. Consequently, sorting along -// the last axis is faster and uses less space than sorting along -// any other axis. -// -// The sort order for complex numbers is lexicographic. If both the real -// and imaginary parts are non-nan then the order is determined by the -// real parts except when they are equal, in which case the order is -// determined by the imaginary parts. -// -// Previous to numpy 1.4.0 sorting real and complex arrays containing nan -// values led to undefined behaviour. In numpy versions >= 1.4.0 nan -// values are sorted to the end. The extended sort order is: -// -// * Real: [R, nan] -// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] -// -// where R is a non-nan real value. Complex values with the same nan -// placements are sorted according to the non-nan part if it exists. -// Non-nan values are sorted as before. -// -// .. versionadded:: 1.12.0 -// -// quicksort has been changed to `introsort `_. -// When sorting does not make enough progress it switches to -// `heapsort `_. -// This implementation makes quicksort O(n*log(n)) in the worst case. -// -// 'stable' automatically chooses the best stable sorting algorithm -// for the data type being sorted. -// It, along with 'mergesort' is currently mapped to -// `timsort `_ -// or `radix sort `_ -// depending on the data type. -// API forward compatibility currently limits the -// ability to select the implementation and it is hardwired for the different -// data types. -// -// .. versionadded:: 1.17.0 -// -// Timsort is added for better performance on already or nearly -// sorted data. On random data timsort is almost identical to -// mergesort. It is now used for stable sort while quicksort is still the -// default sort if none is chosen. For timsort details, refer to -// `CPython listsort.txt `_. -// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an -// O(n) sort instead of O(n log n). -// -// .. versionchanged:: 1.18.0 -// -// NaT now sorts to the end of arrays for consistency with NaN. -// -// Examples -// -------- -// >>> a = np.array([[1,4],[3,1]]) -// >>> np.sort(a) # sort along the last axis -// array([[1, 4], -// [1, 3]]) -// >>> np.sort(a, axis=None) # sort the flattened array -// array([1, 1, 3, 4]) -// >>> np.sort(a, axis=0) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// Use the `order` keyword to specify a field to use when sorting a -// structured array: -// -// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] -// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), -// ... ('Galahad', 1.7, 38)] -// >>> a = np.array(values, dtype=dtype) # create a structured array -// >>> np.sort(a, order='height') # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), -// ('Lancelot', 1.8999999999999999, 38)], -// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP -// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), -// ('Arthur', 1.8, 41)], -// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) -// >>> a -// array([[1, 2], -// [3, 4]]) -// >>> np.transpose(a) -// array([[1, 3], -// [2, 4]]) -// -// >>> a = np.array([1, 2, 3, 4]) -// >>> a -// array([1, 2, 3, 4]) -// >>> np.transpose(a) -// array([1, 2, 3, 4]) -// -// >>> a = np.ones((1, 2, 3)) -// >>> np.transpose(a, (1, 0, 2)).shape -// (2, 1, 3) -// -// >>> a = np.ones((2, 3, 4, 5)) -// >>> np.transpose(a).shape -// (5, 4, 3, 2) -// -// -// -//go:linkname Transpose py.transpose -func Transpose(a *py.Object, axes *py.Object) *py.Object -// -// Roll the specified axis backwards, until it lies in a given position. -// -// This function continues to be supported for backward compatibility, but you -// should prefer `moveaxis`. The `moveaxis` function was added in NumPy -// 1.11. -// -// Parameters -// ---------- -// a : ndarray -// Input array. -// axis : int -// The axis to be rolled. The positions of the other axes do not -// change relative to one another. -// start : int, optional -// When ``start <= axis``, the axis is rolled back until it lies in -// this position. When ``start > axis``, the axis is rolled until it -// lies before this position. The default, 0, results in a "complete" -// roll. The following table describes how negative values of ``start`` -// are interpreted: -// -// .. table:: -// :align: left -// -// +-------------------+----------------------+ -// | ``start`` | Normalized ``start`` | -// +===================+======================+ -// | ``-(arr.ndim+1)`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// | ``-arr.ndim`` | 0 | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``-1`` | ``arr.ndim-1`` | -// +-------------------+----------------------+ -// | ``0`` | ``0`` | -// +-------------------+----------------------+ -// | |vdots| | |vdots| | -// +-------------------+----------------------+ -// | ``arr.ndim`` | ``arr.ndim`` | -// +-------------------+----------------------+ -// | ``arr.ndim + 1`` | raise ``AxisError`` | -// +-------------------+----------------------+ -// -// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis -// -// Returns -// ------- -// res : ndarray -// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier -// NumPy versions a view of `a` is returned only if the order of the -// axes is changed, otherwise the input array is returned. -// -// See Also -// -------- -// moveaxis : Move array axes to new positions. -// roll : Roll the elements of an array by a number of positions along a -// given axis. -// -// Examples -// -------- -// >>> a = np.ones((3,4,5,6)) -// >>> np.rollaxis(a, 3, 1).shape -// (3, 6, 4, 5) -// >>> np.rollaxis(a, 2).shape -// (5, 3, 4, 6) -// >>> np.rollaxis(a, 1, 4).shape -// (3, 5, 6, 4) -// -// -// -//go:linkname Rollaxis py.rollaxis -func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object -// -// Returns a boolean array where two arrays are element-wise equal within a -// tolerance. -// -// The tolerance values are positive, typically very small numbers. The -// relative difference (`rtol` * abs(`b`)) and the absolute difference -// `atol` are added together to compare against the absolute difference -// between `a` and `b`. -// -// .. warning:: The default `atol` is not appropriate for comparing numbers -// that are much smaller than one (see Notes). -// -// Parameters -// ---------- -// a, b : array_like -// Input arrays to compare. -// rtol : float -// The relative tolerance parameter (see Notes). -// atol : float -// The absolute tolerance parameter (see Notes). -// equal_nan : bool -// Whether to compare NaN's as equal. If True, NaN's in `a` will be -// considered equal to NaN's in `b` in the output array. -// -// Returns -// ------- -// y : array_like -// Returns a boolean array of where `a` and `b` are equal within the -// given tolerance. If both `a` and `b` are scalars, returns a single -// boolean value. -// -// See Also -// -------- -// allclose -// math.isclose -// -// Notes -// ----- -// .. versionadded:: 1.7.0 -// -// For finite values, isclose uses the following equation to test whether -// two floating point values are equivalent. -// -// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) -// -// Unlike the built-in `math.isclose`, the above equation is not symmetric -// in `a` and `b` -- it assumes `b` is the reference value -- so that -// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, -// the default value of atol is not zero, and is used to determine what -// small values should be considered close to zero. The default value is -// appropriate for expected values of order unity: if the expected values -// are significantly smaller than one, it can result in false positives. -// `atol` should be carefully selected for the use case at hand. A zero value -// for `atol` will result in `False` if either `a` or `b` is zero. -// -// `isclose` is not defined for non-numeric data types. -// `bool` is considered a numeric data-type for this purpose. -// -// Examples -// -------- -// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) -// array([ True, False]) -// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) -// array([ True, True]) -// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) -// array([False, True]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) -// array([ True, False]) -// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) -// array([ True, True]) -// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) -// array([ True, False]) -// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) -// array([False, False]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) -// array([ True, True]) -// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) -// array([False, True]) -// -// -//go:linkname Isclose py.isclose -func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object -// -// Returns the indices of the minimum values along an axis. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// By default, the index is into the flattened array, otherwise -// along the specified axis. -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the array. -// -// .. versionadded:: 1.22.0 -// -// Returns -// ------- -// index_array : ndarray of ints -// Array of indices into the array. It has the same shape as `a.shape` -// with the dimension along `axis` removed. If `keepdims` is set to True, -// then the size of `axis` will be 1 with the resulting array having same -// shape as `a.shape`. -// -// See Also -// -------- -// ndarray.argmin, argmax -// amin : The minimum value along a given axis. -// unravel_index : Convert a flat index into an index tuple. -// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` -// from argmin to an array as if by calling min. -// -// Notes -// ----- -// In case of multiple occurrences of the minimum values, the indices -// corresponding to the first occurrence are returned. -// -// Examples -// -------- -// >>> a = np.arange(6).reshape(2,3) + 10 -// >>> a -// array([[10, 11, 12], -// [13, 14, 15]]) -// >>> np.argmin(a) -// 0 -// >>> np.argmin(a, axis=0) -// array([0, 0, 0]) -// >>> np.argmin(a, axis=1) -// array([0, 0]) -// -// Indices of the minimum elements of a N-dimensional array: -// -// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) -// >>> ind -// (0, 0) -// >>> a[ind] -// 10 -// -// >>> b = np.arange(6) + 10 -// >>> b[4] = 10 -// >>> b -// array([10, 11, 12, 13, 10, 15]) -// >>> np.argmin(b) # Only the first occurrence is returned. -// 0 -// -// >>> x = np.array([[4,2,3], [1,0,3]]) -// >>> index_array = np.argmin(x, axis=-1) -// >>> # Same as np.amin(x, axis=-1, keepdims=True) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) -// array([[2], -// [0]]) -// >>> # Same as np.amax(x, axis=-1) -// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) -// array([2, 0]) -// -// Setting `keepdims` to `True`, -// -// >>> x = np.arange(24).reshape((2, 3, 4)) -// >>> res = np.argmin(x, axis=1, keepdims=True) -// >>> res.shape -// (2, 1, 4) -// -// -//go:linkname Argmin py.argmin -func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object -// -// Round an array to the given number of decimals. -// -// `around` is an alias of `~numpy.round`. -// -// See Also -// -------- -// ndarray.round : equivalent method -// round : alias for this function -// ceil, fix, floor, rint, trunc -// -// -// -//go:linkname Around py.around -func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object -// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the absolute values element-wise. -// -// This function returns the absolute values (positive magnitude) of the -// data in `x`. Complex values are not handled, use `absolute` to find the -// absolute values of complex data. -// -// Parameters -// ---------- -// x : array_like -// The array of numbers for which the absolute values are required. If -// `x` is a scalar, the result `y` will also be a scalar. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The absolute values of `x`, the returned values are always floats. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// absolute : Absolute values including `complex` types. -// -// Examples -// -------- -// >>> np.fabs(-1) -// 1.0 -// >>> np.fabs([-1.2, 1.2]) -// array([ 1.2, 1.2]) -// -//go:linkname Fabs py.fabs -func Fabs(x *py.Object, out *py.Object) *py.Object -// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the element-wise remainder of division. -// -// Computes the remainder complementary to the `floor_divide` function. It is -// equivalent to the Python modulus operator``x1 % x2`` and has the same sign -// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` -// is ``mod``. -// -// .. warning:: -// -// This should not be confused with: -// -// * Python 3.7's `math.remainder` and C's ``remainder``, which -// computes the IEEE remainder, which are the complement to -// ``round(x1 / x2)``. -// * The MATLAB ``rem`` function and or the C ``%`` operator which is the -// complement to ``int(x1 / x2)``. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// floor_divide : Equivalent of Python ``//`` operator. -// divmod : Simultaneous floor division and remainder. -// fmod : Equivalent of the MATLAB ``rem`` function. -// divide, floor -// -// Notes -// ----- -// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) -// integers. -// ``mod`` is an alias of ``remainder``. -// -// Examples -// -------- -// >>> np.remainder([4, 7], [2, 3]) -// array([0, 1]) -// >>> np.remainder(np.arange(7), 5) -// array([0, 1, 2, 3, 4, 0, 1]) -// -// The ``%`` operator can be used as a shorthand for ``np.remainder`` on -// ndarrays. -// -// >>> x1 = np.arange(7) -// >>> x1 % 5 -// array([0, 1, 2, 3, 4, 0, 1]) -// -//go:linkname Mod py.mod -func Mod(__llgo_va_list ...interface{}) *py.Object -// asfortranarray(a, dtype=None, *, like=None) -// -// Return an array (ndim >= 1) laid out in Fortran order in memory. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// dtype : str or dtype object, optional -// By default, the data-type is inferred from the input data. -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// The input `a` in Fortran, or column-major, order. -// -// See Also -// -------- -// ascontiguousarray : Convert input to a contiguous (C order) array. -// asanyarray : Convert input to an ndarray with either row or -// column-major memory order. -// require : Return an ndarray that satisfies requirements. -// ndarray.flags : Information about the memory layout of the array. -// -// Examples -// -------- -// Starting with a C-contiguous array: -// -// >>> x = np.ones((2, 3), order='C') -// >>> x.flags['C_CONTIGUOUS'] -// True -// -// Calling ``asfortranarray`` makes a Fortran-contiguous copy: -// -// >>> y = np.asfortranarray(x) -// >>> y.flags['F_CONTIGUOUS'] -// True -// >>> np.may_share_memory(x, y) -// False -// -// Now, starting with a Fortran-contiguous array: -// -// >>> x = np.ones((2, 3), order='F') -// >>> x.flags['F_CONTIGUOUS'] -// True -// -// Then, calling ``asfortranarray`` returns the same object: -// -// >>> y = np.asfortranarray(x) -// >>> x is y -// True -// -// Note: This function returns an array with at least one-dimension (1-d) -// so it will not preserve 0-d arrays. -// -//go:linkname Asfortranarray py.asfortranarray -func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object -// -// Return the number of dimensions of an array. -// -// Parameters -// ---------- -// a : array_like -// Input array. If it is not already an ndarray, a conversion is -// attempted. -// -// Returns -// ------- -// number_of_dimensions : int -// The number of dimensions in `a`. Scalars are zero-dimensional. -// -// See Also -// -------- -// ndarray.ndim : equivalent method -// shape : dimensions of array -// ndarray.shape : dimensions of array -// -// Examples -// -------- -// >>> np.ndim([[1,2,3],[4,5,6]]) -// 2 -// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) -// 2 -// >>> np.ndim(1) -// 0 -// -// -// -//go:linkname Ndim py.ndim -func Ndim(a *py.Object) *py.Object -// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` -// -// Parameters -// ---------- -// x1, x2 : array_like, int -// Arrays of values. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// -// Returns -// ------- -// y : ndarray or scalar -// The lowest common multiple of the absolute value of the inputs -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// gcd : The greatest common divisor -// -// Examples -// -------- -// >>> np.lcm(12, 20) -// 60 -// >>> np.lcm.reduce([3, 12, 20]) -// 60 -// >>> np.lcm.reduce([40, 12, 20]) -// 120 -// >>> np.lcm(np.arange(6), 20) -// array([ 0, 20, 20, 60, 20, 20]) -// -//go:linkname Lcm py.lcm -func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the reciprocal of the argument, element-wise. -// -// Calculates ``1/x``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// Return array. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// .. note:: -// This function is not designed to work with integers. -// -// For integer arguments with absolute value larger than 1 the result is -// always zero because of the way Python handles integer division. For -// integer zero the result is an overflow. -// -// Examples -// -------- -// >>> np.reciprocal(2.) -// 0.5 -// >>> np.reciprocal([1, 2., 3.33]) -// array([ 1. , 0.5 , 0.3003003]) -// -//go:linkname Reciprocal py.reciprocal -func Reciprocal(x *py.Object, out *py.Object) *py.Object -// -// Integrate along the given axis using the composite trapezoidal rule. -// -// If `x` is provided, the integration happens in sequence along its -// elements - they are not sorted. -// -// Integrate `y` (`x`) along each 1d slice on the given axis, compute -// :math:`\int y(x) dx`. -// When `x` is specified, this integrates along the parametric curve, -// computing :math:`\int_t y(t) dt = -// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. -// -// Parameters -// ---------- -// y : array_like -// Input array to integrate. -// x : array_like, optional -// The sample points corresponding to the `y` values. If `x` is None, -// the sample points are assumed to be evenly spaced `dx` apart. The -// default is None. -// dx : scalar, optional -// The spacing between sample points when `x` is None. The default is 1. -// axis : int, optional -// The axis along which to integrate. -// -// Returns -// ------- -// trapz : float or ndarray -// Definite integral of `y` = n-dimensional array as approximated along -// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, -// then the result is a float. If `n` is greater than 1, then the result -// is an `n`-1 dimensional array. -// -// See Also -// -------- -// sum, cumsum -// -// Notes -// ----- -// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points -// will be taken from `y` array, by default x-axis distances between -// points will be 1.0, alternatively they can be provided with `x` array -// or with `dx` scalar. Return value will be equal to combined area under -// the red lines. -// -// -// References -// ---------- -// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule -// -// .. [2] Illustration image: -// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png -// -// Examples -// -------- -// Use the trapezoidal rule on evenly spaced points: -// -// >>> np.trapz([1, 2, 3]) -// 4.0 -// -// The spacing between sample points can be selected by either the -// ``x`` or ``dx`` arguments: -// -// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) -// 8.0 -// >>> np.trapz([1, 2, 3], dx=2) -// 8.0 -// -// Using a decreasing ``x`` corresponds to integrating in reverse: -// -// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) -// -8.0 -// -// More generally ``x`` is used to integrate along a parametric curve. We can -// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: -// -// >>> x = np.linspace(0, 1, num=50) -// >>> y = x**2 -// >>> np.trapz(y, x) -// 0.33340274885464394 -// -// Or estimate the area of a circle, noting we repeat the sample which closes -// the curve: -// -// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) -// >>> np.trapz(np.cos(theta), x=np.sin(theta)) -// 3.141571941375841 -// -// ``np.trapz`` can be applied along a specified axis to do multiple -// computations in one call: -// -// >>> a = np.arange(6).reshape(2, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5]]) -// >>> np.trapz(a, axis=0) -// array([1.5, 2.5, 3.5]) -// >>> np.trapz(a, axis=1) -// array([2., 8.]) -// -// -//go:linkname Trapz py.trapz -func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object -// -// Reverse the order of elements along axis 1 (left/right). -// -// For a 2-D array, this flips the entries in each row in the left/right -// direction. Columns are preserved, but appear in a different order than -// before. -// -// Parameters -// ---------- -// m : array_like -// Input array, must be at least 2-D. -// -// Returns -// ------- -// f : ndarray -// A view of `m` with the columns reversed. Since a view -// is returned, this operation is :math:`\mathcal O(1)`. -// -// See Also -// -------- -// flipud : Flip array in the up/down direction. -// flip : Flip array in one or more dimensions. -// rot90 : Rotate array counterclockwise. -// -// Notes -// ----- -// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. -// Requires the array to be at least 2-D. -// -// Examples -// -------- -// >>> A = np.diag([1.,2.,3.]) -// >>> A -// array([[1., 0., 0.], -// [0., 2., 0.], -// [0., 0., 3.]]) -// >>> np.fliplr(A) -// array([[0., 0., 1.], -// [0., 2., 0.], -// [3., 0., 0.]]) -// -// >>> A = np.random.randn(2,3,5) -// >>> np.all(np.fliplr(A) == A[:,::-1,...]) -// True -// -// -// -//go:linkname Fliplr py.fliplr -func Fliplr(m *py.Object) *py.Object -// -// Issues a DeprecationWarning, adds warning to `old_name`'s -// docstring, rebinds ``old_name.__name__`` and returns the new -// function object. -// -// This function may also be used as a decorator. -// -// Parameters -// ---------- -// func : function -// The function to be deprecated. -// old_name : str, optional -// The name of the function to be deprecated. Default is None, in -// which case the name of `func` is used. -// new_name : str, optional -// The new name for the function. Default is None, in which case the -// deprecation message is that `old_name` is deprecated. If given, the -// deprecation message is that `old_name` is deprecated and `new_name` -// should be used instead. -// message : str, optional -// Additional explanation of the deprecation. Displayed in the -// docstring after the warning. -// -// Returns -// ------- -// old_func : function -// The deprecated function. -// -// Examples -// -------- -// Note that ``olduint`` returns a value after printing Deprecation -// Warning: -// -// >>> olduint = np.deprecate(np.uint) -// DeprecationWarning: `uint64` is deprecated! # may vary -// >>> olduint(6) -// 6 -// -// -// -//go:linkname Deprecate py.deprecate -func Deprecate(__llgo_va_list ...interface{}) *py.Object -// -// Find the intersection of two arrays. -// -// Return the sorted, unique values that are in both of the input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. Will be flattened if not already 1D. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not -// unique, incorrect results and out-of-bounds indices could result. -// Default is False. -// return_indices : bool -// If True, the indices which correspond to the intersection of the two -// arrays are returned. The first instance of a value is used if there are -// multiple. Default is False. -// -// .. versionadded:: 1.15.0 -// -// Returns -// ------- -// intersect1d : ndarray -// Sorted 1D array of common and unique elements. -// comm1 : ndarray -// The indices of the first occurrences of the common values in `ar1`. -// Only provided if `return_indices` is True. -// comm2 : ndarray -// The indices of the first occurrences of the common values in `ar2`. -// Only provided if `return_indices` is True. -// -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// -// Examples -// -------- -// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) -// array([1, 3]) -// -// To intersect more than two arrays, use functools.reduce: -// -// >>> from functools import reduce -// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) -// array([3]) -// -// To return the indices of the values common to the input arrays -// along with the intersected values: -// -// >>> x = np.array([1, 1, 2, 3, 4]) -// >>> y = np.array([2, 1, 4, 6]) -// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) -// >>> x_ind, y_ind -// (array([0, 2, 4]), array([1, 0, 2])) -// >>> xy, x[x_ind], y[y_ind] -// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) -// -// -// -//go:linkname Intersect1d py.intersect1d -func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object -// -// min_scalar_type(a, /) -// -// For scalar ``a``, returns the data type with the smallest size -// and smallest scalar kind which can hold its value. For non-scalar -// array ``a``, returns the vector's dtype unmodified. -// -// Floating point values are not demoted to integers, -// and complex values are not demoted to floats. -// -// Parameters -// ---------- -// a : scalar or array_like -// The value whose minimal data type is to be found. -// -// Returns -// ------- -// out : dtype -// The minimal data type. -// -// Notes -// ----- -// .. versionadded:: 1.6.0 -// -// See Also -// -------- -// result_type, promote_types, dtype, can_cast -// -// Examples -// -------- -// >>> np.min_scalar_type(10) -// dtype('uint8') -// -// >>> np.min_scalar_type(-260) -// dtype('int16') -// -// >>> np.min_scalar_type(3.1) -// dtype('float16') -// -// >>> np.min_scalar_type(1e50) -// dtype('float64') -// -// >>> np.min_scalar_type(np.arange(4,dtype='f8')) -// dtype('float64') -// -// -// -//go:linkname MinScalarType py.min_scalar_type -func MinScalarType(a *py.Object) *py.Object -// -// Return the indices of the elements that are non-zero. -// -// Returns a tuple of arrays, one for each dimension of `a`, -// containing the indices of the non-zero elements in that -// dimension. The values in `a` are always tested and returned in -// row-major, C-style order. -// -// To group the indices by element, rather than dimension, use `argwhere`, -// which returns a row for each non-zero element. -// -// .. note:: -// -// When called on a zero-d array or scalar, ``nonzero(a)`` is treated -// as ``nonzero(atleast_1d(a))``. -// -// .. deprecated:: 1.17.0 -// -// Use `atleast_1d` explicitly if this behavior is deliberate. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// -// Returns -// ------- -// tuple_of_arrays : tuple -// Indices of elements that are non-zero. -// -// See Also -// -------- -// flatnonzero : -// Return indices that are non-zero in the flattened version of the input -// array. -// ndarray.nonzero : -// Equivalent ndarray method. -// count_nonzero : -// Counts the number of non-zero elements in the input array. -// -// Notes -// ----- -// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is -// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which -// will correctly handle 0-d arrays. -// -// Examples -// -------- -// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) -// >>> x -// array([[3, 0, 0], -// [0, 4, 0], -// [5, 6, 0]]) -// >>> np.nonzero(x) -// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) -// -// >>> x[np.nonzero(x)] -// array([3, 4, 5, 6]) -// >>> np.transpose(np.nonzero(x)) -// array([[0, 0], -// [1, 1], -// [2, 0], -// [2, 1]]) -// -// A common use for ``nonzero`` is to find the indices of an array, where -// a condition is True. Given an array `a`, the condition `a` > 3 is a -// boolean array and since False is interpreted as 0, np.nonzero(a > 3) -// yields the indices of the `a` where the condition is true. -// -// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) -// >>> a > 3 -// array([[False, False, False], -// [ True, True, True], -// [ True, True, True]]) -// >>> np.nonzero(a > 3) -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// Using this result to index `a` is equivalent to using the mask directly: -// -// >>> a[np.nonzero(a > 3)] -// array([4, 5, 6, 7, 8, 9]) -// >>> a[a > 3] # prefer this spelling -// array([4, 5, 6, 7, 8, 9]) -// -// ``nonzero`` can also be called as a method of the array. -// -// >>> (a > 3).nonzero() -// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) -// -// -// -//go:linkname Nonzero py.nonzero -func Nonzero(a *py.Object) *py.Object -// -// Compute the median along the specified axis, while ignoring NaNs. -// -// Returns the median of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array. -// axis : {int, sequence of int, None}, optional -// Axis or axes along which the medians are computed. The default -// is to compute the median along a flattened version of the array. -// A sequence of axes is supported since version 1.9.0. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow use of memory of input array `a` for -// calculations. The input array will be modified by the call to -// `median`. This will save memory when you do not need to preserve -// the contents of the input array. Treat the input as undefined, -// but it will probably be fully or partially sorted. Default is -// False. If `overwrite_input` is ``True`` and `a` is not already an -// `ndarray`, an error will be raised. -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left -// in the result as dimensions with size one. With this option, -// the result will broadcast correctly against the original `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// Returns -// ------- -// median : ndarray -// A new array holding the result. If the input contains integers -// or floats smaller than ``float64``, then the output data-type is -// ``np.float64``. Otherwise, the data-type of the output is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean, median, percentile -// -// Notes -// ----- -// Given a vector ``V`` of length ``N``, the median of ``V`` is the -// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., -// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two -// middle values of ``V_sorted`` when ``N`` is even. -// -// Examples -// -------- -// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) -// >>> a[0, 1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.median(a) -// nan -// >>> np.nanmedian(a) -// 3.0 -// >>> np.nanmedian(a, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.median(a, axis=1) -// array([nan, 2.]) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// >>> b = a.copy() -// >>> np.nanmedian(b, axis=None, overwrite_input=True) -// 3.0 -// >>> assert not np.all(a==b) -// -// -// -//go:linkname Nanmedian py.nanmedian -func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object -// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the element-wise square of the input. -// -// Parameters -// ---------- -// x : array_like -// Input data. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise `x*x`, of the same shape and dtype as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// numpy.linalg.matrix_power -// sqrt -// power -// -// Examples -// -------- -// >>> np.square([-1j, 1]) -// array([-1.-0.j, 1.+0.j]) -// -//go:linkname Square py.square -func Square(x *py.Object, out *py.Object) *py.Object -// -// Construct an open mesh from multiple sequences. -// -// This function takes N 1-D sequences and returns N outputs with N -// dimensions each, such that the shape is 1 in all but one dimension -// and the dimension with the non-unit shape value cycles through all -// N dimensions. -// -// Using `ix_` one can quickly construct index arrays that will index -// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array -// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. -// -// Parameters -// ---------- -// args : 1-D sequences -// Each sequence should be of integer or boolean type. -// Boolean sequences will be interpreted as boolean masks for the -// corresponding dimension (equivalent to passing in -// ``np.nonzero(boolean_sequence)``). -// -// Returns -// ------- -// out : tuple of ndarrays -// N arrays with N dimensions each, with N the number of input -// sequences. Together these arrays form an open mesh. -// -// See Also -// -------- -// ogrid, mgrid, meshgrid -// -// Examples -// -------- -// >>> a = np.arange(10).reshape(2, 5) -// >>> a -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> ixgrid = np.ix_([0, 1], [2, 4]) -// >>> ixgrid -// (array([[0], -// [1]]), array([[2, 4]])) -// >>> ixgrid[0].shape, ixgrid[1].shape -// ((2, 1), (1, 2)) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// >>> ixgrid = np.ix_([True, True], [2, 4]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) -// >>> a[ixgrid] -// array([[2, 4], -// [7, 9]]) -// -// -// -//go:linkname Ix_ py.ix_ -func Ix_(__llgo_va_list ...interface{}) *py.Object -// -// Return the normalized sinc function. -// -// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument -// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not -// only everywhere continuous but also infinitely differentiable. -// -// .. note:: -// -// Note the normalization factor of ``pi`` used in the definition. -// This is the most commonly used definition in signal processing. -// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function -// :math:`\sin(x)/x` that is more common in mathematics. -// -// Parameters -// ---------- -// x : ndarray -// Array (possibly multi-dimensional) of values for which to calculate -// ``sinc(x)``. -// -// Returns -// ------- -// out : ndarray -// ``sinc(x)``, which has the same shape as the input. -// -// Notes -// ----- -// The name sinc is short for "sine cardinal" or "sinus cardinalis". -// -// The sinc function is used in various signal processing applications, -// including in anti-aliasing, in the construction of a Lanczos resampling -// filter, and in interpolation. -// -// For bandlimited interpolation of discrete-time signals, the ideal -// interpolation kernel is proportional to the sinc function. -// -// References -// ---------- -// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web -// Resource. http://mathworld.wolfram.com/SincFunction.html -// .. [2] Wikipedia, "Sinc function", -// https://en.wikipedia.org/wiki/Sinc_function -// -// Examples -// -------- -// >>> import matplotlib.pyplot as plt -// >>> x = np.linspace(-4, 4, 41) -// >>> np.sinc(x) -// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, -// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, -// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, -// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, -// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, -// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, -// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, -// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -// -4.92362781e-02, -3.89804309e-17]) -// -// >>> plt.plot(x, np.sinc(x)) -// [] -// >>> plt.title("Sinc Function") -// Text(0.5, 1.0, 'Sinc Function') -// >>> plt.ylabel("Amplitude") -// Text(0, 0.5, 'Amplitude') -// >>> plt.xlabel("X") -// Text(0.5, 0, 'X') -// >>> plt.show() -// -// -// -//go:linkname Sinc py.sinc -func Sinc(x *py.Object) *py.Object -// -// Return the roots of a polynomial with coefficients given in p. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// The values in the rank-1 array `p` are coefficients of a polynomial. -// If the length of `p` is n+1 then the polynomial is described by:: -// -// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] -// -// Parameters -// ---------- -// p : array_like -// Rank-1 array of polynomial coefficients. -// -// Returns -// ------- -// out : ndarray -// An array containing the roots of the polynomial. -// -// Raises -// ------ -// ValueError -// When `p` cannot be converted to a rank-1 array. -// -// See also -// -------- -// poly : Find the coefficients of a polynomial with a given sequence -// of roots. -// polyval : Compute polynomial values. -// polyfit : Least squares polynomial fit. -// poly1d : A one-dimensional polynomial class. -// -// Notes -// ----- -// The algorithm relies on computing the eigenvalues of the -// companion matrix [1]_. -// -// References -// ---------- -// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: -// Cambridge University Press, 1999, pp. 146-7. -// -// Examples -// -------- -// >>> coeff = [3.2, 2, 1] -// >>> np.roots(coeff) -// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) -// -// -// -//go:linkname Roots py.roots -func Roots(p *py.Object) *py.Object -// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) -// -// Create nditers for use in nested loops -// -// Create a tuple of `nditer` objects which iterate in nested loops over -// different axes of the op argument. The first iterator is used in the -// outermost loop, the last in the innermost loop. Advancing one will change -// the subsequent iterators to point at its new element. -// -// Parameters -// ---------- -// op : ndarray or sequence of array_like -// The array(s) to iterate over. -// -// axes : list of list of int -// Each item is used as an "op_axes" argument to an nditer -// -// flags, op_flags, op_dtypes, order, casting, buffersize (optional) -// See `nditer` parameters of the same name -// -// Returns -// ------- -// iters : tuple of nditer -// An nditer for each item in `axes`, outermost first -// -// See Also -// -------- -// nditer -// -// Examples -// -------- -// -// Basic usage. Note how y is the "flattened" version of -// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified -// the first iter's axes as [1] -// -// >>> a = np.arange(12).reshape(2, 3, 2) -// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) -// >>> for x in i: -// ... print(i.multi_index) -// ... for y in j: -// ... print('', j.multi_index, y) -// (0,) -// (0, 0) 0 -// (0, 1) 1 -// (1, 0) 6 -// (1, 1) 7 -// (1,) -// (0, 0) 2 -// (0, 1) 3 -// (1, 0) 8 -// (1, 1) 9 -// (2,) -// (0, 0) 4 -// (0, 1) 5 -// (1, 0) 10 -// (1, 1) 11 -// -//go:linkname NestedIters py.nested_iters -func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object -// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Inverse hyperbolic tangent element-wise. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Array of the same shape as `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// emath.arctanh -// -// Notes -// ----- -// `arctanh` is a multivalued function: for each `x` there are infinitely -// many numbers `z` such that ``tanh(z) = x``. The convention is to return -// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. -// -// For real-valued input data types, `arctanh` always returns real output. -// For each value that cannot be expressed as a real number or infinity, -// it yields ``nan`` and sets the `invalid` floating point error flag. -// -// For complex-valued input, `arctanh` is a complex analytical function -// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from -// above on the former and from below on the latter. -// -// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. -// -// References -// ---------- -// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", -// 10th printing, 1964, pp. 86. -// https://personal.math.ubc.ca/~cbm/aands/page_86.htm -// .. [2] Wikipedia, "Inverse hyperbolic function", -// https://en.wikipedia.org/wiki/Arctanh -// -// Examples -// -------- -// >>> np.arctanh([0, -0.5]) -// array([ 0. , -0.54930614]) -// -//go:linkname Arctanh py.arctanh -func Arctanh(x *py.Object, out *py.Object) *py.Object -// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns element-wise True where signbit is set (less than zero). -// -// Parameters -// ---------- -// x : array_like -// The input value(s). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// result : ndarray of bool -// Output array, or reference to `out` if that was supplied. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> np.signbit(-1.2) -// True -// >>> np.signbit(np.array([1, -2.3, 2.1])) -// array([False, True, False]) -// -//go:linkname Signbit py.signbit -func Signbit(x *py.Object, out *py.Object) *py.Object -// -// Change elements of an array based on conditional and input values. -// -// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that -// `place` uses the first N elements of `vals`, where N is the number of -// True values in `mask`, while `copyto` uses the elements where `mask` -// is True. -// -// Note that `extract` does the exact opposite of `place`. -// -// Parameters -// ---------- -// arr : ndarray -// Array to put data into. -// mask : array_like -// Boolean mask array. Must have the same size as `a`. -// vals : 1-D sequence -// Values to put into `a`. Only the first N elements are used, where -// N is the number of True values in `mask`. If `vals` is smaller -// than N, it will be repeated, and if elements of `a` are to be masked, -// this sequence must be non-empty. -// -// See Also -// -------- -// copyto, put, take, extract -// -// Examples -// -------- -// >>> arr = np.arange(6).reshape(2, 3) -// >>> np.place(arr, arr>2, [44, 55]) -// >>> arr -// array([[ 0, 1, 2], -// [44, 55, 44]]) -// -// -// -//go:linkname Place py.place -func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object -// -// Returns True if the type of `element` is a scalar type. -// -// Parameters -// ---------- -// element : any -// Input argument, can be of any type and shape. -// -// Returns -// ------- -// val : bool -// True if `element` is a scalar type, False if it is not. -// -// See Also -// -------- -// ndim : Get the number of dimensions of an array -// -// Notes -// ----- -// If you need a stricter way to identify a *numerical* scalar, use -// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most -// non-numerical elements such as strings. -// -// In most cases ``np.ndim(x) == 0`` should be used instead of this function, -// as that will also return true for 0d arrays. This is how numpy overloads -// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` -// argument to `histogram`. Some key differences: -// -// +--------------------------------------+---------------+-------------------+ -// | x |``isscalar(x)``|``np.ndim(x) == 0``| -// +======================================+===============+===================+ -// | PEP 3141 numeric objects (including | ``True`` | ``True`` | -// | builtins) | | | -// +--------------------------------------+---------------+-------------------+ -// | builtin string and buffer objects | ``True`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other builtin objects, like | ``False`` | ``True`` | -// | `pathlib.Path`, `Exception`, | | | -// | the result of `re.compile` | | | -// +--------------------------------------+---------------+-------------------+ -// | third-party objects like | ``False`` | ``True`` | -// | `matplotlib.figure.Figure` | | | -// +--------------------------------------+---------------+-------------------+ -// | zero-dimensional numpy arrays | ``False`` | ``True`` | -// +--------------------------------------+---------------+-------------------+ -// | other numpy arrays | ``False`` | ``False`` | -// +--------------------------------------+---------------+-------------------+ -// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | -// | objects | | | -// +--------------------------------------+---------------+-------------------+ -// -// Examples -// -------- -// >>> np.isscalar(3.1) -// True -// >>> np.isscalar(np.array(3.1)) -// False -// >>> np.isscalar([3.1]) -// False -// >>> np.isscalar(False) -// True -// >>> np.isscalar('numpy') -// True -// -// NumPy supports PEP 3141 numbers: -// -// >>> from fractions import Fraction -// >>> np.isscalar(Fraction(5, 17)) -// True -// >>> from numbers import Number -// >>> np.isscalar(Number()) -// True -// -// -// -//go:linkname Isscalar py.isscalar -func Isscalar(element *py.Object) *py.Object -// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Shift the bits of an integer to the left. -// -// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. -// Since the internal representation of numbers is in binary format, this -// operation is equivalent to multiplying `x1` by ``2**x2``. -// -// Parameters -// ---------- -// x1 : array_like of integer type -// Input values. -// x2 : array_like of integer type -// Number of zeros to append to `x1`. Has to be non-negative. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : array of integer type -// Return `x1` with bits shifted `x2` times to the left. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// right_shift : Shift the bits of an integer to the right. -// binary_repr : Return the binary representation of the input number -// as a string. -// -// Examples -// -------- -// >>> np.binary_repr(5) -// '101' -// >>> np.left_shift(5, 2) -// 20 -// >>> np.binary_repr(20) -// '10100' -// -// >>> np.left_shift(5, [1,2,3]) -// array([10, 20, 40]) -// -// Note that the dtype of the second argument may change the dtype of the -// result and can lead to unexpected results in some cases (see -// :ref:`Casting Rules `): -// -// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 -// >>> print(a, type(a)) # Unexpected result due to upcasting -// 510 -// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) -// >>> print(b, type(b)) -// 254 -// -// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on -// ndarrays. -// -// >>> x1 = 5 -// >>> x2 = np.array([1, 2, 3]) -// >>> x1 << x2 -// array([10, 20, 40]) -// -//go:linkname LeftShift py.left_shift -func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return (x1 != x2) element-wise. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Input arrays. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Output array, element-wise comparison of `x1` and `x2`. -// Typically of type bool, unless ``dtype=object`` is passed. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// equal, greater, greater_equal, less, less_equal -// -// Examples -// -------- -// >>> np.not_equal([1.,2.], [1., 3.]) -// array([False, True]) -// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) -// array([[False, True], -// [False, True]]) -// -// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on -// ndarrays. -// -// >>> a = np.array([1., 2.]) -// >>> b = np.array([1., 3.]) -// >>> a != b -// array([False, True]) -// -//go:linkname NotEqual py.not_equal -func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// seterrobj(errobj, /) -// -// Set the object that defines floating-point error handling. -// -// The error object contains all information that defines the error handling -// behavior in NumPy. `seterrobj` is used internally by the other -// functions that set error handling behavior (`seterr`, `seterrcall`). -// -// Parameters -// ---------- -// errobj : list -// The error object, a list containing three elements: -// [internal numpy buffer size, error mask, error callback function]. -// -// The error mask is a single integer that holds the treatment information -// on all four floating point errors. The information for each error type -// is contained in three bits of the integer. If we print it in base 8, we -// can see what treatment is set for "invalid", "under", "over", and -// "divide" (in that order). The printed string can be interpreted with -// -// * 0 : 'ignore' -// * 1 : 'warn' -// * 2 : 'raise' -// * 3 : 'call' -// * 4 : 'print' -// * 5 : 'log' -// -// See Also -// -------- -// geterrobj, seterr, geterr, seterrcall, geterrcall -// getbufsize, setbufsize -// -// Notes -// ----- -// For complete documentation of the types of floating-point exceptions and -// treatment options, see `seterr`. -// -// Examples -// -------- -// >>> old_errobj = np.geterrobj() # first get the defaults -// >>> old_errobj -// [8192, 521, None] -// -// >>> def err_handler(type, flag): -// ... print("Floating point error (%s), with flag %s" % (type, flag)) -// ... -// >>> new_errobj = [20000, 12, err_handler] -// >>> np.seterrobj(new_errobj) -// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') -// '14' -// >>> np.geterr() -// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} -// >>> np.geterrcall() is err_handler -// True -// -//go:linkname Seterrobj py.seterrobj -func Seterrobj(errobj *py.Object) *py.Object -// -// Return the scalar dtype or NumPy equivalent of Python type of an object. -// -// Parameters -// ---------- -// rep : any -// The object of which the type is returned. -// default : any, optional -// If given, this is returned for objects whose types can not be -// determined. If not given, None is returned for those objects. -// -// Returns -// ------- -// dtype : dtype or Python type -// The data type of `rep`. -// -// See Also -// -------- -// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype -// -// Examples -// -------- -// >>> np.obj2sctype(np.int32) -// -// >>> np.obj2sctype(np.array([1., 2.])) -// -// >>> np.obj2sctype(np.array([1.j])) -// -// -// >>> np.obj2sctype(dict) -// -// >>> np.obj2sctype('string') -// -// >>> np.obj2sctype(1, default=list) -// -// -// -// -//go:linkname Obj2sctype py.obj2sctype -func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object -// -// einsum_path(subscripts, *operands, optimize='greedy') -// -// Evaluates the lowest cost contraction order for an einsum expression by -// considering the creation of intermediate arrays. -// -// Parameters -// ---------- -// subscripts : str -// Specifies the subscripts for summation. -// *operands : list of array_like -// These are the arrays for the operation. -// optimize : {bool, list, tuple, 'greedy', 'optimal'} -// Choose the type of path. If a tuple is provided, the second argument is -// assumed to be the maximum intermediate size created. If only a single -// argument is provided the largest input or output array size is used -// as a maximum intermediate size. -// -// * if a list is given that starts with ``einsum_path``, uses this as the -// contraction path -// * if False no optimization is taken -// * if True defaults to the 'greedy' algorithm -// * 'optimal' An algorithm that combinatorially explores all possible -// ways of contracting the listed tensors and chooses the least costly -// path. Scales exponentially with the number of terms in the -// contraction. -// * 'greedy' An algorithm that chooses the best pair contraction -// at each step. Effectively, this algorithm searches the largest inner, -// Hadamard, and then outer products at each step. Scales cubically with -// the number of terms in the contraction. Equivalent to the 'optimal' -// path for most contractions. -// -// Default is 'greedy'. -// -// Returns -// ------- -// path : list of tuples -// A list representation of the einsum path. -// string_repr : str -// A printable representation of the einsum path. -// -// Notes -// ----- -// The resulting path indicates which terms of the input contraction should be -// contracted first, the result of this contraction is then appended to the -// end of the contraction list. This list can then be iterated over until all -// intermediate contractions are complete. -// -// See Also -// -------- -// einsum, linalg.multi_dot -// -// Examples -// -------- -// -// We can begin with a chain dot example. In this case, it is optimal to -// contract the ``b`` and ``c`` tensors first as represented by the first -// element of the path ``(1, 2)``. The resulting tensor is added to the end -// of the contraction and the remaining contraction ``(0, 1)`` is then -// completed. -// -// >>> np.random.seed(123) -// >>> a = np.random.rand(2, 2) -// >>> b = np.random.rand(2, 5) -// >>> c = np.random.rand(5, 2) -// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') -// >>> print(path_info[0]) -// ['einsum_path', (1, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ij,jk,kl->il # may vary -// Naive scaling: 4 -// Optimized scaling: 3 -// Naive FLOP count: 1.600e+02 -// Optimized FLOP count: 5.600e+01 -// Theoretical speedup: 2.857 -// Largest intermediate: 4.000e+00 elements -// ------------------------------------------------------------------------- -// scaling current remaining -// ------------------------------------------------------------------------- -// 3 kl,jk->jl ij,jl->il -// 3 jl,ij->il il->il -// -// -// A more complex index transformation example. -// -// >>> I = np.random.rand(10, 10, 10, 10) -// >>> C = np.random.rand(10, 10) -// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, -// ... optimize='greedy') -// -// >>> print(path_info[0]) -// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] -// >>> print(path_info[1]) -// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary -// Naive scaling: 8 -// Optimized scaling: 5 -// Naive FLOP count: 8.000e+08 -// Optimized FLOP count: 8.000e+05 -// Theoretical speedup: 1000.000 -// Largest intermediate: 1.000e+04 elements -// -------------------------------------------------------------------------- -// scaling current remaining -// -------------------------------------------------------------------------- -// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh -// 5 bcde,fb->cdef gc,hd,cdef->efgh -// 5 cdef,gc->defg hd,defg->efgh -// 5 defg,hd->efgh efgh->efgh -// -// -//go:linkname EinsumPath py.einsum_path -func EinsumPath(__llgo_va_list ...interface{}) *py.Object -// -// Unwrap by taking the complement of large deltas with respect to the period. -// -// This unwraps a signal `p` by changing elements which have an absolute -// difference from their predecessor of more than ``max(discont, period/2)`` -// to their `period`-complementary values. -// -// For the default case where `period` is :math:`2\pi` and `discont` is -// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences -// are never greater than :math:`\pi` by adding :math:`2k\pi` for some -// integer :math:`k`. -// -// Parameters -// ---------- -// p : array_like -// Input array. -// discont : float, optional -// Maximum discontinuity between values, default is ``period/2``. -// Values below ``period/2`` are treated as if they were ``period/2``. -// To have an effect different from the default, `discont` should be -// larger than ``period/2``. -// axis : int, optional -// Axis along which unwrap will operate, default is the last axis. -// period : float, optional -// Size of the range over which the input wraps. By default, it is -// ``2 pi``. -// -// .. versionadded:: 1.21.0 -// -// Returns -// ------- -// out : ndarray -// Output array. -// -// See Also -// -------- -// rad2deg, deg2rad -// -// Notes -// ----- -// If the discontinuity in `p` is smaller than ``period/2``, -// but larger than `discont`, no unwrapping is done because taking -// the complement would only make the discontinuity larger. -// -// Examples -// -------- -// >>> phase = np.linspace(0, np.pi, num=5) -// >>> phase[3:] += np.pi -// >>> phase -// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary -// >>> np.unwrap(phase) -// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary -// >>> np.unwrap([0, 1, 2, -1, 0], period=4) -// array([0, 1, 2, 3, 4]) -// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) -// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) -// array([2, 3, 4, 5, 6, 7, 8, 9]) -// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 -// >>> np.unwrap(phase_deg, period=360) -// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., -// 180., 220., 260., 300., 340., 380., 420., 460., 500., -// 540.]) -// -// -//go:linkname Unwrap py.unwrap -func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object -// -// Function to calculate only the edges of the bins used by the `histogram` -// function. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines the bin edges, including the rightmost -// edge, allowing for non-uniform bin widths. -// -// If `bins` is a string from the list below, `histogram_bin_edges` will use -// the method chosen to calculate the optimal bin width and -// consequently the number of bins (see `Notes` for more detail on -// the estimators) from the data that falls within the requested -// range. While the bin width will be optimal for the actual data -// in the range, the number of bins will be computed to fill the -// entire range, including the empty portions. For visualisation, -// using the 'auto' option is suggested. Weighted data is not -// supported for automated bin size selection. -// -// 'auto' -// Maximum of the 'sturges' and 'fd' estimators. Provides good -// all around performance. -// -// 'fd' (Freedman Diaconis Estimator) -// Robust (resilient to outliers) estimator that takes into -// account data variability and data size. -// -// 'doane' -// An improved version of Sturges' estimator that works better -// with non-normal datasets. -// -// 'scott' -// Less robust estimator that takes into account data variability -// and data size. -// -// 'stone' -// Estimator based on leave-one-out cross-validation estimate of -// the integrated squared error. Can be regarded as a generalization -// of Scott's rule. -// -// 'rice' -// Estimator does not take variability into account, only data -// size. Commonly overestimates number of bins required. -// -// 'sturges' -// R's default method, only accounts for data size. Only -// optimal for gaussian data and underestimates number of bins -// for large non-gaussian datasets. -// -// 'sqrt' -// Square root (of data size) estimator, used by Excel and -// other programs for its speed and simplicity. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). This is currently not used by any of the bin estimators, -// but may be in the future. -// -// Returns -// ------- -// bin_edges : array of dtype float -// The edges to pass into `histogram` -// -// See Also -// -------- -// histogram -// -// Notes -// ----- -// The methods to estimate the optimal number of bins are well founded -// in literature, and are inspired by the choices R provides for -// histogram visualisation. Note that having the number of bins -// proportional to :math:`n^{1/3}` is asymptotically optimal, which is -// why it appears in most estimators. These are simply plug-in methods -// that give good starting points for number of bins. In the equations -// below, :math:`h` is the binwidth and :math:`n_h` is the number of -// bins. All estimators that compute bin counts are recast to bin width -// using the `ptp` of the data. The final bin count is obtained from -// ``np.round(np.ceil(range / h))``. The final bin width is often less -// than what is returned by the estimators below. -// -// 'auto' (maximum of the 'sturges' and 'fd' estimators) -// A compromise to get a good value. For small datasets the Sturges -// value will usually be chosen, while larger datasets will usually -// default to FD. Avoids the overly conservative behaviour of FD -// and Sturges for small and large datasets respectively. -// Switchover point is usually :math:`a.size \approx 1000`. -// -// 'fd' (Freedman Diaconis Estimator) -// .. math:: h = 2 \frac{IQR}{n^{1/3}} -// -// The binwidth is proportional to the interquartile range (IQR) -// and inversely proportional to cube root of a.size. Can be too -// conservative for small datasets, but is quite good for large -// datasets. The IQR is very robust to outliers. -// -// 'scott' -// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} -// -// The binwidth is proportional to the standard deviation of the -// data and inversely proportional to cube root of ``x.size``. Can -// be too conservative for small datasets, but is quite good for -// large datasets. The standard deviation is not very robust to -// outliers. Values are very similar to the Freedman-Diaconis -// estimator in the absence of outliers. -// -// 'rice' -// .. math:: n_h = 2n^{1/3} -// -// The number of bins is only proportional to cube root of -// ``a.size``. It tends to overestimate the number of bins and it -// does not take into account data variability. -// -// 'sturges' -// .. math:: n_h = \log _{2}(n) + 1 -// -// The number of bins is the base 2 log of ``a.size``. This -// estimator assumes normality of data and is too conservative for -// larger, non-normal datasets. This is the default method in R's -// ``hist`` method. -// -// 'doane' -// .. math:: n_h = 1 + \log_{2}(n) + -// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) -// -// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] -// -// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} -// -// An improved version of Sturges' formula that produces better -// estimates for non-normal datasets. This estimator attempts to -// account for the skew of the data. -// -// 'sqrt' -// .. math:: n_h = \sqrt n -// -// The simplest and fastest estimator. Only takes into account the -// data size. -// -// Examples -// -------- -// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) -// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) -// array([0. , 0.25, 0.5 , 0.75, 1. ]) -// >>> np.histogram_bin_edges(arr, bins=2) -// array([0. , 2.5, 5. ]) -// -// For consistency with histogram, an array of pre-computed bins is -// passed through unmodified: -// -// >>> np.histogram_bin_edges(arr, [1, 2]) -// array([1, 2]) -// -// This function allows one set of bins to be computed, and reused across -// multiple histograms: -// -// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') -// >>> shared_bins -// array([0., 1., 2., 3., 4., 5.]) -// -// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) -// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) -// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) -// -// >>> hist_0; hist_1 -// array([1, 1, 0, 1, 0]) -// array([2, 0, 1, 1, 2]) -// -// Which gives more easily comparable results than using separate bins for -// each histogram: -// -// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') -// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') -// >>> hist_0; hist_1 -// array([1, 1, 1]) -// array([2, 1, 1, 2]) -// >>> bins_0; bins_1 -// array([0., 1., 2., 3.]) -// array([0. , 1.25, 2.5 , 3.75, 5. ]) -// -// -// -//go:linkname HistogramBinEdges py.histogram_bin_edges -func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object -// -// shares_memory(a, b, /, max_work=None) -// -// Determine if two arrays share memory. -// -// .. warning:: -// -// This function can be exponentially slow for some inputs, unless -// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. -// If in doubt, use `numpy.may_share_memory` instead. -// -// Parameters -// ---------- -// a, b : ndarray -// Input arrays -// max_work : int, optional -// Effort to spend on solving the overlap problem (maximum number -// of candidate solutions to consider). The following special -// values are recognized: -// -// max_work=MAY_SHARE_EXACT (default) -// The problem is solved exactly. In this case, the function returns -// True only if there is an element shared between the arrays. Finding -// the exact solution may take extremely long in some cases. -// max_work=MAY_SHARE_BOUNDS -// Only the memory bounds of a and b are checked. -// -// Raises -// ------ -// numpy.exceptions.TooHardError -// Exceeded max_work. -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// may_share_memory -// -// Examples -// -------- -// >>> x = np.array([1, 2, 3, 4]) -// >>> np.shares_memory(x, np.array([5, 6, 7])) -// False -// >>> np.shares_memory(x[::2], x) -// True -// >>> np.shares_memory(x[::2], x[1::2]) -// False -// -// Checking whether two arrays share memory is NP-complete, and -// runtime may increase exponentially in the number of -// dimensions. Hence, `max_work` should generally be set to a finite -// number, as it is possible to construct examples that take -// extremely long to run: -// -// >>> from numpy.lib.stride_tricks import as_strided -// >>> x = np.zeros([192163377], dtype=np.int8) -// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) -// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) -// >>> np.shares_memory(x1, x2, max_work=1000) -// Traceback (most recent call last): -// ... -// numpy.exceptions.TooHardError: Exceeded max_work -// -// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes -// around 1 minute for this case. It is possible to find problems -// that take still significantly longer. -// -// -// -//go:linkname SharesMemory py.shares_memory -func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object -// -// Return evenly spaced numbers over a specified interval. -// -// Returns `num` evenly spaced samples, calculated over the -// interval [`start`, `stop`]. -// -// The endpoint of the interval can optionally be excluded. -// -// .. versionchanged:: 1.16.0 -// Non-scalar `start` and `stop` are now supported. -// -// .. versionchanged:: 1.20.0 -// Values are rounded towards ``-inf`` instead of ``0`` when an -// integer ``dtype`` is specified. The old behavior can -// still be obtained with ``np.linspace(start, stop, num).astype(int)`` -// -// Parameters -// ---------- -// start : array_like -// The starting value of the sequence. -// stop : array_like -// The end value of the sequence, unless `endpoint` is set to False. -// In that case, the sequence consists of all but the last of ``num + 1`` -// evenly spaced samples, so that `stop` is excluded. Note that the step -// size changes when `endpoint` is False. -// num : int, optional -// Number of samples to generate. Default is 50. Must be non-negative. -// endpoint : bool, optional -// If True, `stop` is the last sample. Otherwise, it is not included. -// Default is True. -// retstep : bool, optional -// If True, return (`samples`, `step`), where `step` is the spacing -// between samples. -// dtype : dtype, optional -// The type of the output array. If `dtype` is not given, the data type -// is inferred from `start` and `stop`. The inferred dtype will never be -// an integer; `float` is chosen even if the arguments would produce an -// array of integers. -// -// .. versionadded:: 1.9.0 -// -// axis : int, optional -// The axis in the result to store the samples. Relevant only if start -// or stop are array-like. By default (0), the samples will be along a -// new axis inserted at the beginning. Use -1 to get an axis at the end. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// samples : ndarray -// There are `num` equally spaced samples in the closed interval -// ``[start, stop]`` or the half-open interval ``[start, stop)`` -// (depending on whether `endpoint` is True or False). -// step : float, optional -// Only returned if `retstep` is True -// -// Size of spacing between samples. -// -// -// See Also -// -------- -// arange : Similar to `linspace`, but uses a step size (instead of the -// number of samples). -// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log -// scale (a geometric progression). -// logspace : Similar to `geomspace`, but with the end points specified as -// logarithms. -// :ref:`how-to-partition` -// -// Examples -// -------- -// >>> np.linspace(2.0, 3.0, num=5) -// array([2. , 2.25, 2.5 , 2.75, 3. ]) -// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) -// array([2. , 2.2, 2.4, 2.6, 2.8]) -// >>> np.linspace(2.0, 3.0, num=5, retstep=True) -// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) -// -// Graphical illustration: -// -// >>> import matplotlib.pyplot as plt -// >>> N = 8 -// >>> y = np.zeros(N) -// >>> x1 = np.linspace(0, 10, N, endpoint=True) -// >>> x2 = np.linspace(0, 10, N, endpoint=False) -// >>> plt.plot(x1, y, 'o') -// [] -// >>> plt.plot(x2, y + 0.5, 'o') -// [] -// >>> plt.ylim([-0.5, 1]) -// (-0.5, 1) -// >>> plt.show() -// -// -// -//go:linkname Linspace py.linspace -func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object -// -// Find the product of two polynomials. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Finds the polynomial resulting from the multiplication of the two input -// polynomials. Each input must be either a poly1d object or a 1D sequence -// of polynomial coefficients, from highest to lowest degree. -// -// Parameters -// ---------- -// a1, a2 : array_like or poly1d object -// Input polynomials. -// -// Returns -// ------- -// out : ndarray or poly1d object -// The polynomial resulting from the multiplication of the inputs. If -// either inputs is a poly1d object, then the output is also a poly1d -// object. Otherwise, it is a 1D array of polynomial coefficients from -// highest to lowest degree. -// -// See Also -// -------- -// poly1d : A one-dimensional polynomial class. -// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval -// convolve : Array convolution. Same output as polymul, but has parameter -// for overlap mode. -// -// Examples -// -------- -// >>> np.polymul([1, 2, 3], [9, 5, 1]) -// array([ 9, 23, 38, 17, 3]) -// -// Using poly1d objects: -// -// >>> p1 = np.poly1d([1, 2, 3]) -// >>> p2 = np.poly1d([9, 5, 1]) -// >>> print(p1) -// 2 -// 1 x + 2 x + 3 -// >>> print(p2) -// 2 -// 9 x + 5 x + 1 -// >>> print(np.polymul(p1, p2)) -// 4 3 2 -// 9 x + 23 x + 38 x + 17 x + 3 -// -// -// -//go:linkname Polymul py.polymul -func Polymul(a1 *py.Object, a2 *py.Object) *py.Object -// -// Print information about various resources in the system -// including available intrinsic support and BLAS/LAPACK library -// in use -// -// .. versionadded:: 1.24.0 -// -// See Also -// -------- -// show_config : Show libraries in the system on which NumPy was built. -// -// Notes -// ----- -// 1. Information is derived with the help of `threadpoolctl `_ -// library if available. -// 2. SIMD related information is derived from ``__cpu_features__``, -// ``__cpu_baseline__`` and ``__cpu_dispatch__`` -// -// -// -//go:linkname ShowRuntime py.show_runtime -func ShowRuntime() *py.Object -// -// Construct an array from an index array and a list of arrays to choose from. -// -// First of all, if confused or uncertain, definitely look at the Examples - -// in its full generality, this function is less simple than it might -// seem from the following code description (below ndi = -// `numpy.lib.index_tricks`): -// -// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. -// -// But this omits some subtleties. Here is a fully general summary: -// -// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays -// (`choices`), `a` and each choice array are first broadcast, as necessary, -// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = -// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` -// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as -// follows: -// -// * if ``mode='raise'`` (the default), then, first of all, each element of -// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose -// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` -// position in ``Ba`` - then the value at the same position in the new array -// is the value in ``Bchoices[i]`` at that same position; -// -// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) -// integer; modular arithmetic is used to map integers outside the range -// `[0, n-1]` back into that range; and then the new array is constructed -// as above; -// -// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) -// integer; negative integers are mapped to 0; values greater than ``n-1`` -// are mapped to ``n-1``; and then the new array is constructed as above. -// -// Parameters -// ---------- -// a : int array -// This array must contain integers in ``[0, n-1]``, where ``n`` is the -// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which -// cases any integers are permissible. -// choices : sequence of arrays -// Choice arrays. `a` and all of the choices must be broadcastable to the -// same shape. If `choices` is itself an array (not recommended), then -// its outermost dimension (i.e., the one corresponding to -// ``choices.shape[0]``) is taken as defining the "sequence". -// out : array, optional -// If provided, the result will be inserted into this array. It should -// be of the appropriate shape and dtype. Note that `out` is always -// buffered if ``mode='raise'``; use other modes for better performance. -// mode : {'raise' (default), 'wrap', 'clip'}, optional -// Specifies how indices outside ``[0, n-1]`` will be treated: -// -// * 'raise' : an exception is raised -// * 'wrap' : value becomes value mod ``n`` -// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 -// -// Returns -// ------- -// merged_array : array -// The merged result. -// -// Raises -// ------ -// ValueError: shape mismatch -// If `a` and each choice array are not all broadcastable to the same -// shape. -// -// See Also -// -------- -// ndarray.choose : equivalent method -// numpy.take_along_axis : Preferable if `choices` is an array -// -// Notes -// ----- -// To reduce the chance of misinterpretation, even though the following -// "abuse" is nominally supported, `choices` should neither be, nor be -// thought of as, a single array, i.e., the outermost sequence-like container -// should be either a list or a tuple. -// -// Examples -// -------- -// -// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], -// ... [20, 21, 22, 23], [30, 31, 32, 33]] -// >>> np.choose([2, 3, 1, 0], choices -// ... # the first element of the result will be the first element of the -// ... # third (2+1) "array" in choices, namely, 20; the second element -// ... # will be the second element of the fourth (3+1) choice array, i.e., -// ... # 31, etc. -// ... ) -// array([20, 31, 12, 3]) -// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) -// array([20, 31, 12, 3]) -// >>> # because there are 4 choice arrays -// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) -// array([20, 1, 12, 3]) -// >>> # i.e., 0 -// -// A couple examples illustrating how choose broadcasts: -// -// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] -// >>> choices = [-10, 10] -// >>> np.choose(a, choices) -// array([[ 10, -10, 10], -// [-10, 10, -10], -// [ 10, -10, 10]]) -// -// >>> # With thanks to Anne Archibald -// >>> a = np.array([0, 1]).reshape((2,1,1)) -// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) -// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) -// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 -// array([[[ 1, 1, 1, 1, 1], -// [ 2, 2, 2, 2, 2], -// [ 3, 3, 3, 3, 3]], -// [[-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5], -// [-1, -2, -3, -4, -5]]]) -// -// -// -//go:linkname Choose py.choose -func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object -// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate `2**p` for all `p` in the input array. -// -// Parameters -// ---------- -// x : array_like -// Input values. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Element-wise 2 to the power `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// power -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// -// -// Examples -// -------- -// >>> np.exp2([2, 3]) -// array([ 4., 8.]) -// -//go:linkname Exp2 py.exp2 -func Exp2(x *py.Object, out *py.Object) *py.Object -// -// Return the imaginary part of the complex argument. -// -// Parameters -// ---------- -// val : array_like -// Input array. -// -// Returns -// ------- -// out : ndarray or scalar -// The imaginary component of the complex argument. If `val` is real, -// the type of `val` is used for the output. If `val` has complex -// elements, the returned type is float. -// -// See Also -// -------- -// real, angle, real_if_close -// -// Examples -// -------- -// >>> a = np.array([1+2j, 3+4j, 5+6j]) -// >>> a.imag -// array([2., 4., 6.]) -// >>> a.imag = np.array([8, 10, 12]) -// >>> a -// array([1. +8.j, 3.+10.j, 5.+12.j]) -// >>> np.imag(1 + 1j) -// 1.0 -// -// -// -//go:linkname Imag py.imag -func Imag(val *py.Object) *py.Object -// -// Find the set exclusive-or of two arrays. -// -// Return the sorted, unique values that are in only one (not both) of the -// input arrays. -// -// Parameters -// ---------- -// ar1, ar2 : array_like -// Input arrays. -// assume_unique : bool -// If True, the input arrays are both assumed to be unique, which -// can speed up the calculation. Default is False. -// -// Returns -// ------- -// setxor1d : ndarray -// Sorted 1D array of unique values that are in only one of the input -// arrays. -// -// Examples -// -------- -// >>> a = np.array([1, 2, 3, 2, 4]) -// >>> b = np.array([2, 3, 5, 7, 5]) -// >>> np.setxor1d(a,b) -// array([1, 4, 5, 7]) -// -// -// -//go:linkname Setxor1d py.setxor1d -func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object -// Fill the main diagonal of the given array of any dimensionality. -// -// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of -// locations with indices ``a[i, ..., i]`` all identical. This function -// modifies the input array in-place, it does not return a value. -// -// Parameters -// ---------- -// a : array, at least 2-D. -// Array whose diagonal is to be filled, it gets modified in-place. -// -// val : scalar or array_like -// Value(s) to write on the diagonal. If `val` is scalar, the value is -// written along the diagonal. If array-like, the flattened `val` is -// written along the diagonal, repeating if necessary to fill all -// diagonal entries. -// -// wrap : bool -// For tall matrices in NumPy version up to 1.6.2, the -// diagonal "wrapped" after N columns. You can have this behavior -// with this option. This affects only tall matrices. -// -// See also -// -------- -// diag_indices, diag_indices_from -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// This functionality can be obtained via `diag_indices`, but internally -// this version uses a much faster implementation that never constructs the -// indices and uses simple slicing. -// -// Examples -// -------- -// >>> a = np.zeros((3, 3), int) -// >>> np.fill_diagonal(a, 5) -// >>> a -// array([[5, 0, 0], -// [0, 5, 0], -// [0, 0, 5]]) -// -// The same function can operate on a 4-D array: -// -// >>> a = np.zeros((3, 3, 3, 3), int) -// >>> np.fill_diagonal(a, 4) -// -// We only show a few blocks for clarity: -// -// >>> a[0, 0] -// array([[4, 0, 0], -// [0, 0, 0], -// [0, 0, 0]]) -// >>> a[1, 1] -// array([[0, 0, 0], -// [0, 4, 0], -// [0, 0, 0]]) -// >>> a[2, 2] -// array([[0, 0, 0], -// [0, 0, 0], -// [0, 0, 4]]) -// -// The wrap option affects only tall matrices: -// -// >>> # tall matrices no wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [0, 0, 0]]) -// -// >>> # tall matrices wrap -// >>> a = np.zeros((5, 3), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0], -// [0, 4, 0], -// [0, 0, 4], -// [0, 0, 0], -// [4, 0, 0]]) -// -// >>> # wide matrices -// >>> a = np.zeros((3, 5), int) -// >>> np.fill_diagonal(a, 4, wrap=True) -// >>> a -// array([[4, 0, 0, 0, 0], -// [0, 4, 0, 0, 0], -// [0, 0, 4, 0, 0]]) -// -// The anti-diagonal can be filled by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.zeros((3, 3), int); -// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip -// >>> a -// array([[0, 0, 1], -// [0, 2, 0], -// [3, 0, 0]]) -// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip -// >>> a -// array([[0, 0, 3], -// [0, 2, 0], -// [1, 0, 0]]) -// -// Note that the order in which the diagonal is filled varies depending -// on the flip function. -// -// -//go:linkname FillDiagonal py.fill_diagonal -func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object -// compare_chararrays(a1, a2, cmp, rstrip) -// -// Performs element-wise comparison of two string arrays using the -// comparison operator specified by `cmp_op`. -// -// Parameters -// ---------- -// a1, a2 : array_like -// Arrays to be compared. -// cmp : {"<", "<=", "==", ">=", ">", "!="} -// Type of comparison. -// rstrip : Boolean -// If True, the spaces at the end of Strings are removed before the comparison. -// -// Returns -// ------- -// out : ndarray -// The output array of type Boolean with the same shape as a and b. -// -// Raises -// ------ -// ValueError -// If `cmp_op` is not valid. -// TypeError -// If at least one of `a` or `b` is a non-string array -// -// Examples -// -------- -// >>> a = np.array(["a", "b", "cde"]) -// >>> b = np.array(["a", "a", "dec"]) -// >>> np.compare_chararrays(a, b, ">", True) -// array([False, True, False]) -// -//go:linkname CompareChararrays py.compare_chararrays -func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object -// -// Clip (limit) the values in an array. -// -// Given an interval, values outside the interval are clipped to -// the interval edges. For example, if an interval of ``[0, 1]`` -// is specified, values smaller than 0 become 0, and values larger -// than 1 become 1. -// -// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. -// -// No check is performed to ensure ``a_min < a_max``. -// -// Parameters -// ---------- -// a : array_like -// Array containing elements to clip. -// a_min, a_max : array_like or None -// Minimum and maximum value. If ``None``, clipping is not performed on -// the corresponding edge. Only one of `a_min` and `a_max` may be -// ``None``. Both are broadcast against `a`. -// out : ndarray, optional -// The results will be placed in this array. It may be the input -// array for in-place clipping. `out` must be of the right shape -// to hold the output. Its type is preserved. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// .. versionadded:: 1.17.0 -// -// Returns -// ------- -// clipped_array : ndarray -// An array with the elements of `a`, but where values -// < `a_min` are replaced with `a_min`, and those > `a_max` -// with `a_max`. -// -// See Also -// -------- -// :ref:`ufuncs-output-type` -// -// Notes -// ----- -// When `a_min` is greater than `a_max`, `clip` returns an -// array in which all values are equal to `a_max`, -// as shown in the second example. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, 1, 8) -// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) -// >>> np.clip(a, 8, 1) -// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -// >>> np.clip(a, 3, 6, out=a) -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a -// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) -// >>> a = np.arange(10) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) -// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) -// -// -// -//go:linkname Clip py.clip -func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object -// -// Return specified diagonals. -// -// If `a` is 2-D, returns the diagonal of `a` with the given offset, -// i.e., the collection of elements of the form ``a[i, i+offset]``. If -// `a` has more than two dimensions, then the axes specified by `axis1` -// and `axis2` are used to determine the 2-D sub-array whose diagonal is -// returned. The shape of the resulting array can be determined by -// removing `axis1` and `axis2` and appending an index to the right equal -// to the size of the resulting diagonals. -// -// In versions of NumPy prior to 1.7, this function always returned a new, -// independent array containing a copy of the values in the diagonal. -// -// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, -// but depending on this fact is deprecated. Writing to the resulting -// array continues to work as it used to, but a FutureWarning is issued. -// -// Starting in NumPy 1.9 it returns a read-only view on the original array. -// Attempting to write to the resulting array will produce an error. -// -// In some future release, it will return a read/write view and writing to -// the returned array will alter your original array. The returned array -// will have the same type as the input array. -// -// If you don't write to the array returned by this function, then you can -// just ignore all of the above. -// -// If you depend on the current behavior, then we suggest copying the -// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead -// of just ``np.diagonal(a)``. This will work with both past and future -// versions of NumPy. -// -// Parameters -// ---------- -// a : array_like -// Array from which the diagonals are taken. -// offset : int, optional -// Offset of the diagonal from the main diagonal. Can be positive or -// negative. Defaults to main diagonal (0). -// axis1 : int, optional -// Axis to be used as the first axis of the 2-D sub-arrays from which -// the diagonals should be taken. Defaults to first axis (0). -// axis2 : int, optional -// Axis to be used as the second axis of the 2-D sub-arrays from -// which the diagonals should be taken. Defaults to second axis (1). -// -// Returns -// ------- -// array_of_diagonals : ndarray -// If `a` is 2-D, then a 1-D array containing the diagonal and of the -// same type as `a` is returned unless `a` is a `matrix`, in which case -// a 1-D array rather than a (2-D) `matrix` is returned in order to -// maintain backward compatibility. -// -// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` -// are removed, and a new axis inserted at the end corresponding to the -// diagonal. -// -// Raises -// ------ -// ValueError -// If the dimension of `a` is less than 2. -// -// See Also -// -------- -// diag : MATLAB work-a-like for 1-D and 2-D arrays. -// diagflat : Create diagonal arrays. -// trace : Sum along diagonals. -// -// Examples -// -------- -// >>> a = np.arange(4).reshape(2,2) -// >>> a -// array([[0, 1], -// [2, 3]]) -// >>> a.diagonal() -// array([0, 3]) -// >>> a.diagonal(1) -// array([1]) -// -// A 3-D example: -// -// >>> a = np.arange(8).reshape(2,2,2); a -// array([[[0, 1], -// [2, 3]], -// [[4, 5], -// [6, 7]]]) -// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping -// ... 0, # across the outer(left)-most axis last and -// ... 1) # the "middle" (row) axis first. -// array([[0, 6], -// [1, 7]]) -// -// The sub-arrays whose main diagonals we just obtained; note that each -// corresponds to fixing the right-most (column) axis, and that the -// diagonals are "packed" in rows. -// -// >>> a[:,:,0] # main diagonal is [0 6] -// array([[0, 2], -// [4, 6]]) -// >>> a[:,:,1] # main diagonal is [1 7] -// array([[1, 3], -// [5, 7]]) -// -// The anti-diagonal can be obtained by reversing the order of elements -// using either `numpy.flipud` or `numpy.fliplr`. -// -// >>> a = np.arange(9).reshape(3, 3) -// >>> a -// array([[0, 1, 2], -// [3, 4, 5], -// [6, 7, 8]]) -// >>> np.fliplr(a).diagonal() # Horizontal flip -// array([2, 4, 6]) -// >>> np.flipud(a).diagonal() # Vertical flip -// array([6, 4, 2]) -// -// Note that the order in which the diagonal is retrieved varies depending -// on the flip function. -// -// -//go:linkname Diagonal py.diagonal -func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object -// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the cube-root of an array, element-wise. -// -// .. versionadded:: 1.10.0 -// -// Parameters -// ---------- -// x : array_like -// The values whose cube-roots are required. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// An array of the same shape as `x`, containing the cube -// cube-root of each element in `x`. -// If `out` was provided, `y` is a reference to it. -// This is a scalar if `x` is a scalar. -// -// -// Examples -// -------- -// >>> np.cbrt([1,8,27]) -// array([ 1., 2., 3.]) -// -//go:linkname Cbrt py.cbrt -func Cbrt(x *py.Object, out *py.Object) *py.Object -// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Hyperbolic sine, element-wise. -// -// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or -// ``-1j * np.sin(1j*x)``. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray -// The corresponding hyperbolic sine values. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// If `out` is provided, the function writes the result into it, -// and returns a reference to `out`. (See Examples) -// -// References -// ---------- -// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. -// New York, NY: Dover, 1972, pg. 83. -// -// Examples -// -------- -// >>> np.sinh(0) -// 0.0 -// >>> np.sinh(np.pi*1j/2) -// 1j -// >>> np.sinh(np.pi*1j) # (exact value is 0) -// 1.2246063538223773e-016j -// >>> # Discrepancy due to vagaries of floating point arithmetic. -// -// >>> # Example of providing the optional output parameter -// >>> out1 = np.array([0], dtype='d') -// >>> out2 = np.sinh([0.1], out1) -// >>> out2 is out1 -// True -// -// >>> # Example of ValueError due to provision of shape mis-matched `out` -// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) -// Traceback (most recent call last): -// File "", line 1, in -// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) -// -//go:linkname Sinh py.sinh -func Sinh(x *py.Object, out *py.Object) *py.Object -// -// Return the indices to access the main diagonal of an n-dimensional array. -// -// See `diag_indices` for full details. -// -// Parameters -// ---------- -// arr : array, at least 2-D -// -// See Also -// -------- -// diag_indices -// -// Notes -// ----- -// .. versionadded:: 1.4.0 -// -// Examples -// -------- -// -// Create a 4 by 4 array. -// -// >>> a = np.arange(16).reshape(4, 4) -// >>> a -// array([[ 0, 1, 2, 3], -// [ 4, 5, 6, 7], -// [ 8, 9, 10, 11], -// [12, 13, 14, 15]]) -// -// Get the indices of the diagonal elements. -// -// >>> di = np.diag_indices_from(a) -// >>> di -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// >>> a[di] -// array([ 0, 5, 10, 15]) -// -// This is simply syntactic sugar for diag_indices. -// -// >>> np.diag_indices(a.shape[0]) -// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) -// -// -// -//go:linkname DiagIndicesFrom py.diag_indices_from -func DiagIndicesFrom(arr *py.Object) *py.Object -// -// Return the derivative of the specified order of a polynomial. -// -// .. note:: -// This forms part of the old polynomial API. Since version 1.4, the -// new polynomial API defined in `numpy.polynomial` is preferred. -// A summary of the differences can be found in the -// :doc:`transition guide `. -// -// Parameters -// ---------- -// p : poly1d or sequence -// Polynomial to differentiate. -// A sequence is interpreted as polynomial coefficients, see `poly1d`. -// m : int, optional -// Order of differentiation (default: 1) -// -// Returns -// ------- -// der : poly1d -// A new polynomial representing the derivative. -// -// See Also -// -------- -// polyint : Anti-derivative of a polynomial. -// poly1d : Class for one-dimensional polynomials. -// -// Examples -// -------- -// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: -// -// >>> p = np.poly1d([1,1,1,1]) -// >>> p2 = np.polyder(p) -// >>> p2 -// poly1d([3, 2, 1]) -// -// which evaluates to: -// -// >>> p2(2.) -// 17.0 -// -// We can verify this, approximating the derivative with -// ``(f(x + h) - f(x))/h``: -// -// >>> (p(2. + 0.001) - p(2.)) / 0.001 -// 17.007000999997857 -// -// The fourth-order derivative of a 3rd-order polynomial is zero: -// -// >>> np.polyder(p, 2) -// poly1d([6, 2]) -// >>> np.polyder(p, 3) -// poly1d([6]) -// >>> np.polyder(p, 4) -// poly1d([0]) -// -// -// -//go:linkname Polyder py.polyder -func Polyder(p *py.Object, m *py.Object) *py.Object -// -// Find indices where elements should be inserted to maintain order. -// -// Find the indices into a sorted array `a` such that, if the -// corresponding elements in `v` were inserted before the indices, the -// order of `a` would be preserved. -// -// Assuming that `a` is sorted: -// -// ====== ============================ -// `side` returned index `i` satisfies -// ====== ============================ -// left ``a[i-1] < v <= a[i]`` -// right ``a[i-1] <= v < a[i]`` -// ====== ============================ -// -// Parameters -// ---------- -// a : 1-D array_like -// Input array. If `sorter` is None, then it must be sorted in -// ascending order, otherwise `sorter` must be an array of indices -// that sort it. -// v : array_like -// Values to insert into `a`. -// side : {'left', 'right'}, optional -// If 'left', the index of the first suitable location found is given. -// If 'right', return the last such index. If there is no suitable -// index, return either 0 or N (where N is the length of `a`). -// sorter : 1-D array_like, optional -// Optional array of integer indices that sort array a into ascending -// order. They are typically the result of argsort. -// -// .. versionadded:: 1.7.0 -// -// Returns -// ------- -// indices : int or array of ints -// Array of insertion points with the same shape as `v`, -// or an integer if `v` is a scalar. -// -// See Also -// -------- -// sort : Return a sorted copy of an array. -// histogram : Produce histogram from 1-D data. -// -// Notes -// ----- -// Binary search is used to find the required insertion points. -// -// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing -// `nan` values. The enhanced sort order is documented in `sort`. -// -// This function uses the same algorithm as the builtin python `bisect.bisect_left` -// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, -// which is also vectorized in the `v` argument. -// -// Examples -// -------- -// >>> np.searchsorted([1,2,3,4,5], 3) -// 2 -// >>> np.searchsorted([1,2,3,4,5], 3, side='right') -// 3 -// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) -// array([0, 5, 1, 2]) -// -// -// -//go:linkname Searchsorted py.searchsorted -func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object -// -// Returns True if first argument is a typecode lower/equal in type hierarchy. -// -// This is like the builtin :func:`issubclass`, but for `dtype`\ s. -// -// Parameters -// ---------- -// arg1, arg2 : dtype_like -// `dtype` or object coercible to one -// -// Returns -// ------- -// out : bool -// -// See Also -// -------- -// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. -// issubsctype, issubclass_ -// -// Examples -// -------- -// `issubdtype` can be used to check the type of arrays: -// -// >>> ints = np.array([1, 2, 3], dtype=np.int32) -// >>> np.issubdtype(ints.dtype, np.integer) -// True -// >>> np.issubdtype(ints.dtype, np.floating) -// False -// -// >>> floats = np.array([1, 2, 3], dtype=np.float32) -// >>> np.issubdtype(floats.dtype, np.integer) -// False -// >>> np.issubdtype(floats.dtype, np.floating) -// True -// -// Similar types of different sizes are not subdtypes of each other: -// -// >>> np.issubdtype(np.float64, np.float32) -// False -// >>> np.issubdtype(np.float32, np.float64) -// False -// -// but both are subtypes of `floating`: -// -// >>> np.issubdtype(np.float64, np.floating) -// True -// >>> np.issubdtype(np.float32, np.floating) -// True -// -// For convenience, dtype-like objects are allowed too: -// -// >>> np.issubdtype('S1', np.string_) -// True -// >>> np.issubdtype('i4', np.signedinteger) -// True -// -// -// -//go:linkname Issubdtype py.issubdtype -func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object -// -// unravel_index(indices, shape, order='C') -// -// Converts a flat index or array of flat indices into a tuple -// of coordinate arrays. -// -// Parameters -// ---------- -// indices : array_like -// An integer array whose elements are indices into the flattened -// version of an array of dimensions ``shape``. Before version 1.6.0, -// this function accepted just one index value. -// shape : tuple of ints -// The shape of the array to use for unraveling ``indices``. -// -// .. versionchanged:: 1.16.0 -// Renamed from ``dims`` to ``shape``. -// -// order : {'C', 'F'}, optional -// Determines whether the indices should be viewed as indexing in -// row-major (C-style) or column-major (Fortran-style) order. -// -// .. versionadded:: 1.6.0 -// -// Returns -// ------- -// unraveled_coords : tuple of ndarray -// Each array in the tuple has the same shape as the ``indices`` -// array. -// -// See Also -// -------- -// ravel_multi_index -// -// Examples -// -------- -// >>> np.unravel_index([22, 41, 37], (7,6)) -// (array([3, 6, 6]), array([4, 5, 1])) -// >>> np.unravel_index([31, 41, 13], (7,6), order='F') -// (array([3, 6, 6]), array([4, 5, 1])) -// -// >>> np.unravel_index(1621, (6,7,8,9)) -// (3, 1, 4, 1) -// -// -// -//go:linkname UnravelIndex py.unravel_index -func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object -// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Numerical positive, element-wise. -// -// .. versionadded:: 1.13.0 -// -// Parameters -// ---------- -// x : array_like or scalar -// Input array. -// -// Returns -// ------- -// y : ndarray or scalar -// Returned array or scalar: `y = +x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// Equivalent to `x.copy()`, but only defined for types that support -// arithmetic. -// -// Examples -// -------- -// -// >>> x1 = np.array(([1., -1.])) -// >>> np.positive(x1) -// array([ 1., -1.]) -// -// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on -// ndarrays. -// -// >>> x1 = np.array(([1., -1.])) -// >>> +x1 -// array([ 1., -1.]) -// -//go:linkname Positive py.positive -func Positive(x *py.Object, out *py.Object) *py.Object -// datetime_data(dtype, /) -// -// Get information about the step size of a date or time type. -// -// The returned tuple can be passed as the second argument of `numpy.datetime64` and -// `numpy.timedelta64`. -// -// Parameters -// ---------- -// dtype : dtype -// The dtype object, which must be a `datetime64` or `timedelta64` type. -// -// Returns -// ------- -// unit : str -// The :ref:`datetime unit ` on which this dtype -// is based. -// count : int -// The number of base units in a step. -// -// Examples -// -------- -// >>> dt_25s = np.dtype('timedelta64[25s]') -// >>> np.datetime_data(dt_25s) -// ('s', 25) -// >>> np.array(10, dt_25s).astype('timedelta64[s]') -// array(250, dtype='timedelta64[s]') -// -// The result can be used to construct a datetime that uses the same units -// as a timedelta -// -// >>> np.datetime64('2010', np.datetime_data(dt_25s)) -// numpy.datetime64('2010-01-01T00:00:00','25s') -// -//go:linkname DatetimeData py.datetime_data -func DatetimeData(dtype *py.Object) *py.Object -// -// Set a Python function to be used when pretty printing arrays. -// -// Parameters -// ---------- -// f : function or None -// Function to be used to pretty print arrays. The function should expect -// a single array argument and return a string of the representation of -// the array. If None, the function is reset to the default NumPy function -// to print arrays. -// repr : bool, optional -// If True (default), the function for pretty printing (``__repr__``) -// is set, if False the function that returns the default string -// representation (``__str__``) is set. -// -// See Also -// -------- -// set_printoptions, get_printoptions -// -// Examples -// -------- -// >>> def pprint(arr): -// ... return 'HA! - What are you going to do now?' -// ... -// >>> np.set_string_function(pprint) -// >>> a = np.arange(10) -// >>> a -// HA! - What are you going to do now? -// >>> _ = a -// >>> # [0 1 2 3 4 5 6 7 8 9] -// -// We can reset the function to the default: -// -// >>> np.set_string_function(None) -// >>> a -// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) -// -// `repr` affects either pretty printing or normal string representation. -// Note that ``__repr__`` is still affected by setting ``__str__`` -// because the width of each array element in the returned string becomes -// equal to the length of the result of ``__str__()``. -// -// >>> x = np.arange(4) -// >>> np.set_string_function(lambda x:'random', repr=False) -// >>> x.__str__() -// 'random' -// >>> x.__repr__() -// 'array([0, 1, 2, 3])' -// -// -// -//go:linkname SetStringFunction py.set_string_function -func SetStringFunction(f *py.Object, repr *py.Object) *py.Object -// -// Compute the q-th percentile of the data along the specified axis. -// -// Returns the q-th percentile(s) of the array elements. -// -// Parameters -// ---------- -// a : array_like of real numbers -// Input array or object that can be converted to an array. -// q : array_like of float -// Percentage or sequence of percentages for the percentiles to compute. -// Values must be between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The -// default is to compute the percentile(s) along a flattened -// version of the array. -// -// .. versionchanged:: 1.9.0 -// A tuple of axes is supported -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output, -// but the type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by intermediate -// calculations, to save memory. In this case, the contents of the input -// `a` after this function completes is undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// .. versionadded:: 1.9.0 -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// mean -// median : equivalent to ``percentile(..., 50)`` -// nanpercentile -// quantile : equivalent to percentile, except q in the range [0, 1]. -// -// Notes -// ----- -// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is -// the value ``q/100`` of the way from the minimum to the maximum in a -// sorted copy of ``V``. The values and distances of the two nearest -// neighbors as well as the `method` parameter will determine the -// percentile if the normalized ranking does not match the location of -// ``q`` exactly. This function is the same as the median if ``q=50``, the -// same as the minimum if ``q=0`` and the same as the maximum if -// ``q=100``. -// -// The optional `method` parameter specifies the method to use when the -// desired percentile lies between two indexes ``i`` and ``j = i + 1``. -// In that case, we first determine ``i + g``, a virtual index that lies -// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the -// fractional part of the index. The final result is, then, an interpolation -// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, -// ``i`` and ``j`` are modified using correction constants ``alpha`` and -// ``beta`` whose choices depend on the ``method`` used. Finally, note that -// since Python uses 0-based indexing, the code subtracts another 1 from the -// index internally. -// -// The following formula determines the virtual index ``i + g``, the location -// of the percentile in the sorted sample: -// -// .. math:: -// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha -// -// The different methods then work as follows -// -// inverted_cdf: -// method 1 of H&F [1]_. -// This method gives discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then take i -// -// averaged_inverted_cdf: -// method 2 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 ; then average between bounds -// -// closest_observation: -// method 3 of H&F [1]_. -// This method give discontinuous results: -// -// * if g > 0 ; then take j -// * if g = 0 and index is odd ; then take j -// * if g = 0 and index is even ; then take i -// -// interpolated_inverted_cdf: -// method 4 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 1 -// -// hazen: -// method 5 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1/2 -// * beta = 1/2 -// -// weibull: -// method 6 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 0 -// * beta = 0 -// -// linear: -// method 7 of H&F [1]_. -// This method give continuous results using: -// -// * alpha = 1 -// * beta = 1 -// -// median_unbiased: -// method 8 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is unknown (see reference). -// This method give continuous results using: -// -// * alpha = 1/3 -// * beta = 1/3 -// -// normal_unbiased: -// method 9 of H&F [1]_. -// This method is probably the best method if the sample -// distribution function is known to be normal. -// This method give continuous results using: -// -// * alpha = 3/8 -// * beta = 3/8 -// -// lower: -// NumPy method kept for backwards compatibility. -// Takes ``i`` as the interpolation point. -// -// higher: -// NumPy method kept for backwards compatibility. -// Takes ``j`` as the interpolation point. -// -// nearest: -// NumPy method kept for backwards compatibility. -// Takes ``i`` or ``j``, whichever is nearest. -// -// midpoint: -// NumPy method kept for backwards compatibility. -// Uses ``(i + j) / 2``. -// -// Examples -// -------- -// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) -// >>> a -// array([[10, 7, 4], -// [ 3, 2, 1]]) -// >>> np.percentile(a, 50) -// 3.5 -// >>> np.percentile(a, 50, axis=0) -// array([6.5, 4.5, 2.5]) -// >>> np.percentile(a, 50, axis=1) -// array([7., 2.]) -// >>> np.percentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// -// >>> m = np.percentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.percentile(a, 50, axis=0, out=out) -// array([6.5, 4.5, 2.5]) -// >>> m -// array([6.5, 4.5, 2.5]) -// -// >>> b = a.copy() -// >>> np.percentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a == b) -// -// The different methods can be visualized graphically: -// -// .. plot:: -// -// import matplotlib.pyplot as plt -// -// a = np.arange(4) -// p = np.linspace(0, 100, 6001) -// ax = plt.gca() -// lines = [ -// ('linear', '-', 'C0'), -// ('inverted_cdf', ':', 'C1'), -// # Almost the same as `inverted_cdf`: -// ('averaged_inverted_cdf', '-.', 'C1'), -// ('closest_observation', ':', 'C2'), -// ('interpolated_inverted_cdf', '--', 'C1'), -// ('hazen', '--', 'C3'), -// ('weibull', '-.', 'C4'), -// ('median_unbiased', '--', 'C5'), -// ('normal_unbiased', '-.', 'C6'), -// ] -// for method, style, color in lines: -// ax.plot( -// p, np.percentile(a, p, method=method), -// label=method, linestyle=style, color=color) -// ax.set( -// title='Percentiles for different methods and data: ' + str(a), -// xlabel='Percentile', -// ylabel='Estimated percentile value', -// yticks=a) -// ax.legend(bbox_to_anchor=(1.03, 1)) -// plt.tight_layout() -// plt.show() -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Percentile py.percentile -func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Calculate the n-th discrete difference along the given axis. -// -// The first difference is given by ``out[i] = a[i+1] - a[i]`` along -// the given axis, higher differences are calculated by using `diff` -// recursively. -// -// Parameters -// ---------- -// a : array_like -// Input array -// n : int, optional -// The number of times values are differenced. If zero, the input -// is returned as-is. -// axis : int, optional -// The axis along which the difference is taken, default is the -// last axis. -// prepend, append : array_like, optional -// Values to prepend or append to `a` along axis prior to -// performing the difference. Scalar values are expanded to -// arrays with length 1 in the direction of axis and the shape -// of the input array in along all other axes. Otherwise the -// dimension and shape must match `a` except along axis. -// -// .. versionadded:: 1.16.0 -// -// Returns -// ------- -// diff : ndarray -// The n-th differences. The shape of the output is the same as `a` -// except along `axis` where the dimension is smaller by `n`. The -// type of the output is the same as the type of the difference -// between any two elements of `a`. This is the same as the type of -// `a` in most cases. A notable exception is `datetime64`, which -// results in a `timedelta64` output array. -// -// See Also -// -------- -// gradient, ediff1d, cumsum -// -// Notes -// ----- -// Type is preserved for boolean arrays, so the result will contain -// `False` when consecutive elements are the same and `True` when they -// differ. -// -// For unsigned integer arrays, the results will also be unsigned. This -// should not be surprising, as the result is consistent with -// calculating the difference directly: -// -// >>> u8_arr = np.array([1, 0], dtype=np.uint8) -// >>> np.diff(u8_arr) -// array([255], dtype=uint8) -// >>> u8_arr[1,...] - u8_arr[0,...] -// 255 -// -// If this is not desirable, then the array should be cast to a larger -// integer type first: -// -// >>> i16_arr = u8_arr.astype(np.int16) -// >>> np.diff(i16_arr) -// array([-1], dtype=int16) -// -// Examples -// -------- -// >>> x = np.array([1, 2, 4, 7, 0]) -// >>> np.diff(x) -// array([ 1, 2, 3, -7]) -// >>> np.diff(x, n=2) -// array([ 1, 1, -10]) -// -// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) -// >>> np.diff(x) -// array([[2, 3, 4], -// [5, 1, 2]]) -// >>> np.diff(x, axis=0) -// array([[-1, 2, 0, -2]]) -// -// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) -// >>> np.diff(x) -// array([1, 1], dtype='timedelta64[D]') -// -// -// -//go:linkname Diff py.diff -func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object -// -// Print the NumPy arrays in the given dictionary. -// -// If there is no dictionary passed in or `vardict` is None then returns -// NumPy arrays in the globals() dictionary (all NumPy arrays in the -// namespace). -// -// Parameters -// ---------- -// vardict : dict, optional -// A dictionary possibly containing ndarrays. Default is globals(). -// -// Returns -// ------- -// out : None -// Returns 'None'. -// -// Notes -// ----- -// Prints out the name, shape, bytes and type of all of the ndarrays -// present in `vardict`. -// -// Examples -// -------- -// >>> a = np.arange(10) -// >>> b = np.ones(20) -// >>> np.who() -// Name Shape Bytes Type -// =========================================================== -// a 10 80 int64 -// b 20 160 float64 -// Upper bound on total bytes = 240 -// -// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', -// ... 'idx':5} -// >>> np.who(d) -// Name Shape Bytes Type -// =========================================================== -// x 2 16 float64 -// y 3 24 float64 -// Upper bound on total bytes = 40 -// -// -// -//go:linkname Who py.who -func Who(vardict *py.Object) *py.Object -// -// Find the unique elements of an array. -// -// Returns the sorted unique elements of an array. There are three optional -// outputs in addition to the unique elements: -// -// * the indices of the input array that give the unique values -// * the indices of the unique array that reconstruct the input array -// * the number of times each unique value comes up in the input array -// -// Parameters -// ---------- -// ar : array_like -// Input array. Unless `axis` is specified, this will be flattened if it -// is not already 1-D. -// return_index : bool, optional -// If True, also return the indices of `ar` (along the specified axis, -// if provided, or in the flattened array) that result in the unique array. -// return_inverse : bool, optional -// If True, also return the indices of the unique array (for the specified -// axis, if provided) that can be used to reconstruct `ar`. -// return_counts : bool, optional -// If True, also return the number of times each unique item appears -// in `ar`. -// axis : int or None, optional -// The axis to operate on. If None, `ar` will be flattened. If an integer, -// the subarrays indexed by the given axis will be flattened and treated -// as the elements of a 1-D array with the dimension of the given axis, -// see the notes for more details. Object arrays or structured arrays -// that contain objects are not supported if the `axis` kwarg is used. The -// default is None. -// -// .. versionadded:: 1.13.0 -// -// equal_nan : bool, optional -// If True, collapses multiple NaN values in the return array into one. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// unique : ndarray -// The sorted unique values. -// unique_indices : ndarray, optional -// The indices of the first occurrences of the unique values in the -// original array. Only provided if `return_index` is True. -// unique_inverse : ndarray, optional -// The indices to reconstruct the original array from the -// unique array. Only provided if `return_inverse` is True. -// unique_counts : ndarray, optional -// The number of times each of the unique values comes up in the -// original array. Only provided if `return_counts` is True. -// -// .. versionadded:: 1.9.0 -// -// See Also -// -------- -// numpy.lib.arraysetops : Module with a number of other functions for -// performing set operations on arrays. -// repeat : Repeat elements of an array. -// -// Notes -// ----- -// When an axis is specified the subarrays indexed by the axis are sorted. -// This is done by making the specified axis the first dimension of the array -// (move the axis to the first dimension to keep the order of the other axes) -// and then flattening the subarrays in C order. The flattened subarrays are -// then viewed as a structured type with each element given a label, with the -// effect that we end up with a 1-D array of structured types that can be -// treated in the same way as any other 1-D array. The result is that the -// flattened subarrays are sorted in lexicographic order starting with the -// first element. -// -// .. versionchanged: NumPy 1.21 -// If nan values are in the input array, a single nan is put -// to the end of the sorted unique values. -// -// Also for complex arrays all NaN values are considered equivalent -// (no matter whether the NaN is in the real or imaginary part). -// As the representant for the returned array the smallest one in the -// lexicographical order is chosen - see np.sort for how the lexicographical -// order is defined for complex arrays. -// -// Examples -// -------- -// >>> np.unique([1, 1, 2, 2, 3, 3]) -// array([1, 2, 3]) -// >>> a = np.array([[1, 1], [2, 3]]) -// >>> np.unique(a) -// array([1, 2, 3]) -// -// Return the unique rows of a 2D array -// -// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) -// >>> np.unique(a, axis=0) -// array([[1, 0, 0], [2, 3, 4]]) -// -// Return the indices of the original array that give the unique values: -// -// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) -// >>> u, indices = np.unique(a, return_index=True) -// >>> u -// array(['a', 'b', 'c'], dtype='>> indices -// array([0, 1, 3]) -// >>> a[indices] -// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> u, indices = np.unique(a, return_inverse=True) -// >>> u -// array([1, 2, 3, 4, 6]) -// >>> indices -// array([0, 1, 4, 3, 1, 2, 1]) -// >>> u[indices] -// array([1, 2, 6, 4, 2, 3, 2]) -// -// Reconstruct the input values from the unique values and counts: -// -// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) -// >>> values, counts = np.unique(a, return_counts=True) -// >>> values -// array([1, 2, 3, 4, 6]) -// >>> counts -// array([1, 3, 1, 1, 1]) -// >>> np.repeat(values, counts) -// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved -// -// -// -//go:linkname Unique py.unique -func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object -// -// Check for a complex type or an array of complex numbers. -// -// The type of the input is checked, not the value. Even if the input -// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. -// -// Parameters -// ---------- -// x : any -// The input can be of any type and shape. -// -// Returns -// ------- -// iscomplexobj : bool -// The return value, True if `x` is of a complex type or has at least -// one complex element. -// -// See Also -// -------- -// isrealobj, iscomplex -// -// Examples -// -------- -// >>> np.iscomplexobj(1) -// False -// >>> np.iscomplexobj(1+0j) -// True -// >>> np.iscomplexobj([3, 1+0j, True]) -// True -// -// -// -//go:linkname Iscomplexobj py.iscomplexobj -func Iscomplexobj(x *py.Object) *py.Object -// -// If input is complex with all imaginary parts close to zero, return -// real parts. -// -// "Close to zero" is defined as `tol` * (machine epsilon of the type for -// `a`). -// -// Parameters -// ---------- -// a : array_like -// Input array. -// tol : float -// Tolerance in machine epsilons for the complex part of the elements -// in the array. If the tolerance is <=1, then the absolute tolerance -// is used. -// -// Returns -// ------- -// out : ndarray -// If `a` is real, the type of `a` is used for the output. If `a` -// has complex elements, the returned type is float. -// -// See Also -// -------- -// real, imag, angle -// -// Notes -// ----- -// Machine epsilon varies from machine to machine and between data types -// but Python floats on most platforms have a machine epsilon equal to -// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print -// out the machine epsilon for floats. -// -// Examples -// -------- -// >>> np.finfo(float).eps -// 2.2204460492503131e-16 # may vary -// -// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) -// array([2.1, 5.2]) -// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) -// array([2.1+4.e-13j, 5.2 + 3e-15j]) -// -// -// -//go:linkname RealIfClose py.real_if_close -func RealIfClose(a *py.Object, tol *py.Object) *py.Object -// -// Split an array into multiple sub-arrays horizontally (column-wise). -// -// Please refer to the `split` documentation. `hsplit` is equivalent -// to `split` with ``axis=1``, the array is always split along the second -// axis except for 1-D arrays, where it is split at ``axis=0``. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(4, 4) -// >>> x -// array([[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.], -// [ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]) -// >>> np.hsplit(x, 2) -// [array([[ 0., 1.], -// [ 4., 5.], -// [ 8., 9.], -// [12., 13.]]), -// array([[ 2., 3.], -// [ 6., 7.], -// [10., 11.], -// [14., 15.]])] -// >>> np.hsplit(x, np.array([3, 6])) -// [array([[ 0., 1., 2.], -// [ 4., 5., 6.], -// [ 8., 9., 10.], -// [12., 13., 14.]]), -// array([[ 3.], -// [ 7.], -// [11.], -// [15.]]), -// array([], shape=(4, 0), dtype=float64)] -// -// With a higher dimensional array the split is still along the second axis. -// -// >>> x = np.arange(8.0).reshape(2, 2, 2) -// >>> x -// array([[[0., 1.], -// [2., 3.]], -// [[4., 5.], -// [6., 7.]]]) -// >>> np.hsplit(x, 2) -// [array([[[0., 1.]], -// [[4., 5.]]]), -// array([[[2., 3.]], -// [[6., 7.]]])] -// -// With a 1-D array, the split is along axis 0. -// -// >>> x = np.array([0, 1, 2, 3, 4, 5]) -// >>> np.hsplit(x, 2) -// [array([0, 1, 2]), array([3, 4, 5])] -// -// -// -//go:linkname Hsplit py.hsplit -func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Return the cumulative product of array elements over a given axis treating Not a -// Numbers (NaNs) as one. The cumulative product does not change when NaNs are -// encountered and leading NaNs are replaced by ones. -// -// Ones are returned for slices that are all-NaN or empty. -// -// .. versionadded:: 1.12.0 -// -// Parameters -// ---------- -// a : array_like -// Input array. -// axis : int, optional -// Axis along which the cumulative product is computed. By default -// the input is flattened. -// dtype : dtype, optional -// Type of the returned array, as well as of the accumulator in which -// the elements are multiplied. If *dtype* is not specified, it -// defaults to the dtype of `a`, unless `a` has an integer dtype with -// a precision less than that of the default platform integer. In -// that case, the default platform integer is used instead. -// out : ndarray, optional -// Alternative output array in which to place the result. It must -// have the same shape and buffer length as the expected output -// but the type of the resulting values will be cast if necessary. -// -// Returns -// ------- -// nancumprod : ndarray -// A new array holding the result is returned unless `out` is -// specified, in which case it is returned. -// -// See Also -// -------- -// numpy.cumprod : Cumulative product across array propagating NaNs. -// isnan : Show which elements are NaN. -// -// Examples -// -------- -// >>> np.nancumprod(1) -// array([1]) -// >>> np.nancumprod([1]) -// array([1]) -// >>> np.nancumprod([1, np.nan]) -// array([1., 1.]) -// >>> a = np.array([[1, 2], [3, np.nan]]) -// >>> np.nancumprod(a) -// array([1., 2., 6., 6.]) -// >>> np.nancumprod(a, axis=0) -// array([[1., 2.], -// [3., 2.]]) -// >>> np.nancumprod(a, axis=1) -// array([[1., 2.], -// [3., 3.]]) -// -// -// -//go:linkname Nancumprod py.nancumprod -func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object -// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Calculate the absolute value element-wise. -// -// ``np.abs`` is a shorthand for this function. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// absolute : ndarray -// An ndarray containing the absolute value of -// each element in `x`. For complex input, ``a + ib``, the -// absolute value is :math:`\sqrt{ a^2 + b^2 }`. -// This is a scalar if `x` is a scalar. -// -// Examples -// -------- -// >>> x = np.array([-1.2, 1.2]) -// >>> np.absolute(x) -// array([ 1.2, 1.2]) -// >>> np.absolute(1.2 + 1j) -// 1.5620499351813308 -// -// Plot the function over ``[-10, 10]``: -// -// >>> import matplotlib.pyplot as plt -// -// >>> x = np.linspace(start=-10, stop=10, num=101) -// >>> plt.plot(x, np.absolute(x)) -// >>> plt.show() -// -// Plot the function over the complex plane: -// -// >>> xx = x + 1j * x[:, np.newaxis] -// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') -// >>> plt.show() -// -// The `abs` function can be used as a shorthand for ``np.absolute`` on -// ndarrays. -// -// >>> x = np.array([-1.2, 1.2]) -// >>> abs(x) -// array([1.2, 1.2]) -// -//go:linkname Abs py.abs -func Abs(__llgo_va_list ...interface{}) *py.Object -// -// Returns the discrete, linear convolution of two one-dimensional sequences. -// -// The convolution operator is often seen in signal processing, where it -// models the effect of a linear time-invariant system on a signal [1]_. In -// probability theory, the sum of two independent random variables is -// distributed according to the convolution of their individual -// distributions. -// -// If `v` is longer than `a`, the arrays are swapped before computation. -// -// Parameters -// ---------- -// a : (N,) array_like -// First one-dimensional input array. -// v : (M,) array_like -// Second one-dimensional input array. -// mode : {'full', 'valid', 'same'}, optional -// 'full': -// By default, mode is 'full'. This returns the convolution -// at each point of overlap, with an output shape of (N+M-1,). At -// the end-points of the convolution, the signals do not overlap -// completely, and boundary effects may be seen. -// -// 'same': -// Mode 'same' returns output of length ``max(M, N)``. Boundary -// effects are still visible. -// -// 'valid': -// Mode 'valid' returns output of length -// ``max(M, N) - min(M, N) + 1``. The convolution product is only given -// for points where the signals overlap completely. Values outside -// the signal boundary have no effect. -// -// Returns -// ------- -// out : ndarray -// Discrete, linear convolution of `a` and `v`. -// -// See Also -// -------- -// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier -// Transform. -// scipy.linalg.toeplitz : Used to construct the convolution operator. -// polymul : Polynomial multiplication. Same output as convolve, but also -// accepts poly1d objects as input. -// -// Notes -// ----- -// The discrete convolution operation is defined as -// -// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} -// -// It can be shown that a convolution :math:`x(t) * y(t)` in time/space -// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier -// domain, after appropriate padding (padding is necessary to prevent -// circular convolution). Since multiplication is more efficient (faster) -// than convolution, the function `scipy.signal.fftconvolve` exploits the -// FFT to calculate the convolution of large data-sets. -// -// References -// ---------- -// .. [1] Wikipedia, "Convolution", -// https://en.wikipedia.org/wiki/Convolution -// -// Examples -// -------- -// Note how the convolution operator flips the second array -// before "sliding" the two across one another: -// -// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) -// array([0. , 1. , 2.5, 4. , 1.5]) -// -// Only return the middle values of the convolution. -// Contains boundary effects, where zeros are taken -// into account: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'same') -// array([1. , 2.5, 4. ]) -// -// The two arrays are of the same length, so there -// is only one position where they completely overlap: -// -// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') -// array([2.5]) -// -// -// -//go:linkname Convolve py.convolve -func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object -// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Element-wise minimum of array elements. -// -// Compare two arrays and return a new array containing the element-wise -// minima. If one of the elements being compared is a NaN, then the -// non-nan element is returned. If both elements are NaNs then the first -// is returned. The latter distinction is important for complex NaNs, -// which are defined as at least one of the real or imaginary parts being -// a NaN. The net effect is that NaNs are ignored when possible. -// -// Parameters -// ---------- -// x1, x2 : array_like -// The arrays holding the elements to be compared. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The minimum of `x1` and `x2`, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// fmax : -// Element-wise maximum of two arrays, ignores NaNs. -// minimum : -// Element-wise minimum of two arrays, propagates NaNs. -// amin : -// The minimum value of an array along a given axis, propagates NaNs. -// nanmin : -// The minimum value of an array along a given axis, ignores NaNs. -// -// maximum, amax, nanmax -// -// Notes -// ----- -// .. versionadded:: 1.3.0 -// -// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither -// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. -// -// Examples -// -------- -// >>> np.fmin([2, 3, 4], [1, 5, 2]) -// array([1, 3, 2]) -// -// >>> np.fmin(np.eye(2), [0.5, 2]) -// array([[ 0.5, 0. ], -// [ 0. , 1. ]]) -// -// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) -// array([ 0., 0., nan]) -// -//go:linkname Fmin py.fmin -func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Returns x1 * 2**x2, element-wise. -// -// The mantissas `x1` and twos exponents `x2` are used to construct -// floating point numbers ``x1 * 2**x2``. -// -// Parameters -// ---------- -// x1 : array_like -// Array of multipliers. -// x2 : array_like, int -// Array of twos exponents. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The result of ``x1 * 2**x2``. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. -// -// Notes -// ----- -// Complex dtypes are not supported, they will raise a TypeError. -// -// `ldexp` is useful as the inverse of `frexp`, if used by itself it is -// more clear to simply use the expression ``x1 * 2**x2``. -// -// Examples -// -------- -// >>> np.ldexp(5, np.arange(4)) -// array([ 5., 10., 20., 40.], dtype=float16) -// -// >>> x = np.arange(6) -// >>> np.ldexp(*np.frexp(x)) -// array([ 0., 1., 2., 3., 4., 5.]) -// -//go:linkname Ldexp py.ldexp -func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the truth value of NOT x element-wise. -// -// Parameters -// ---------- -// x : array_like -// Logical NOT is applied to the elements of `x`. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool or ndarray of bool -// Boolean result with the same shape as `x` of the NOT operation -// on elements of `x`. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// logical_and, logical_or, logical_xor -// -// Examples -// -------- -// >>> np.logical_not(3) -// False -// >>> np.logical_not([True, False, 0, 1]) -// array([False, True, True, False]) -// -// >>> x = np.arange(5) -// >>> np.logical_not(x<3) -// array([False, False, False, True, True]) -// -//go:linkname LogicalNot py.logical_not -func LogicalNot(x *py.Object, out *py.Object) *py.Object -// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Return the fractional and integral parts of an array, element-wise. -// -// The fractional and integral parts are negative if the given number is -// negative. -// -// Parameters -// ---------- -// x : array_like -// Input array. -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y1 : ndarray -// Fractional part of `x`. -// This is a scalar if `x` is a scalar. -// y2 : ndarray -// Integral part of `x`. -// This is a scalar if `x` is a scalar. -// -// Notes -// ----- -// For integer input the return values are floats. -// -// See Also -// -------- -// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values -// switched, except it always has a positive remainder. -// -// Examples -// -------- -// >>> np.modf([0, 3.5]) -// (array([ 0. , 0.5]), array([ 0., 3.])) -// >>> np.modf(-0.5) -// (-0.5, -0) -// -//go:linkname Modf py.modf -func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object -// -// Format a floating-point scalar as a decimal string in scientific notation. -// -// Provides control over rounding, trimming and padding. Uses and assumes -// IEEE unbiased rounding. Uses the "Dragon4" algorithm. -// -// Parameters -// ---------- -// x : python float or numpy floating scalar -// Value to format. -// precision : non-negative integer or None, optional -// Maximum number of digits to print. May be None if `unique` is -// `True`, but must be an integer if unique is `False`. -// unique : boolean, optional -// If `True`, use a digit-generation strategy which gives the shortest -// representation which uniquely identifies the floating-point number from -// other values of the same type, by judicious rounding. If `precision` -// is given fewer digits than necessary can be printed. If `min_digits` -// is given more can be printed, in which cases the last digit is rounded -// with unbiased rounding. -// If `False`, digits are generated as if printing an infinite-precision -// value and stopping after `precision` digits, rounding the remaining -// value with unbiased rounding -// trim : one of 'k', '.', '0', '-', optional -// Controls post-processing trimming of trailing digits, as follows: -// -// * 'k' : keep trailing zeros, keep decimal point (no trimming) -// * '.' : trim all trailing zeros, leave decimal point -// * '0' : trim all but the zero before the decimal point. Insert the -// zero if it is missing. -// * '-' : trim trailing zeros and any trailing decimal point -// sign : boolean, optional -// Whether to show the sign for positive values. -// pad_left : non-negative integer, optional -// Pad the left side of the string with whitespace until at least that -// many characters are to the left of the decimal point. -// exp_digits : non-negative integer, optional -// Pad the exponent with zeros until it contains at least this many digits. -// If omitted, the exponent will be at least 2 digits. -// min_digits : non-negative integer or None, optional -// Minimum number of digits to print. This only has an effect for -// `unique=True`. In that case more digits than necessary to uniquely -// identify the value may be printed and rounded unbiased. -// -// -- versionadded:: 1.21.0 -// -// Returns -// ------- -// rep : string -// The string representation of the floating point value -// -// See Also -// -------- -// format_float_positional -// -// Examples -// -------- -// >>> np.format_float_scientific(np.float32(np.pi)) -// '3.1415927e+00' -// >>> s = np.float32(1.23e24) -// >>> np.format_float_scientific(s, unique=False, precision=15) -// '1.230000071797338e+24' -// >>> np.format_float_scientific(s, exp_digits=4) -// '1.23e+0024' -// -// -//go:linkname FormatFloatScientific py.format_float_scientific -func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object -// -// Compute the qth percentile of the data along the specified axis, -// while ignoring nan values. -// -// Returns the qth percentile(s) of the array elements. -// -// .. versionadded:: 1.9.0 -// -// Parameters -// ---------- -// a : array_like -// Input array or object that can be converted to an array, containing -// nan values to be ignored. -// q : array_like of float -// Percentile or sequence of percentiles to compute, which must be -// between 0 and 100 inclusive. -// axis : {int, tuple of int, None}, optional -// Axis or axes along which the percentiles are computed. The default -// is to compute the percentile(s) along a flattened version of the -// array. -// out : ndarray, optional -// Alternative output array in which to place the result. It must have -// the same shape and buffer length as the expected output, but the -// type (of the output) will be cast if necessary. -// overwrite_input : bool, optional -// If True, then allow the input array `a` to be modified by -// intermediate calculations, to save memory. In this case, the -// contents of the input `a` after this function completes is -// undefined. -// method : str, optional -// This parameter specifies the method to use for estimating the -// percentile. There are many different methods, some unique to NumPy. -// See the notes for explanation. The options sorted by their R type -// as summarized in the H&F paper [1]_ are: -// -// 1. 'inverted_cdf' -// 2. 'averaged_inverted_cdf' -// 3. 'closest_observation' -// 4. 'interpolated_inverted_cdf' -// 5. 'hazen' -// 6. 'weibull' -// 7. 'linear' (default) -// 8. 'median_unbiased' -// 9. 'normal_unbiased' -// -// The first three methods are discontinuous. NumPy further defines the -// following discontinuous variations of the default 'linear' (7.) option: -// -// * 'lower' -// * 'higher', -// * 'midpoint' -// * 'nearest' -// -// .. versionchanged:: 1.22.0 -// This argument was previously called "interpolation" and only -// offered the "linear" default and last four options. -// -// keepdims : bool, optional -// If this is set to True, the axes which are reduced are left in -// the result as dimensions with size one. With this option, the -// result will broadcast correctly against the original array `a`. -// -// If this is anything but the default value it will be passed -// through (in the special case of an empty array) to the -// `mean` function of the underlying array. If the array is -// a sub-class and `mean` does not have the kwarg `keepdims` this -// will raise a RuntimeError. -// -// interpolation : str, optional -// Deprecated name for the method keyword argument. -// -// .. deprecated:: 1.22.0 -// -// Returns -// ------- -// percentile : scalar or ndarray -// If `q` is a single percentile and `axis=None`, then the result -// is a scalar. If multiple percentiles are given, first axis of -// the result corresponds to the percentiles. The other axes are -// the axes that remain after the reduction of `a`. If the input -// contains integers or floats smaller than ``float64``, the output -// data-type is ``float64``. Otherwise, the output data-type is the -// same as that of the input. If `out` is specified, that array is -// returned instead. -// -// See Also -// -------- -// nanmean -// nanmedian : equivalent to ``nanpercentile(..., 50)`` -// percentile, median, mean -// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. -// -// Notes -// ----- -// For more information please see `numpy.percentile` -// -// Examples -// -------- -// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) -// >>> a[0][1] = np.nan -// >>> a -// array([[10., nan, 4.], -// [ 3., 2., 1.]]) -// >>> np.percentile(a, 50) -// nan -// >>> np.nanpercentile(a, 50) -// 3.0 -// >>> np.nanpercentile(a, 50, axis=0) -// array([6.5, 2. , 2.5]) -// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) -// array([[7.], -// [2.]]) -// >>> m = np.nanpercentile(a, 50, axis=0) -// >>> out = np.zeros_like(m) -// >>> np.nanpercentile(a, 50, axis=0, out=out) -// array([6.5, 2. , 2.5]) -// >>> m -// array([6.5, 2. , 2.5]) -// -// >>> b = a.copy() -// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) -// array([7., 2.]) -// >>> assert not np.all(a==b) -// -// References -// ---------- -// .. [1] R. J. Hyndman and Y. Fan, -// "Sample quantiles in statistical packages," -// The American Statistician, 50(4), pp. 361-365, 1996 -// -// -// -//go:linkname Nanpercentile py.nanpercentile -func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object -// -// Stack arrays in sequence horizontally (column wise). -// -// This is equivalent to concatenation along the second axis, except for 1-D -// arrays where it concatenates along the first axis. Rebuilds arrays divided -// by `hsplit`. -// -// This function makes most sense for arrays with up to 3 dimensions. For -// instance, for pixel-data with a height (first axis), width (second axis), -// and r/g/b channels (third axis). The functions `concatenate`, `stack` and -// `block` provide more general stacking and concatenation operations. -// -// Parameters -// ---------- -// tup : sequence of ndarrays -// The arrays must have the same shape along all but the second axis, -// except 1-D arrays which can be any length. -// -// dtype : str or dtype -// If provided, the destination array will have this dtype. Cannot be -// provided together with `out`. -// -// .. versionadded:: 1.24 -// -// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional -// Controls what kind of data casting may occur. Defaults to 'same_kind'. -// -// .. versionadded:: 1.24 -// -// Returns -// ------- -// stacked : ndarray -// The array formed by stacking the given arrays. -// -// See Also -// -------- -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// block : Assemble an nd-array from nested lists of blocks. -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third axis). -// column_stack : Stack 1-D arrays as columns into a 2-D array. -// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). -// -// Examples -// -------- -// >>> a = np.array((1,2,3)) -// >>> b = np.array((4,5,6)) -// >>> np.hstack((a,b)) -// array([1, 2, 3, 4, 5, 6]) -// >>> a = np.array([[1],[2],[3]]) -// >>> b = np.array([[4],[5],[6]]) -// >>> np.hstack((a,b)) -// array([[1, 4], -// [2, 5], -// [3, 6]]) -// -// -// -//go:linkname Hstack py.hstack -func Hstack(tup *py.Object) *py.Object -// -// Split an array into multiple sub-arrays as views into `ary`. -// -// Parameters -// ---------- -// ary : ndarray -// Array to be divided into sub-arrays. -// indices_or_sections : int or 1-D array -// If `indices_or_sections` is an integer, N, the array will be divided -// into N equal arrays along `axis`. If such a split is not possible, -// an error is raised. -// -// If `indices_or_sections` is a 1-D array of sorted integers, the entries -// indicate where along `axis` the array is split. For example, -// ``[2, 3]`` would, for ``axis=0``, result in -// -// - ary[:2] -// - ary[2:3] -// - ary[3:] -// -// If an index exceeds the dimension of the array along `axis`, -// an empty sub-array is returned correspondingly. -// axis : int, optional -// The axis along which to split, default is 0. -// -// Returns -// ------- -// sub-arrays : list of ndarrays -// A list of sub-arrays as views into `ary`. -// -// Raises -// ------ -// ValueError -// If `indices_or_sections` is given as an integer, but -// a split does not result in equal division. -// -// See Also -// -------- -// array_split : Split an array into multiple sub-arrays of equal or -// near-equal size. Does not raise an exception if -// an equal division cannot be made. -// hsplit : Split array into multiple sub-arrays horizontally (column-wise). -// vsplit : Split array into multiple sub-arrays vertically (row wise). -// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). -// concatenate : Join a sequence of arrays along an existing axis. -// stack : Join a sequence of arrays along a new axis. -// hstack : Stack arrays in sequence horizontally (column wise). -// vstack : Stack arrays in sequence vertically (row wise). -// dstack : Stack arrays in sequence depth wise (along third dimension). -// -// Examples -// -------- -// >>> x = np.arange(9.0) -// >>> np.split(x, 3) -// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] -// -// >>> x = np.arange(8.0) -// >>> np.split(x, [3, 5, 6, 10]) -// [array([0., 1., 2.]), -// array([3., 4.]), -// array([5.]), -// array([6., 7.]), -// array([], dtype=float64)] -// -// -// -//go:linkname Split py.split -func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object -// -// Apply a function to 1-D slices along the given axis. -// -// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays -// and `a` is a 1-D slice of `arr` along `axis`. -// -// This is equivalent to (but faster than) the following use of `ndindex` and -// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// f = func1d(arr[ii + s_[:,] + kk]) -// Nj = f.shape -// for jj in ndindex(Nj): -// out[ii + jj + kk] = f[jj] -// -// Equivalently, eliminating the inner loop, this can be expressed as:: -// -// Ni, Nk = a.shape[:axis], a.shape[axis+1:] -// for ii in ndindex(Ni): -// for kk in ndindex(Nk): -// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) -// -// Parameters -// ---------- -// func1d : function (M,) -> (Nj...) -// This function should accept 1-D arrays. It is applied to 1-D -// slices of `arr` along the specified axis. -// axis : integer -// Axis along which `arr` is sliced. -// arr : ndarray (Ni..., M, Nk...) -// Input array. -// args : any -// Additional arguments to `func1d`. -// kwargs : any -// Additional named arguments to `func1d`. -// -// .. versionadded:: 1.9.0 -// -// -// Returns -// ------- -// out : ndarray (Ni..., Nj..., Nk...) -// The output array. The shape of `out` is identical to the shape of -// `arr`, except along the `axis` dimension. This axis is removed, and -// replaced with new dimensions equal to the shape of the return value -// of `func1d`. So if `func1d` returns a scalar `out` will have one -// fewer dimensions than `arr`. -// -// See Also -// -------- -// apply_over_axes : Apply a function repeatedly over multiple axes. -// -// Examples -// -------- -// >>> def my_func(a): -// ... """Average first and last element of a 1-D array""" -// ... return (a[0] + a[-1]) * 0.5 -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(my_func, 0, b) -// array([4., 5., 6.]) -// >>> np.apply_along_axis(my_func, 1, b) -// array([2., 5., 8.]) -// -// For a function that returns a 1D array, the number of dimensions in -// `outarr` is the same as `arr`. -// -// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) -// >>> np.apply_along_axis(sorted, 1, b) -// array([[1, 7, 8], -// [3, 4, 9], -// [2, 5, 6]]) -// -// For a function that returns a higher dimensional array, those dimensions -// are inserted in place of the `axis` dimension. -// -// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) -// >>> np.apply_along_axis(np.diag, -1, b) -// array([[[1, 0, 0], -// [0, 2, 0], -// [0, 0, 3]], -// [[4, 0, 0], -// [0, 5, 0], -// [0, 0, 6]], -// [[7, 0, 0], -// [0, 8, 0], -// [0, 0, 9]]]) -// -// -//go:linkname ApplyAlongAxis py.apply_along_axis -func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object -// -// Do a keyword search on docstrings. -// -// A list of objects that matched the search is displayed, -// sorted by relevance. All given keywords need to be found in the -// docstring for it to be returned as a result, but the order does -// not matter. -// -// Parameters -// ---------- -// what : str -// String containing words to look for. -// module : str or list, optional -// Name of module(s) whose docstrings to go through. -// import_modules : bool, optional -// Whether to import sub-modules in packages. Default is True. -// regenerate : bool, optional -// Whether to re-generate the docstring cache. Default is False. -// output : file-like, optional -// File-like object to write the output to. If omitted, use a pager. -// -// See Also -// -------- -// source, info -// -// Notes -// ----- -// Relevance is determined only roughly, by checking if the keywords occur -// in the function name, at the start of a docstring, etc. -// -// Examples -// -------- -// >>> np.lookfor('binary representation') # doctest: +SKIP -// Search results for 'binary representation' -// ------------------------------------------ -// numpy.binary_repr -// Return the binary representation of the input number as a string. -// numpy.core.setup_common.long_double_representation -// Given a binary dump as given by GNU od -b, look for long double -// numpy.base_repr -// Return a string representation of a number in the given base system. -// ... -// -// -// -//go:linkname Lookfor py.lookfor -func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object -// -// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. -// -// .. warning:: Loading files that contain object arrays uses the ``pickle`` -// module, which is not secure against erroneous or maliciously -// constructed data. Consider passing ``allow_pickle=False`` to -// load data that is known not to contain object arrays for the -// safer handling of untrusted sources. -// -// Parameters -// ---------- -// file : file-like object, string, or pathlib.Path -// The file to read. File-like objects must support the -// ``seek()`` and ``read()`` methods and must always -// be opened in binary mode. Pickled files require that the -// file-like object support the ``readline()`` method as well. -// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional -// If not None, then memory-map the file, using the given mode (see -// `numpy.memmap` for a detailed description of the modes). A -// memory-mapped array is kept on disk. However, it can be accessed -// and sliced like any ndarray. Memory mapping is especially useful -// for accessing small fragments of large files without reading the -// entire file into memory. -// allow_pickle : bool, optional -// Allow loading pickled object arrays stored in npy files. Reasons for -// disallowing pickles include security, as loading pickled data can -// execute arbitrary code. If pickles are disallowed, loading object -// arrays will fail. Default: False -// -// .. versionchanged:: 1.16.3 -// Made default False in response to CVE-2019-6446. -// -// fix_imports : bool, optional -// Only useful when loading Python 2 generated pickled files on Python 3, -// which includes npy/npz files containing object arrays. If `fix_imports` -// is True, pickle will try to map the old Python 2 names to the new names -// used in Python 3. -// encoding : str, optional -// What encoding to use when reading Python 2 strings. Only useful when -// loading Python 2 generated pickled files in Python 3, which includes -// npy/npz files containing object arrays. Values other than 'latin1', -// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical -// data. Default: 'ASCII' -// max_header_size : int, optional -// Maximum allowed size of the header. Large headers may not be safe -// to load securely and thus require explicitly passing a larger value. -// See :py:func:`ast.literal_eval()` for details. -// This option is ignored when `allow_pickle` is passed. In that case -// the file is by definition trusted and the limit is unnecessary. -// -// Returns -// ------- -// result : array, tuple, dict, etc. -// Data stored in the file. For ``.npz`` files, the returned instance -// of NpzFile class must be closed to avoid leaking file descriptors. -// -// Raises -// ------ -// OSError -// If the input file does not exist or cannot be read. -// UnpicklingError -// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. -// ValueError -// The file contains an object array, but ``allow_pickle=False`` given. -// EOFError -// When calling ``np.load`` multiple times on the same file handle, -// if all data has already been read -// -// See Also -// -------- -// save, savez, savez_compressed, loadtxt -// memmap : Create a memory-map to an array stored in a file on disk. -// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. -// -// Notes -// ----- -// - If the file contains pickle data, then whatever object is stored -// in the pickle is returned. -// - If the file is a ``.npy`` file, then a single array is returned. -// - If the file is a ``.npz`` file, then a dictionary-like object is -// returned, containing ``{filename: array}`` key-value pairs, one for -// each file in the archive. -// - If the file is a ``.npz`` file, the returned value supports the -// context manager protocol in a similar fashion to the open function:: -// -// with load('foo.npz') as data: -// a = data['a'] -// -// The underlying file descriptor is closed when exiting the 'with' -// block. -// -// Examples -// -------- -// Store data to disk, and load it again: -// -// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) -// >>> np.load('/tmp/123.npy') -// array([[1, 2, 3], -// [4, 5, 6]]) -// -// Store compressed data to disk, and load it again: -// -// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) -// >>> b=np.array([1, 2]) -// >>> np.savez('/tmp/123.npz', a=a, b=b) -// >>> data = np.load('/tmp/123.npz') -// >>> data['a'] -// array([[1, 2, 3], -// [4, 5, 6]]) -// >>> data['b'] -// array([1, 2]) -// >>> data.close() -// -// Mem-map the stored array, and then access the second row -// directly from disk: -// -// >>> X = np.load('/tmp/123.npy', mmap_mode='r') -// >>> X[1, :] -// memmap([4, 5, 6]) -// -// -// -//go:linkname Load py.load -func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object -// -// Compute the histogram of a dataset. -// -// Parameters -// ---------- -// a : array_like -// Input data. The histogram is computed over the flattened array. -// bins : int or sequence of scalars or str, optional -// If `bins` is an int, it defines the number of equal-width -// bins in the given range (10, by default). If `bins` is a -// sequence, it defines a monotonically increasing array of bin edges, -// including the rightmost edge, allowing for non-uniform bin widths. -// -// .. versionadded:: 1.11.0 -// -// If `bins` is a string, it defines the method used to calculate the -// optimal bin width, as defined by `histogram_bin_edges`. -// -// range : (float, float), optional -// The lower and upper range of the bins. If not provided, range -// is simply ``(a.min(), a.max())``. Values outside the range are -// ignored. The first element of the range must be less than or -// equal to the second. `range` affects the automatic bin -// computation as well. While bin width is computed to be optimal -// based on the actual data within `range`, the bin count will fill -// the entire range including portions containing no data. -// weights : array_like, optional -// An array of weights, of the same shape as `a`. Each value in -// `a` only contributes its associated weight towards the bin count -// (instead of 1). If `density` is True, the weights are -// normalized, so that the integral of the density over the range -// remains 1. -// density : bool, optional -// If ``False``, the result will contain the number of samples in -// each bin. If ``True``, the result is the value of the -// probability *density* function at the bin, normalized such that -// the *integral* over the range is 1. Note that the sum of the -// histogram values will not be equal to 1 unless bins of unity -// width are chosen; it is not a probability *mass* function. -// -// Returns -// ------- -// hist : array -// The values of the histogram. See `density` and `weights` for a -// description of the possible semantics. -// bin_edges : array of dtype float -// Return the bin edges ``(length(hist)+1)``. -// -// -// See Also -// -------- -// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges -// -// Notes -// ----- -// All but the last (righthand-most) bin is half-open. In other words, -// if `bins` is:: -// -// [1, 2, 3, 4] -// -// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and -// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which -// *includes* 4. -// -// -// Examples -// -------- -// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) -// (array([0, 2, 1]), array([0, 1, 2, 3])) -// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) -// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) -// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) -// (array([1, 4, 1]), array([0, 1, 2, 3])) -// -// >>> a = np.arange(5) -// >>> hist, bin_edges = np.histogram(a, density=True) -// >>> hist -// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) -// >>> hist.sum() -// 2.4999999999999996 -// >>> np.sum(hist * np.diff(bin_edges)) -// 1.0 -// -// .. versionadded:: 1.11.0 -// -// Automated Bin Selection Methods example, using 2 peak random data -// with 2000 points: -// -// >>> import matplotlib.pyplot as plt -// >>> rng = np.random.RandomState(10) # deterministic random data -// >>> a = np.hstack((rng.normal(size=1000), -// ... rng.normal(loc=5, scale=2, size=1000))) -// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram -// >>> plt.title("Histogram with 'auto' bins") -// Text(0.5, 1.0, "Histogram with 'auto' bins") -// >>> plt.show() -// -// -// -//go:linkname Histogram py.histogram -func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object -// -// Roll array elements along a given axis. -// -// Elements that roll beyond the last position are re-introduced at -// the first. -// -// Parameters -// ---------- -// a : array_like -// Input array. -// shift : int or tuple of ints -// The number of places by which elements are shifted. If a tuple, -// then `axis` must be a tuple of the same size, and each of the -// given axes is shifted by the corresponding number. If an int -// while `axis` is a tuple of ints, then the same value is used for -// all given axes. -// axis : int or tuple of ints, optional -// Axis or axes along which elements are shifted. By default, the -// array is flattened before shifting, after which the original -// shape is restored. -// -// Returns -// ------- -// res : ndarray -// Output array, with the same shape as `a`. -// -// See Also -// -------- -// rollaxis : Roll the specified axis backwards, until it lies in a -// given position. -// -// Notes -// ----- -// .. versionadded:: 1.12.0 -// -// Supports rolling over multiple dimensions simultaneously. -// -// Examples -// -------- -// >>> x = np.arange(10) -// >>> np.roll(x, 2) -// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) -// >>> np.roll(x, -2) -// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) -// -// >>> x2 = np.reshape(x, (2, 5)) -// >>> x2 -// array([[0, 1, 2, 3, 4], -// [5, 6, 7, 8, 9]]) -// >>> np.roll(x2, 1) -// array([[9, 0, 1, 2, 3], -// [4, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1) -// array([[1, 2, 3, 4, 5], -// [6, 7, 8, 9, 0]]) -// >>> np.roll(x2, 1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, -1, axis=0) -// array([[5, 6, 7, 8, 9], -// [0, 1, 2, 3, 4]]) -// >>> np.roll(x2, 1, axis=1) -// array([[4, 0, 1, 2, 3], -// [9, 5, 6, 7, 8]]) -// >>> np.roll(x2, -1, axis=1) -// array([[1, 2, 3, 4, 0], -// [6, 7, 8, 9, 5]]) -// >>> np.roll(x2, (1, 1), axis=(1, 0)) -// array([[9, 5, 6, 7, 8], -// [4, 0, 1, 2, 3]]) -// >>> np.roll(x2, (2, 1), axis=(1, 0)) -// array([[8, 9, 5, 6, 7], -// [3, 4, 0, 1, 2]]) -// -// -// -//go:linkname Roll py.roll -func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object -// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Compute the bit-wise XOR of two arrays element-wise. -// -// Computes the bit-wise XOR of the underlying binary representation of -// the integers in the input arrays. This ufunc implements the C/Python -// operator ``^``. -// -// Parameters -// ---------- -// x1, x2 : array_like -// Only integer and boolean types are handled. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// out : ndarray or scalar -// Result. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// logical_xor -// bitwise_and -// bitwise_or -// binary_repr : -// Return the binary representation of the input number as a string. -// -// Examples -// -------- -// The number 13 is represented by ``00001101``. Likewise, 17 is -// represented by ``00010001``. The bit-wise XOR of 13 and 17 is -// therefore ``00011100``, or 28: -// -// >>> np.bitwise_xor(13, 17) -// 28 -// >>> np.binary_repr(28) -// '11100' -// -// >>> np.bitwise_xor(31, 5) -// 26 -// >>> np.bitwise_xor([31,3], 5) -// array([26, 6]) -// -// >>> np.bitwise_xor([31,3], [5,6]) -// array([26, 5]) -// >>> np.bitwise_xor([True, True], [False, True]) -// array([ True, False]) -// -// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on -// ndarrays. -// -// >>> x1 = np.array([True, True]) -// >>> x2 = np.array([False, True]) -// >>> x1 ^ x2 -// array([ True, False]) -// -//go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Divide arguments element-wise. -// -// Parameters -// ---------- -// x1 : array_like -// Dividend array. -// x2 : array_like -// Divisor array. -// If ``x1.shape != x2.shape``, they must be broadcastable to a common -// shape (which becomes the shape of the output). -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : ndarray or scalar -// The quotient ``x1/x2``, element-wise. -// This is a scalar if both `x1` and `x2` are scalars. -// -// See Also -// -------- -// seterr : Set whether to raise or warn on overflow, underflow and -// division by zero. -// -// Notes -// ----- -// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. -// -// The ``true_divide(x1, x2)`` function is an alias for -// ``divide(x1, x2)``. -// -// Examples -// -------- -// >>> np.divide(2.0, 4.0) -// 0.5 -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = np.arange(3.0) -// >>> np.divide(x1, x2) -// array([[nan, 1. , 1. ], -// [inf, 4. , 2.5], -// [inf, 7. , 4. ]]) -// -// The ``/`` operator can be used as a shorthand for ``np.divide`` on -// ndarrays. -// -// >>> x1 = np.arange(9.0).reshape((3, 3)) -// >>> x2 = 2 * np.ones(3) -// >>> x1 / x2 -// array([[0. , 0.5, 1. ], -// [1.5, 2. , 2.5], -// [3. , 3.5, 4. ]]) -// -//go:linkname Divide py.divide -func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object -// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) -// -// Test element-wise for positive or negative infinity. -// -// Returns a boolean array of the same shape as `x`, True where ``x == -// +/-inf``, otherwise False. -// -// Parameters -// ---------- -// x : array_like -// Input values -// out : ndarray, None, or tuple of ndarray and None, optional -// A location into which the result is stored. If provided, it must have -// a shape that the inputs broadcast to. If not provided or None, -// a freshly-allocated array is returned. A tuple (possible only as a -// keyword argument) must have length equal to the number of outputs. -// where : array_like, optional -// This condition is broadcast over the input. At locations where the -// condition is True, the `out` array will be set to the ufunc result. -// Elsewhere, the `out` array will retain its original value. -// Note that if an uninitialized `out` array is created via the default -// ``out=None``, locations within it where the condition is False will -// remain uninitialized. -// **kwargs -// For other keyword-only arguments, see the -// :ref:`ufunc docs `. -// -// Returns -// ------- -// y : bool (scalar) or boolean ndarray -// True where ``x`` is positive or negative infinity, false otherwise. -// This is a scalar if `x` is a scalar. -// -// See Also -// -------- -// isneginf, isposinf, isnan, isfinite -// -// Notes -// ----- -// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic -// (IEEE 754). -// -// Errors result if the second argument is supplied when the first -// argument is a scalar, or if the first and second arguments have -// different shapes. -// -// Examples -// -------- -// >>> np.isinf(np.inf) -// True -// >>> np.isinf(np.nan) -// False -// >>> np.isinf(np.NINF) -// True -// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) -// array([ True, True, False, False]) -// -// >>> x = np.array([-np.inf, 0., np.inf]) -// >>> y = np.array([2, 2, 2]) -// >>> np.isinf(x, y) -// array([1, 0, 1]) -// >>> y -// array([1, 0, 1]) -// -//go:linkname Isinf py.isinf -func Isinf(x *py.Object, out *py.Object) *py.Object -// -// Determines whether the given object represents a scalar data-type. -// -// Parameters -// ---------- -// rep : any -// If `rep` is an instance of a scalar dtype, True is returned. If not, -// False is returned. -// -// Returns -// ------- -// out : bool -// Boolean result of check whether `rep` is a scalar dtype. -// -// See Also -// -------- -// issubsctype, issubdtype, obj2sctype, sctype2char -// -// Examples -// -------- -// >>> np.issctype(np.int32) -// True -// >>> np.issctype(list) -// False -// >>> np.issctype(1.1) -// False -// -// Strings are also a scalar type: -// -// >>> np.issctype(np.dtype('str')) -// True -// -// -// -//go:linkname Issctype py.issctype -func Issctype(rep *py.Object) *py.Object -// -// Return a copy of an array sorted along the first axis. -// -// .. deprecated:: 1.24 -// -// msort is deprecated, use ``np.sort(a, axis=0)`` instead. -// -// Parameters -// ---------- -// a : array_like -// Array to be sorted. -// -// Returns -// ------- -// sorted_array : ndarray -// Array of the same type and shape as `a`. -// -// See Also -// -------- -// sort -// -// Notes -// ----- -// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. -// -// Examples -// -------- -// >>> a = np.array([[1, 4], [3, 1]]) -// >>> np.msort(a) # sort along the first axis -// array([[1, 1], -// [3, 4]]) -// -// -// -//go:linkname Msort py.msort -func Msort(a *py.Object) *py.Object -// -// Split array into multiple sub-arrays along the 3rd axis (depth). -// -// Please refer to the `split` documentation. `dsplit` is equivalent -// to `split` with ``axis=2``, the array is always split along the third -// axis provided the array dimension is greater than or equal to 3. -// -// See Also -// -------- -// split : Split an array into multiple sub-arrays of equal size. -// -// Examples -// -------- -// >>> x = np.arange(16.0).reshape(2, 2, 4) -// >>> x -// array([[[ 0., 1., 2., 3.], -// [ 4., 5., 6., 7.]], -// [[ 8., 9., 10., 11.], -// [12., 13., 14., 15.]]]) -// >>> np.dsplit(x, 2) -// [array([[[ 0., 1.], -// [ 4., 5.]], -// [[ 8., 9.], -// [12., 13.]]]), array([[[ 2., 3.], -// [ 6., 7.]], -// [[10., 11.], -// [14., 15.]]])] -// >>> np.dsplit(x, np.array([3, 6])) -// [array([[[ 0., 1., 2.], -// [ 4., 5., 6.]], -// [[ 8., 9., 10.], -// [12., 13., 14.]]]), -// array([[[ 3.], -// [ 7.]], -// [[11.], -// [15.]]]), -// array([], shape=(2, 2, 0), dtype=float64)] -// -// -//go:linkname Dsplit py.dsplit -func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object -// -// Load data from a text file. -// -// Parameters -// ---------- -// fname : file, str, pathlib.Path, list of str, generator -// File, filename, list, or generator to read. If the filename -// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note -// that generators must return bytes or strings. The strings -// in a list or produced by a generator are treated as lines. -// dtype : data-type, optional -// Data-type of the resulting array; default: float. If this is a -// structured data-type, the resulting array will be 1-dimensional, and -// each row will be interpreted as an element of the array. In this -// case, the number of columns used must match the number of fields in -// the data-type. -// comments : str or sequence of str or None, optional -// The characters or list of characters used to indicate the start of a -// comment. None implies no comments. For backwards compatibility, byte -// strings will be decoded as 'latin1'. The default is '#'. -// delimiter : str, optional -// The character used to separate the values. For backwards compatibility, -// byte strings will be decoded as 'latin1'. The default is whitespace. -// -// .. versionchanged:: 1.23.0 -// Only single character delimiters are supported. Newline characters -// cannot be used as the delimiter. -// -// converters : dict or callable, optional -// Converter functions to customize value parsing. If `converters` is -// callable, the function is applied to all columns, else it must be a -// dict that maps column number to a parser function. -// See examples for further details. -// Default: None. -// -// .. versionchanged:: 1.23.0 -// The ability to pass a single callable to be applied to all columns -// was added. -// -// skiprows : int, optional -// Skip the first `skiprows` lines, including comments; default: 0. -// usecols : int or sequence, optional -// Which columns to read, with 0 being the first. For example, -// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. -// The default, None, results in all columns being read. -// -// .. versionchanged:: 1.11.0 -// When a single column has to be read it is possible to use -// an integer instead of a tuple. E.g ``usecols = 3`` reads the -// fourth column the same way as ``usecols = (3,)`` would. -// unpack : bool, optional -// If True, the returned array is transposed, so that arguments may be -// unpacked using ``x, y, z = loadtxt(...)``. When used with a -// structured data-type, arrays are returned for each field. -// Default is False. -// ndmin : int, optional -// The returned array will have at least `ndmin` dimensions. -// Otherwise mono-dimensional axes will be squeezed. -// Legal values: 0 (default), 1 or 2. -// -// .. versionadded:: 1.6.0 -// encoding : str, optional -// Encoding used to decode the inputfile. Does not apply to input streams. -// The special value 'bytes' enables backward compatibility workarounds -// that ensures you receive byte arrays as results if possible and passes -// 'latin1' encoded strings to converters. Override this value to receive -// unicode arrays and pass strings as input to converters. If set to None -// the system default is used. The default value is 'bytes'. -// -// .. versionadded:: 1.14.0 -// max_rows : int, optional -// Read `max_rows` rows of content after `skiprows` lines. The default is -// to read all the rows. Note that empty rows containing no data such as -// empty lines and comment lines are not counted towards `max_rows`, -// while such lines are counted in `skiprows`. -// -// .. versionadded:: 1.16.0 -// -// .. versionchanged:: 1.23.0 -// Lines containing no data, including comment lines (e.g., lines -// starting with '#' or as specified via `comments`) are not counted -// towards `max_rows`. -// quotechar : unicode character or None, optional -// The character used to denote the start and end of a quoted item. -// Occurrences of the delimiter or comment characters are ignored within -// a quoted item. The default value is ``quotechar=None``, which means -// quoting support is disabled. -// -// If two consecutive instances of `quotechar` are found within a quoted -// field, the first is treated as an escape character. See examples. -// -// .. versionadded:: 1.23.0 -// like : array_like, optional -// Reference object to allow the creation of arrays which are not -// NumPy arrays. If an array-like passed in as ``like`` supports -// the ``__array_function__`` protocol, the result will be defined -// by it. In this case, it ensures the creation of an array object -// compatible with that passed in via this argument. -// -// .. versionadded:: 1.20.0 -// -// Returns -// ------- -// out : ndarray -// Data read from the text file. -// -// See Also -// -------- -// load, fromstring, fromregex -// genfromtxt : Load data with missing values handled as specified. -// scipy.io.loadmat : reads MATLAB data files -// -// Notes -// ----- -// This function aims to be a fast reader for simply formatted files. The -// `genfromtxt` function provides more sophisticated handling of, e.g., -// lines with missing values. -// -// Each row in the input text file must have the same number of values to be -// able to read all values. If all rows do not have same number of values, a -// subset of up to n columns (where n is the least number of values present -// in all rows) can be read by specifying the columns via `usecols`. -// -// .. versionadded:: 1.10.0 -// -// The strings produced by the Python float.hex method can be used as -// input for floats. -// -// Examples -// -------- -// >>> from io import StringIO # StringIO behaves like a file object -// >>> c = StringIO("0 1\n2 3") -// >>> np.loadtxt(c) -// array([[0., 1.], -// [2., 3.]]) -// -// >>> d = StringIO("M 21 72\nF 35 58") -// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), -// ... 'formats': ('S1', 'i4', 'f4')}) -// array([(b'M', 21, 72.), (b'F', 35, 58.)], -// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") -// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) -// >>> x -// array([1., 3.]) -// >>> y -// array([2., 4.]) -// -// The `converters` argument is used to specify functions to preprocess the -// text prior to parsing. `converters` can be a dictionary that maps -// preprocessing functions to each column: -// -// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") -// >>> conv = { -// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 -// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 -// ... } -// >>> np.loadtxt(s, delimiter=",", converters=conv) -// array([[1., 3.], -// [3., 5.]]) -// -// `converters` can be a callable instead of a dictionary, in which case it -// is applied to all columns: -// -// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") -// >>> import functools -// >>> conv = functools.partial(int, base=16) -// >>> np.loadtxt(s, converters=conv) -// array([[222., 173.], -// [192., 222.]]) -// -// This example shows how `converters` can be used to convert a field -// with a trailing minus sign into a negative number. -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> def conv(fld): -// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) -// ... -// >>> np.loadtxt(s, converters=conv) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Using a callable as the converter can be particularly useful for handling -// values with different formatting, e.g. floats with underscores: -// -// >>> s = StringIO("1 2.7 100_000") -// >>> np.loadtxt(s, converters=float) -// array([1.e+00, 2.7e+00, 1.e+05]) -// -// This idea can be extended to automatically handle values specified in -// many different formats: -// -// >>> def conv(val): -// ... try: -// ... return float(val) -// ... except ValueError: -// ... return float.fromhex(val) -// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") -// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) -// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) -// -// Note that with the default ``encoding="bytes"``, the inputs to the -// converter function are latin-1 encoded byte strings. To deactivate the -// implicit encoding prior to conversion, use ``encoding=None`` -// -// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') -// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) -// >>> np.loadtxt(s, converters=conv, encoding=None) -// array([[ 10.01, -31.25], -// [ 19.22, 64.31], -// [-17.57, 63.94]]) -// -// Support for quoted fields is enabled with the `quotechar` parameter. -// Comment and delimiter characters are ignored when they appear within a -// quoted item delineated by `quotechar`: -// -// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') -// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) -// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') -// array([('alpha, #42', 10.), ('beta, #64', 2.)], -// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') -// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') -// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") -// >>> np.loadtxt(d, usecols=(0, 1)) -// array([[ 1., 2.], -// [ 2., 4.], -// [ 3., 9.], -// [ 4., 16.]]) -// -// -// -//go:linkname Loadtxt py.loadtxt -func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object From 2bc032228fd32688b445c143e1503e6a8796c939 Mon Sep 17 00:00:00 2001 From: PengPengPeng717 <872462877.com> Date: Mon, 25 Aug 2025 19:28:11 +0800 Subject: [PATCH 88/88] Release-as: numpy/v1.26.4 --- numpy/_demo/basic_test/main.go | 27 + numpy/go.mod | 5 + numpy/go.sum | 2 + numpy/llpkg.cfg | 15 + numpy/llpyg.cfg | 7 + numpy/numpy.go | 27088 +++++++++++++++++++++++++++++++ 6 files changed, 27144 insertions(+) create mode 100644 numpy/_demo/basic_test/main.go create mode 100644 numpy/go.mod create mode 100644 numpy/go.sum create mode 100644 numpy/llpkg.cfg create mode 100644 numpy/llpyg.cfg create mode 100644 numpy/numpy.go diff --git a/numpy/_demo/basic_test/main.go b/numpy/_demo/basic_test/main.go new file mode 100644 index 00000000..c70be070 --- /dev/null +++ b/numpy/_demo/basic_test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "numpy" + + "github.com/goplus/lib/py" + "github.com/goplus/lib/py/std" +) + +func main() { + fmt.Println("=== NumPy Basic Test Demo ===") + + // 测试1: 创建数组 + fmt.Println("\n1. 创建数组测试:") + + // 创建一个简单的数组 + arr1 := py.List(1.0, 2.0, 3.0, 4.0, 5.0) + arr2 := py.List(2.0, 4.0, 6.0, 8.0, 10.0) + + // 使用numpy进行数组运算 + arr3 := numpy.Add(arr1, arr2) + std.Print(py.Str("result:"), arr3) + + fmt.Println("\n=== 测试完成 ===") +} diff --git a/numpy/go.mod b/numpy/go.mod new file mode 100644 index 00000000..fc2aaa3c --- /dev/null +++ b/numpy/go.mod @@ -0,0 +1,5 @@ +module numpy + +go 1.24.5 + +require github.com/goplus/lib v0.2.0 diff --git a/numpy/go.sum b/numpy/go.sum new file mode 100644 index 00000000..512980a5 --- /dev/null +++ b/numpy/go.sum @@ -0,0 +1,2 @@ +github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g= +github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0= diff --git a/numpy/llpkg.cfg b/numpy/llpkg.cfg new file mode 100644 index 00000000..fba1a7cf --- /dev/null +++ b/numpy/llpkg.cfg @@ -0,0 +1,15 @@ +{ + "type": "python", + "upstream": { + "installer": { + "name": "pip", + "config": { + "options": "" + } + }, + "package": { + "name": "numpy", + "version": "1.26.4" + } + } +} \ No newline at end of file diff --git a/numpy/llpyg.cfg b/numpy/llpyg.cfg new file mode 100644 index 00000000..698ff6b4 --- /dev/null +++ b/numpy/llpyg.cfg @@ -0,0 +1,7 @@ +{ + "name": "numpy", + "libName": "numpy", + "modules": [ + "numpy" + ] +} diff --git a/numpy/numpy.go b/numpy/numpy.go new file mode 100644 index 00000000..dc1217db --- /dev/null +++ b/numpy/numpy.go @@ -0,0 +1,27088 @@ +package numpy + +import ( + "github.com/goplus/lib/py" + _ "unsafe" +) + +const LLGoPackage = "py.numpy" +// +// dot(a, b, out=None) +// +// Dot product of two arrays. Specifically, +// +// - If both `a` and `b` are 1-D arrays, it is inner product of vectors +// (without complex conjugation). +// +// - If both `a` and `b` are 2-D arrays, it is matrix multiplication, +// but using :func:`matmul` or ``a @ b`` is preferred. +// +// - If either `a` or `b` is 0-D (scalar), it is equivalent to +// :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is +// preferred. +// +// - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over +// the last axis of `a` and `b`. +// +// - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a +// sum product over the last axis of `a` and the second-to-last axis of +// `b`:: +// +// dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Parameters +// ---------- +// a : array_like +// First argument. +// b : array_like +// Second argument. +// out : ndarray, optional +// Output argument. This must have the exact kind that would be returned +// if it was not used. In particular, it must have the right type, must be +// C-contiguous, and its dtype must be the dtype that would be returned +// for `dot(a,b)`. This is a performance feature. Therefore, if these +// conditions are not met, an exception is raised, instead of attempting +// to be flexible. +// +// Returns +// ------- +// output : ndarray +// Returns the dot product of `a` and `b`. If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// If `out` is given, then it is returned. +// +// Raises +// ------ +// ValueError +// If the last dimension of `a` is not the same size as +// the second-to-last dimension of `b`. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// matmul : '@' operator as method with out parameter. +// linalg.multi_dot : Chained dot product. +// +// Examples +// -------- +// >>> np.dot(3, 4) +// 12 +// +// Neither argument is complex-conjugated: +// +// >>> np.dot([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// For 2-D arrays it is the matrix product: +// +// >>> a = [[1, 0], [0, 1]] +// >>> b = [[4, 1], [2, 2]] +// >>> np.dot(a, b) +// array([[4, 1], +// [2, 2]]) +// +// >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) +// >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) +// >>> np.dot(a, b)[2,3,2,1,2,2] +// 499128 +// >>> sum(a[2,3,2,:] * b[1,2,:,2]) +// 499128 +// +// +// +//go:linkname Dot py.dot +func Dot(a *py.Object, b *py.Object, out *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with ones. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: C +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the given shape, dtype, and order. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// empty : Return a new uninitialized array. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Examples +// -------- +// >>> np.ones(5) +// array([1., 1., 1., 1., 1.]) +// +// >>> np.ones((5,), dtype=int) +// array([1, 1, 1, 1, 1]) +// +// >>> np.ones((2, 1)) +// array([[1.], +// [1.]]) +// +// >>> s = (2,2) +// >>> np.ones(s) +// array([[1., 1.], +// [1., 1.]]) +// +// +// +//go:linkname Ones py.ones +func Ones(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return selected slices of an array along given axis. +// +// When working along a given axis, a slice along that axis is returned in +// `output` for each index where `condition` evaluates to True. When +// working on a 1-D array, `compress` is equivalent to `extract`. +// +// Parameters +// ---------- +// condition : 1-D array of bools +// Array that selects which entries to return. If len(condition) +// is less than the size of `a` along the given axis, then output is +// truncated to the length of the condition array. +// a : array_like +// Array from which to extract a part. +// axis : int, optional +// Axis along which to take slices. If None (default), work on the +// flattened array. +// out : ndarray, optional +// Output array. Its type is preserved and it must be of the right +// shape to hold the output. +// +// Returns +// ------- +// compressed_array : ndarray +// A copy of `a` without the slices along axis for which `condition` +// is false. +// +// See Also +// -------- +// take, choose, diag, diagonal, select +// ndarray.compress : Equivalent method in ndarray +// extract : Equivalent method when working on 1-D arrays +// :ref:`ufuncs-output-type` +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4], [5, 6]]) +// >>> a +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.compress([0, 1], a, axis=0) +// array([[3, 4]]) +// >>> np.compress([False, True, True], a, axis=0) +// array([[3, 4], +// [5, 6]]) +// >>> np.compress([False, True], a, axis=1) +// array([[2], +// [4], +// [6]]) +// +// Working on the flattened array does not return slices along an axis but +// selects elements. +// +// >>> np.compress([False, True], a) +// array([2]) +// +// +// +//go:linkname Compress py.compress +func Compress(condition *py.Object, a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative sum of the elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// cumsum_along_axis : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to `out` is returned. The +// result has the same size as `a`, and the same shape as `a` if +// `axis` is not None or `a` is a 1-d array. +// +// See Also +// -------- +// sum : Sum array elements. +// trapz : Integration of array values using the composite trapezoidal rule. +// diff : Calculate the n-th discrete difference along given axis. +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point +// values since ``sum`` may use a pairwise summation routine, reducing +// the roundoff-error. See `sum` for more information. +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.cumsum(a) +// array([ 1, 3, 6, 10, 15, 21]) +// >>> np.cumsum(a, dtype=float) # specifies type of output value(s) +// array([ 1., 3., 6., 10., 15., 21.]) +// +// >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns +// array([[1, 2, 3], +// [5, 7, 9]]) +// >>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows +// array([[ 1, 3, 6], +// [ 4, 9, 15]]) +// +// ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` +// +// >>> b = np.array([1, 2e-9, 3e-9] * 1000000) +// >>> b.cumsum()[-1] +// 1000000.0050045159 +// >>> b.sum() +// 1000000.0050000029 +// +// +// +//go:linkname Cumsum py.cumsum +func Cumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return element-wise quotient and remainder simultaneously. +// +// .. versionadded:: 1.13.0 +// +// ``np.divmod(x, y)`` is equivalent to ``(x // y, x % y)``, but faster +// because it avoids redundant work. It is used to implement the Python +// built-in function ``divmod`` on NumPy arrays. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out1 : ndarray +// Element-wise quotient resulting from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// out2 : ndarray +// Element-wise remainder from floor division. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent to Python's ``//`` operator. +// remainder : Equivalent to Python's ``%`` operator. +// modf : Equivalent to ``divmod(x, 1)`` for positive ``x`` with the return +// values switched. +// +// Examples +// -------- +// >>> np.divmod(np.arange(5), 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +// The `divmod` function can be used as a shorthand for ``np.divmod`` on +// ndarrays. +// +// >>> x = np.arange(5) +// >>> divmod(x, 3) +// (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) +// +//go:linkname Divmod py.divmod +func Divmod(x1 *py.Object, x2 *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the distance between x and the nearest adjacent number. +// +// Parameters +// ---------- +// x : array_like +// Values to find the spacing of. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The spacing of values of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// It can be considered as a generalization of EPS: +// ``spacing(np.float64(1)) == np.finfo(np.float64).eps``, and there +// should not be any representable number between ``x + spacing(x)`` and +// x for any finite x. +// +// Spacing of +- inf and NaN is NaN. +// +// Examples +// -------- +// >>> np.spacing(1) == np.finfo(np.float64).eps +// True +// +//go:linkname Spacing py.spacing +func Spacing(x *py.Object, out *py.Object) *py.Object +// +// View inputs as arrays with at least two dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted +// to arrays. Arrays that already have two or more dimensions are +// preserved. +// +// Returns +// ------- +// res, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 2``. +// Copies are avoided where possible, and views with two or more +// dimensions are returned. +// +// See Also +// -------- +// atleast_1d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_2d(3.0) +// array([[3.]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_2d(x) +// array([[0., 1., 2.]]) +// >>> np.atleast_2d(x).base is x +// True +// +// >>> np.atleast_2d(1, [1, 2], [[1, 2]]) +// [array([[1]]), array([[1, 2]]), array([[1, 2]])] +// +// +// +//go:linkname Atleast2d py.atleast_2d +func Atleast2d(__llgo_va_list ...interface{}) *py.Object +// +// Return an array copy of the given object. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the copy. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. (Note that this function and :meth:`ndarray.copy` are very +// similar, but have different default values for their order= +// arguments.) +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise the +// returned array will be forced to be a base-class array (defaults to False). +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// arr : ndarray +// Array interpretation of `a`. +// +// See Also +// -------- +// ndarray.copy : Preferred method for creating an array copy +// +// Notes +// ----- +// This is equivalent to: +// +// >>> np.array(a, copy=True) #doctest: +SKIP +// +// Examples +// -------- +// Create an array x, with a reference y and a copy z: +// +// >>> x = np.array([1, 2, 3]) +// >>> y = x +// >>> z = np.copy(x) +// +// Note that, when we modify x, y changes, but not z: +// +// >>> x[0] = 10 +// >>> x[0] == y[0] +// True +// >>> x[0] == z[0] +// False +// +// Note that, np.copy clears previously set WRITEABLE=False flag. +// +// >>> a = np.array([1, 2, 3]) +// >>> a.flags["WRITEABLE"] = False +// >>> b = np.copy(a) +// >>> b.flags["WRITEABLE"] +// True +// >>> b[0] = 3 +// >>> b +// array([3, 2, 3]) +// +// Note that np.copy is a shallow copy and will not copy object +// elements within arrays. This is mainly important for arrays +// containing Python objects. The new array will contain the +// same object which may lead to surprises if that object can +// be modified (is mutable): +// +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> b = np.copy(a) +// >>> b[2][0] = 10 +// >>> a +// array([1, 'm', list([10, 3, 4])], dtype=object) +// +// To ensure all elements within an ``object`` array are copied, +// use `copy.deepcopy`: +// +// >>> import copy +// >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object) +// >>> c = copy.deepcopy(a) +// >>> c[2][0] = 10 +// >>> c +// array([1, 'm', list([10, 3, 4])], dtype=object) +// >>> a +// array([1, 'm', list([2, 3, 4])], dtype=object) +// +// +// +//go:linkname Copy py.copy +func Copy(a *py.Object, order *py.Object, subok *py.Object) *py.Object +// ascontiguousarray(a, dtype=None, *, like=None) +// +// Return a contiguous array (ndim >= 1) in memory (C order). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// Data-type of returned array. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Contiguous array of same shape and content as `a`, with type `dtype` +// if specified. +// +// See Also +// -------- +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Calling ``ascontiguousarray`` makes a C-contiguous copy: +// +// >>> y = np.ascontiguousarray(x) +// >>> y.flags['C_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Then, calling ``ascontiguousarray`` returns the same object: +// +// >>> y = np.ascontiguousarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Ascontiguousarray py.ascontiguousarray +func Ascontiguousarray(a *py.Object, dtype *py.Object) *py.Object +// promote_types(type1, type2) +// +// Returns the data type with the smallest size and smallest scalar +// kind to which both ``type1`` and ``type2`` may be safely cast. +// The returned data type is always considered "canonical", this mainly +// means that the promoted dtype will always be in native byte order. +// +// This function is symmetric, but rarely associative. +// +// Parameters +// ---------- +// type1 : dtype or dtype specifier +// First data type. +// type2 : dtype or dtype specifier +// Second data type. +// +// Returns +// ------- +// out : dtype +// The promoted data type. +// +// Notes +// ----- +// Please see `numpy.result_type` for additional information about promotion. +// +// .. versionadded:: 1.6.0 +// +// Starting in NumPy 1.9, promote_types function now returns a valid string +// length when given an integer or float dtype as one argument and a string +// dtype as another argument. Previously it always returned the input string +// dtype, even if it wasn't long enough to store the max integer/float value +// converted to a string. +// +// .. versionchanged:: 1.23.0 +// +// NumPy now supports promotion for more structured dtypes. It will now +// remove unnecessary padding from a structure dtype and promote included +// fields individually. +// +// See Also +// -------- +// result_type, dtype, can_cast +// +// Examples +// -------- +// >>> np.promote_types('f4', 'f8') +// dtype('float64') +// +// >>> np.promote_types('i8', 'f4') +// dtype('float64') +// +// >>> np.promote_types('>i8', '>> np.promote_types('i4', 'S8') +// dtype('S11') +// +// An example of a non-associative case: +// +// >>> p = np.promote_types +// >>> p('S', p('i1', 'u1')) +// dtype('S6') +// >>> p(p('S', 'i1'), 'u1') +// dtype('S4') +// +//go:linkname PromoteTypes py.promote_types +func PromoteTypes(type1 *py.Object, type2 *py.Object) *py.Object +// +// Return an array of zeros with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.zeros_like(x) +// array([[0, 0, 0], +// [0, 0, 0]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.zeros_like(y) +// array([0., 0., 0.]) +// +// +// +//go:linkname ZerosLike py.zeros_like +func ZerosLike(__llgo_va_list ...interface{}) *py.Object +// +// may_share_memory(a, b, /, max_work=None) +// +// Determine if two arrays might share memory +// +// A return of True does not necessarily mean that the two arrays +// share any element. It just means that they *might*. +// +// Only the memory bounds of a and b are checked by default. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem. See +// `shares_memory` for details. Default for ``may_share_memory`` +// is to do a bounds check. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// shares_memory +// +// Examples +// -------- +// >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) +// False +// >>> x = np.zeros([3, 4]) +// >>> np.may_share_memory(x[:,0], x[:,1]) +// True +// +// +// +//go:linkname MayShareMemory py.may_share_memory +func MayShareMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Sum of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Elements to sum. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a sum is performed. The default, +// axis=None, will sum all of the elements of the input array. If +// axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a sum is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// dtype : dtype, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. The dtype of `a` is used by default unless `a` +// has an integer dtype of less precision than the default platform +// integer. In that case, if `a` is signed then the platform integer +// is used while if `a` is unsigned then an unsigned integer of the +// same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `sum` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// sum_along_axis : ndarray +// An array with the same shape as `a`, with the specified +// axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar +// is returned. If an output array is specified, a reference to +// `out` is returned. +// +// See Also +// -------- +// ndarray.sum : Equivalent method. +// +// add.reduce : Equivalent functionality of `add`. +// +// cumsum : Cumulative sum of array elements. +// +// trapz : Integration of array values using the composite trapezoidal rule. +// +// mean, average +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// The sum of an empty array is the neutral element 0: +// +// >>> np.sum([]) +// 0.0 +// +// For floating point numbers the numerical precision of sum (and +// ``np.add.reduce``) is in general limited by directly adding each number +// individually to the result causing rounding errors in every step. +// However, often numpy will use a numerically better approach (partial +// pairwise summation) leading to improved precision in many use-cases. +// This improved precision is always provided when no ``axis`` is given. +// When ``axis`` is given, it will depend on which axis is summed. +// Technically, to provide the best speed possible, the improved precision +// is only used when the summation is along the fast axis in memory. +// Note that the exact precision may vary depending on other parameters. +// In contrast to NumPy, Python's ``math.fsum`` function uses a slower but +// more precise approach to summation. +// Especially when summing a large number of lower precision floating point +// numbers, such as ``float32``, numerical errors can become significant. +// In such cases it can be advisable to use `dtype="float64"` to use a higher +// precision for the output. +// +// Examples +// -------- +// >>> np.sum([0.5, 1.5]) +// 2.0 +// >>> np.sum([0.5, 0.7, 0.2, 1.5], dtype=np.int32) +// 1 +// >>> np.sum([[0, 1], [0, 5]]) +// 6 +// >>> np.sum([[0, 1], [0, 5]], axis=0) +// array([0, 6]) +// >>> np.sum([[0, 1], [0, 5]], axis=1) +// array([1, 5]) +// >>> np.sum([[0, 1], [np.nan, 5]], where=[False, True], axis=1) +// array([1., 5.]) +// +// If the accumulator is too small, overflow occurs: +// +// >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) +// -128 +// +// You can also start the sum with a value other than zero: +// +// >>> np.sum([10], initial=5) +// 15 +// +// +//go:linkname Sum py.sum +func Sum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. +// +// The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is +// the signed angle in radians between the ray ending at the origin and +// passing through the point (1,0), and the ray ending at the origin and +// passing through the point (`x2`, `x1`). (Note the role reversal: the +// "`y`-coordinate" is the first function parameter, the "`x`-coordinate" +// is the second.) By IEEE convention, this function is defined for +// `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see +// Notes for specific values). +// +// This function is not defined for complex-valued arguments; for the +// so-called argument of complex values, use `angle`. +// +// Parameters +// ---------- +// x1 : array_like, real-valued +// `y`-coordinates. +// x2 : array_like, real-valued +// `x`-coordinates. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// Array of angles in radians, in the range ``[-pi, pi]``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// arctan, tan, angle +// +// Notes +// ----- +// *arctan2* is identical to the `atan2` function of the underlying +// C library. The following special values are defined in the C +// standard: [1]_ +// +// ====== ====== ================ +// `x1` `x2` `arctan2(x1,x2)` +// ====== ====== ================ +// +/- 0 +0 +/- 0 +// +/- 0 -0 +/- pi +// > 0 +/-inf +0 / +pi +// < 0 +/-inf -0 / -pi +// +/-inf +inf +/- (pi/4) +// +/-inf -inf +/- (3*pi/4) +// ====== ====== ================ +// +// Note that +0 and -0 are distinct floating point numbers, as are +inf +// and -inf. +// +// References +// ---------- +// .. [1] ISO/IEC standard 9899:1999, "Programming language C." +// +// Examples +// -------- +// Consider four points in different quadrants: +// +// >>> x = np.array([-1, +1, +1, -1]) +// >>> y = np.array([-1, -1, +1, +1]) +// >>> np.arctan2(y, x) * 180 / np.pi +// array([-135., -45., 45., 135.]) +// +// Note the order of the parameters. `arctan2` is defined also when `x2` = 0 +// and at several other special points, obtaining values in +// the range ``[-pi, pi]``: +// +// >>> np.arctan2([1., -1.], [0., 0.]) +// array([ 1.57079633, -1.57079633]) +// >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) +// array([0. , 3.14159265, 0.78539816]) +// +//go:linkname Arctan2 py.arctan2 +func Arctan2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set printing options. +// +// These options determine the way floating point numbers, arrays and +// other NumPy objects are displayed. +// +// Parameters +// ---------- +// precision : int or None, optional +// Number of digits of precision for floating point output (default 8). +// May be None if `floatmode` is not `fixed`, to print as many digits as +// necessary to uniquely specify the value. +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr (default 1000). +// To always use the full repr without summarization, pass `sys.maxsize`. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension (default 3). +// linewidth : int, optional +// The number of characters per line for the purpose of inserting +// line breaks (default 75). +// suppress : bool, optional +// If True, always print floating point numbers using fixed point +// notation, in which case numbers equal to zero in the current precision +// will print as zero. If False, then scientific notation is used when +// absolute value of the smallest number is < 1e-4 or the ratio of the +// maximum absolute value to the minimum is > 1e3. The default is False. +// nanstr : str, optional +// String representation of floating point not-a-number (default nan). +// infstr : str, optional +// String representation of floating point infinity (default inf). +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. (default '-') +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// - 'object' : `np.object_` arrays +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. Can take the following values +// (default maxprec_equal): +// +// * 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// * 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// * 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// * 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. This also +// enables 1.21 legacy printing mode (described below). +// +// If set to the string `'1.21'` enables 1.21 legacy printing mode. This +// approximates numpy 1.21 print output of complex structured dtypes +// by not inserting spaces after commas that separate fields and after +// colons. +// +// If set to `False`, disables legacy mode. +// +// Unrecognized strings will be ignored with a warning for forward +// compatibility. +// +// .. versionadded:: 1.14.0 +// .. versionchanged:: 1.22.0 +// +// See Also +// -------- +// get_printoptions, printoptions, set_string_function, array2string +// +// Notes +// ----- +// `formatter` is always reset with a call to `set_printoptions`. +// +// Use `printoptions` as a context manager to set the values temporarily. +// +// Examples +// -------- +// Floating point precision can be set: +// +// >>> np.set_printoptions(precision=4) +// >>> np.array([1.123456789]) +// [1.1235] +// +// Long arrays can be summarised: +// +// >>> np.set_printoptions(threshold=5) +// >>> np.arange(10) +// array([0, 1, 2, ..., 7, 8, 9]) +// +// Small results can be suppressed: +// +// >>> eps = np.finfo(float).eps +// >>> x = np.arange(4.) +// >>> x**2 - (x + eps)**2 +// array([-4.9304e-32, -4.4409e-16, 0.0000e+00, 0.0000e+00]) +// >>> np.set_printoptions(suppress=True) +// >>> x**2 - (x + eps)**2 +// array([-0., -0., 0., 0.]) +// +// A custom formatter can be used to display array elements as desired: +// +// >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)}) +// >>> x = np.arange(3) +// >>> x +// array([int: 0, int: -1, int: -2]) +// >>> np.set_printoptions() # formatter gets reset +// >>> x +// array([0, 1, 2]) +// +// To put back the default options, you can use: +// +// >>> np.set_printoptions(edgeitems=3, infstr='inf', +// ... linewidth=75, nanstr='nan', precision=8, +// ... suppress=False, threshold=1000, formatter=None) +// +// Also to temporarily override options, use `printoptions` as a context manager: +// +// >>> with np.printoptions(precision=2, suppress=True, threshold=5): +// ... np.linspace(0, 10, 10) +// array([ 0. , 1.11, 2.22, ..., 7.78, 8.89, 10. ]) +// +// +// +//go:linkname SetPrintoptions py.set_printoptions +func SetPrintoptions(precision *py.Object, threshold *py.Object, edgeitems *py.Object, linewidth *py.Object, suppress *py.Object, nanstr *py.Object, infstr *py.Object, formatter *py.Object, sign *py.Object, floatmode *py.Object) *py.Object +// +// Compute the median along the specified axis. +// +// Returns the median of the array elements. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `arr`. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i +// e., ``V_sorted[(N-1)/2]``, when ``N`` is odd, and the average of the +// two middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.median(a) +// 3.5 +// >>> np.median(a, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.median(a, axis=1) +// array([7., 2.]) +// >>> m = np.median(a, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.median(a, axis=0, out=m) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.median(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.median(b, axis=None, overwrite_input=True) +// 3.5 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Median py.median +func Median(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// `y`-coordinate on the unit circle. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// angle : ndarray +// The inverse sine of each element in `x`, in radians and in the +// closed interval ``[-pi/2, pi/2]``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// sin, cos, arccos, tan, arctan, arctan2, emath.arcsin +// +// Notes +// ----- +// `arcsin` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that :math:`sin(z) = x`. The convention is to +// return the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, *arcsin* always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arcsin` is a complex analytic function that +// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is +// continuous from above on the former and from below on the latter. +// +// The inverse sine is also known as `asin` or sin^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79ff. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// >>> np.arcsin(1) # pi/2 +// 1.5707963267948966 +// >>> np.arcsin(-1) # -pi/2 +// -1.5707963267948966 +// >>> np.arcsin(0) +// 0.0 +// +//go:linkname Arcsin py.arcsin +func Arcsin(x *py.Object, out *py.Object) *py.Object +// deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Angles in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in radians. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : Convert angles from radians to degrees. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// ``deg2rad(x)`` is ``x * pi / 180``. +// +// Examples +// -------- +// >>> np.deg2rad(180) +// 3.1415926535897931 +// +//go:linkname Deg2rad py.deg2rad +func Deg2rad(x *py.Object, out *py.Object) *py.Object +// frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Decompose the elements of x into mantissa and twos exponent. +// +// Returns (`mantissa`, `exponent`), where ``x = mantissa * 2**exponent``. +// The mantissa lies in the open interval(-1, 1), while the twos +// exponent is a signed integer. +// +// Parameters +// ---------- +// x : array_like +// Array of numbers to be decomposed. +// out1 : ndarray, optional +// Output array for the mantissa. Must have the same shape as `x`. +// out2 : ndarray, optional +// Output array for the exponent. Must have the same shape as `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// mantissa : ndarray +// Floating values between -1 and 1. +// This is a scalar if `x` is a scalar. +// exponent : ndarray +// Integer exponents of 2. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ldexp : Compute ``y = x1 * 2**x2``, the inverse of `frexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// Examples +// -------- +// >>> x = np.arange(9) +// >>> y1, y2 = np.frexp(x) +// >>> y1 +// array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, +// 0.5 ]) +// >>> y2 +// array([0, 1, 2, 2, 3, 3, 3, 3, 4]) +// >>> y1 * 2**y2 +// array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) +// +//go:linkname Frexp py.frexp +func Frexp(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Trim the leading and/or trailing zeros from a 1-D array or sequence. +// +// Parameters +// ---------- +// filt : 1-D array or sequence +// Input array. +// trim : str, optional +// A string with 'f' representing trim from front and 'b' to trim from +// back. Default is 'fb', trim zeros from both front and back of the +// array. +// +// Returns +// ------- +// trimmed : 1-D array or sequence +// The result of trimming the input. The input data type is preserved. +// +// Examples +// -------- +// >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)) +// >>> np.trim_zeros(a) +// array([1, 2, 3, 0, 2, 1]) +// +// >>> np.trim_zeros(a, 'b') +// array([0, 0, 0, ..., 0, 2, 1]) +// +// The input data type is preserved, list/tuple in means list/tuple out. +// +// >>> np.trim_zeros([0, 1, 2, 0]) +// [1, 2] +// +// +// +//go:linkname TrimZeros py.trim_zeros +func TrimZeros(filt *py.Object, trim *py.Object) *py.Object +// +// Return the Hanning window. +// +// The Hanning window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray, shape(M,) +// The window, with the maximum value normalized to one (the value +// one appears only if `M` is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, kaiser +// +// Notes +// ----- +// The Hanning window is defined as +// +// .. math:: w(n) = 0.5 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hanning was named for Julius von Hann, an Austrian meteorologist. +// It is also known as the Cosine Bell. Some authors prefer that it be +// called a Hann window, to help avoid confusion with the very similar +// Hamming window. +// +// Most references to the Hanning window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 106-108. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hanning(12) +// array([0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037, +// 0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249, +// 0.07937323, 0. ]) +// +// Plot the window and its frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hanning(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hann window") +// Text(0.5, 1.0, 'Hann window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of the Hann window") +// Text(0.5, 1.0, 'Frequency response of the Hann window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hanning py.hanning +func Hanning(M *py.Object) *py.Object +// +// Create a two-dimensional array with the flattened input as a diagonal. +// +// Parameters +// ---------- +// v : array_like +// Input data, which is flattened and set as the `k`-th +// diagonal of the output. +// k : int, optional +// Diagonal to set; 0, the default, corresponds to the "main" diagonal, +// a positive (negative) `k` giving the number of the diagonal above +// (below) the main. +// +// Returns +// ------- +// out : ndarray +// The 2-D output array. +// +// See Also +// -------- +// diag : MATLAB work-alike for 1-D and 2-D arrays. +// diagonal : Return specified diagonals. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> np.diagflat([[1,2], [3,4]]) +// array([[1, 0, 0, 0], +// [0, 2, 0, 0], +// [0, 0, 3, 0], +// [0, 0, 0, 4]]) +// +// >>> np.diagflat([1,2], 1) +// array([[0, 1, 0], +// [0, 0, 2], +// [0, 0, 0]]) +// +// +// +//go:linkname Diagflat py.diagflat +func Diagflat(v *py.Object, k *py.Object) *py.Object +// +// Generate a Vandermonde matrix. +// +// The columns of the output matrix are powers of the input vector. The +// order of the powers is determined by the `increasing` boolean argument. +// Specifically, when `increasing` is False, the `i`-th output column is +// the input vector raised element-wise to the power of ``N - i - 1``. Such +// a matrix with a geometric progression in each row is named for Alexandre- +// Theophile Vandermonde. +// +// Parameters +// ---------- +// x : array_like +// 1-D input array. +// N : int, optional +// Number of columns in the output. If `N` is not specified, a square +// array is returned (``N = len(x)``). +// increasing : bool, optional +// Order of the powers of the columns. If True, the powers increase +// from left to right, if False (the default) they are reversed. +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : ndarray +// Vandermonde matrix. If `increasing` is False, the first column is +// ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is +// True, the columns are ``x^0, x^1, ..., x^(N-1)``. +// +// See Also +// -------- +// polynomial.polynomial.polyvander +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 5]) +// >>> N = 3 +// >>> np.vander(x, N) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> np.column_stack([x**(N-1-i) for i in range(N)]) +// array([[ 1, 1, 1], +// [ 4, 2, 1], +// [ 9, 3, 1], +// [25, 5, 1]]) +// +// >>> x = np.array([1, 2, 3, 5]) +// >>> np.vander(x) +// array([[ 1, 1, 1, 1], +// [ 8, 4, 2, 1], +// [ 27, 9, 3, 1], +// [125, 25, 5, 1]]) +// >>> np.vander(x, increasing=True) +// array([[ 1, 1, 1, 1], +// [ 1, 2, 4, 8], +// [ 1, 3, 9, 27], +// [ 1, 5, 25, 125]]) +// +// The determinant of a square Vandermonde matrix is the product +// of the differences between the values of the input vector: +// +// >>> np.linalg.det(np.vander(x)) +// 48.000000000000043 # may vary +// >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) +// 48 +// +// +// +//go:linkname Vander py.vander +func Vander(x *py.Object, N *py.Object, increasing *py.Object) *py.Object +// +// Return the indices for the upper-triangle of arr. +// +// See `triu_indices` for full details. +// +// Parameters +// ---------- +// arr : ndarray, shape(N, N) +// The indices will be valid for square arrays. +// k : int, optional +// Diagonal offset (see `triu` for details). +// +// Returns +// ------- +// triu_indices_from : tuple, shape(2) of ndarray, shape(N) +// Indices for the upper-triangle of `arr`. +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the upper triangular elements. +// +// >>> triui = np.triu_indices_from(a) +// >>> triui +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// >>> a[triui] +// array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) +// +// This is syntactic sugar for triu_indices(). +// +// >>> np.triu_indices(a.shape[0]) +// (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) +// +// Use the `k` parameter to return the indices for the upper triangular array +// from the k-th diagonal. +// +// >>> triuim1 = np.triu_indices_from(a, k=1) +// >>> a[triuim1] +// array([ 1, 2, 3, 6, 7, 11]) +// +// +// See Also +// -------- +// triu_indices, triu, tril_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TriuIndicesFrom py.triu_indices_from +func TriuIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// set_numeric_ops(op1=func1, op2=func2, ...) +// +// Set numerical operators for array objects. +// +// .. deprecated:: 1.16 +// +// For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. +// For ndarray subclasses, define the ``__array_ufunc__`` method and +// override the relevant ufunc. +// +// Parameters +// ---------- +// op1, op2, ... : callable +// Each ``op = func`` pair describes an operator to be replaced. +// For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace +// addition by modulus 5 addition. +// +// Returns +// ------- +// saved_ops : list of callables +// A list of all operators, stored before making replacements. +// +// Notes +// ----- +// .. warning:: +// Use with care! Incorrect usage may lead to memory errors. +// +// A function replacing an operator cannot make use of that operator. +// For example, when replacing add, you may not use ``+``. Instead, +// directly call ufuncs. +// +// Examples +// -------- +// >>> def add_mod5(x, y): +// ... return np.add(x, y) % 5 +// ... +// >>> old_funcs = np.set_numeric_ops(add=add_mod5) +// +// >>> x = np.arange(12).reshape((3, 4)) +// >>> x + x +// array([[0, 2, 4, 1], +// [3, 0, 2, 4], +// [1, 3, 0, 2]]) +// +// >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators +// +//go:linkname SetNumericOps py.set_numeric_ops +func SetNumericOps(op1 *py.Object, op2 *py.Object) *py.Object +// +// Test whether any array element along a given axis evaluates to True. +// +// Returns single boolean if `axis` is ``None`` +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical OR reduction is performed. +// The default (``axis=None``) is to perform a logical OR over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output and its type is preserved +// (e.g., if it is of type float, then it will remain so, returning +// 1.0 for True and 0.0 for False, regardless of the type of `a`). +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `any` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for any `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// any : bool or ndarray +// A new boolean or `ndarray` is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.any : equivalent method +// +// all : Test whether all elements along a given axis evaluate to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity evaluate +// to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.any([[True, False], [True, True]]) +// True +// +// >>> np.any([[True, False], [False, False]], axis=0) +// array([ True, False]) +// +// >>> np.any([-1, 0, 5]) +// True +// +// >>> np.any(np.nan) +// True +// +// >>> np.any([[True, False], [False, False]], where=[[False], [True]]) +// False +// +// >>> o=np.array(False) +// >>> z=np.any([-1, 4, 5], out=o) +// >>> z, o +// (array(True), array(True)) +// >>> # Check now that z is a reference to o +// >>> z is o +// True +// >>> id(z), id(o) # identity of z and o # doctest: +SKIP +// (191614240, 191614240) +// +// +// +//go:linkname Any py.any +func Any(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Multiply arguments element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays to be multiplied. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The product of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to `x1` * `x2` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.multiply(2.0, 4.0) +// 8.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.multiply(x1, x2) +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +// The ``*`` operator can be used as a shorthand for ``np.multiply`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 * x2 +// array([[ 0., 1., 4.], +// [ 0., 4., 10.], +// [ 0., 7., 16.]]) +// +//go:linkname Multiply py.multiply +func Multiply(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the elements of an array that satisfy some condition. +// +// This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If +// `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``. +// +// Note that `place` does the exact opposite of `extract`. +// +// Parameters +// ---------- +// condition : array_like +// An array whose nonzero or True entries indicate the elements of `arr` +// to extract. +// arr : array_like +// Input array of the same size as `condition`. +// +// Returns +// ------- +// extract : ndarray +// Rank 1 array of values from `arr` where `condition` is True. +// +// See Also +// -------- +// take, put, copyto, compress, place +// +// Examples +// -------- +// >>> arr = np.arange(12).reshape((3, 4)) +// >>> arr +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]]) +// >>> condition = np.mod(arr, 3)==0 +// >>> condition +// array([[ True, False, False, True], +// [False, False, True, False], +// [False, True, False, False]]) +// >>> np.extract(condition, arr) +// array([0, 3, 6, 9]) +// +// +// If `condition` is boolean: +// +// >>> arr[condition] +// array([0, 3, 6, 9]) +// +// +// +//go:linkname Extract py.extract +func Extract(condition *py.Object, arr *py.Object) *py.Object +// Convert the input to an array, checking for NaNs or Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. Success requires no NaNs or Infs. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray. If `a` is a subclass of ndarray, a base +// class ndarray is returned. +// +// Raises +// ------ +// ValueError +// Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). +// +// See Also +// -------- +// asarray : Create and array. +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array. If all elements are finite +// ``asarray_chkfinite`` is identical to ``asarray``. +// +// >>> a = [1, 2] +// >>> np.asarray_chkfinite(a, dtype=float) +// array([1., 2.]) +// +// Raises ValueError if array_like contains Nans or Infs. +// +// >>> a = [1, 2, np.inf] +// >>> try: +// ... np.asarray_chkfinite(a) +// ... except ValueError: +// ... print('ValueError') +// ... +// ValueError +// +// +// +//go:linkname AsarrayChkfinite py.asarray_chkfinite +func AsarrayChkfinite(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Extract a diagonal or construct a diagonal array. +// +// See the more detailed documentation for ``numpy.diagonal`` if you use this +// function to extract a diagonal and wish to write to the resulting array; +// whether it returns a copy or a view depends on what version of numpy you +// are using. +// +// Parameters +// ---------- +// v : array_like +// If `v` is a 2-D array, return a copy of its `k`-th diagonal. +// If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th +// diagonal. +// k : int, optional +// Diagonal in question. The default is 0. Use `k>0` for diagonals +// above the main diagonal, and `k<0` for diagonals below the main +// diagonal. +// +// Returns +// ------- +// out : ndarray +// The extracted diagonal or constructed diagonal array. +// +// See Also +// -------- +// diagonal : Return specified diagonals. +// diagflat : Create a 2-D array with the flattened input as a diagonal. +// trace : Sum along diagonals. +// triu : Upper triangle of an array. +// tril : Lower triangle of an array. +// +// Examples +// -------- +// >>> x = np.arange(9).reshape((3,3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// +// >>> np.diag(x) +// array([0, 4, 8]) +// >>> np.diag(x, k=1) +// array([1, 5]) +// >>> np.diag(x, k=-1) +// array([3, 7]) +// +// >>> np.diag(np.diag(x)) +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 8]]) +// +// +// +//go:linkname Diag py.diag +func Diag(v *py.Object, k *py.Object) *py.Object +// +// Lower triangle of an array. +// +// Return a copy of an array with elements above the `k`-th diagonal zeroed. +// For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two +// axes. +// +// Parameters +// ---------- +// m : array_like, shape (..., M, N) +// Input array. +// k : int, optional +// Diagonal above which to zero elements. `k = 0` (the default) is the +// main diagonal, `k < 0` is below it and `k > 0` is above. +// +// Returns +// ------- +// tril : ndarray, shape (..., M, N) +// Lower triangle of `m`, of same shape and data-type as `m`. +// +// See Also +// -------- +// triu : same thing, only for the upper triangle +// +// Examples +// -------- +// >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 0, 0, 0], +// [ 4, 0, 0], +// [ 7, 8, 0], +// [10, 11, 12]]) +// +// >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 0, 0, 0, 0], +// [ 5, 6, 0, 0, 0], +// [10, 11, 12, 0, 0], +// [15, 16, 17, 18, 0]], +// [[20, 0, 0, 0, 0], +// [25, 26, 0, 0, 0], +// [30, 31, 32, 0, 0], +// [35, 36, 37, 38, 0]], +// [[40, 0, 0, 0, 0], +// [45, 46, 0, 0, 0], +// [50, 51, 52, 0, 0], +// [55, 56, 57, 58, 0]]]) +// +// +// +//go:linkname Tril py.tril +func Tril(m *py.Object, k *py.Object) *py.Object +// +// Pad an array. +// +// Parameters +// ---------- +// array : array_like of rank N +// The array to pad. +// pad_width : {sequence, array_like, int} +// Number of values padded to the edges of each axis. +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths +// for each axis. +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after pad for each axis. +// ``(pad,)`` or ``int`` is a shortcut for before = after = pad width +// for all axes. +// mode : str or function, optional +// One of the following string values or a user supplied function. +// +// 'constant' (default) +// Pads with a constant value. +// 'edge' +// Pads with the edge values of array. +// 'linear_ramp' +// Pads with the linear ramp between end_value and the +// array edge value. +// 'maximum' +// Pads with the maximum value of all or part of the +// vector along each axis. +// 'mean' +// Pads with the mean value of all or part of the +// vector along each axis. +// 'median' +// Pads with the median value of all or part of the +// vector along each axis. +// 'minimum' +// Pads with the minimum value of all or part of the +// vector along each axis. +// 'reflect' +// Pads with the reflection of the vector mirrored on +// the first and last values of the vector along each +// axis. +// 'symmetric' +// Pads with the reflection of the vector mirrored +// along the edge of the array. +// 'wrap' +// Pads with the wrap of the vector along the axis. +// The first values are used to pad the end and the +// end values are used to pad the beginning. +// 'empty' +// Pads with undefined values. +// +// .. versionadded:: 1.17 +// +// +// Padding function, see Notes. +// stat_length : sequence or int, optional +// Used in 'maximum', 'mean', 'median', and 'minimum'. Number of +// values at edge of each axis used to calculate the statistic value. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique statistic +// lengths for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after statistic lengths for each axis. +// +// ``(stat_length,)`` or ``int`` is a shortcut for +// ``before = after = statistic`` length for all axes. +// +// Default is ``None``, to use the entire axis. +// constant_values : sequence or scalar, optional +// Used in 'constant'. The values to set the padded values for each +// axis. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after constants for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// end_values : sequence or scalar, optional +// Used in 'linear_ramp'. The values used for the ending value of the +// linear_ramp and that will form the edge of the padded array. +// +// ``((before_1, after_1), ... (before_N, after_N))`` unique end values +// for each axis. +// +// ``(before, after)`` or ``((before, after),)`` yields same before +// and after end values for each axis. +// +// ``(constant,)`` or ``constant`` is a shortcut for +// ``before = after = constant`` for all axes. +// +// Default is 0. +// reflect_type : {'even', 'odd'}, optional +// Used in 'reflect', and 'symmetric'. The 'even' style is the +// default with an unaltered reflection around the edge value. For +// the 'odd' style, the extended part of the array is created by +// subtracting the reflected values from two times the edge value. +// +// Returns +// ------- +// pad : ndarray +// Padded array of rank equal to `array` with shape increased +// according to `pad_width`. +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For an array with rank greater than 1, some of the padding of later +// axes is calculated from padding of previous axes. This is easiest to +// think about with a rank 2 array where the corners of the padded array +// are calculated by using padded values from the first axis. +// +// The padding function, if used, should modify a rank 1 array in-place. It +// has the following signature:: +// +// padding_func(vector, iaxis_pad_width, iaxis, kwargs) +// +// where +// +// vector : ndarray +// A rank 1 array already padded with zeros. Padded values are +// vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:]. +// iaxis_pad_width : tuple +// A 2-tuple of ints, iaxis_pad_width[0] represents the number of +// values padded at the beginning of vector where +// iaxis_pad_width[1] represents the number of values padded at +// the end of vector. +// iaxis : int +// The axis currently being calculated. +// kwargs : dict +// Any keyword arguments the function requires. +// +// Examples +// -------- +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6)) +// array([4, 4, 1, ..., 6, 6, 6]) +// +// >>> np.pad(a, (2, 3), 'edge') +// array([1, 1, 1, ..., 5, 5, 5]) +// +// >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4)) +// array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4]) +// +// >>> np.pad(a, (2,), 'maximum') +// array([5, 5, 1, 2, 3, 4, 5, 5, 5]) +// +// >>> np.pad(a, (2,), 'mean') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> np.pad(a, (2,), 'median') +// array([3, 3, 1, 2, 3, 4, 5, 3, 3]) +// +// >>> a = [[1, 2], [3, 4]] +// >>> np.pad(a, ((3, 2), (2, 3)), 'minimum') +// array([[1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1], +// [3, 3, 3, 4, 3, 3, 3], +// [1, 1, 1, 2, 1, 1, 1], +// [1, 1, 1, 2, 1, 1, 1]]) +// +// >>> a = [1, 2, 3, 4, 5] +// >>> np.pad(a, (2, 3), 'reflect') +// array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) +// +// >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd') +// array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// >>> np.pad(a, (2, 3), 'symmetric') +// array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3]) +// +// >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd') +// array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7]) +// +// >>> np.pad(a, (2, 3), 'wrap') +// array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3]) +// +// >>> def pad_with(vector, pad_width, iaxis, kwargs): +// ... pad_value = kwargs.get('padder', 10) +// ... vector[:pad_width[0]] = pad_value +// ... vector[-pad_width[1]:] = pad_value +// >>> a = np.arange(6) +// >>> a = a.reshape((2, 3)) +// >>> np.pad(a, 2, pad_with) +// array([[10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 0, 1, 2, 10, 10], +// [10, 10, 3, 4, 5, 10, 10], +// [10, 10, 10, 10, 10, 10, 10], +// [10, 10, 10, 10, 10, 10, 10]]) +// >>> np.pad(a, 2, pad_with, padder=100) +// array([[100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 0, 1, 2, 100, 100], +// [100, 100, 3, 4, 5, 100, 100], +// [100, 100, 100, 100, 100, 100, 100], +// [100, 100, 100, 100, 100, 100, 100]]) +// +// +//go:linkname Pad py.pad +func Pad(array *py.Object, padWidth *py.Object, mode *py.Object) *py.Object +// +// vdot(a, b, /) +// +// Return the dot product of two vectors. +// +// The vdot(`a`, `b`) function handles complex numbers differently than +// dot(`a`, `b`). If the first argument is complex the complex conjugate +// of the first argument is used for the calculation of the dot product. +// +// Note that `vdot` handles multidimensional arrays differently than `dot`: +// it does *not* perform a matrix product, but flattens input arguments +// to 1-D vectors first. Consequently, it should only be used for vectors. +// +// Parameters +// ---------- +// a : array_like +// If `a` is complex the complex conjugate is taken before calculation +// of the dot product. +// b : array_like +// Second argument to the dot product. +// +// Returns +// ------- +// output : ndarray +// Dot product of `a` and `b`. Can be an int, float, or +// complex depending on the types of `a` and `b`. +// +// See Also +// -------- +// dot : Return the dot product without using the complex conjugate of the +// first argument. +// +// Examples +// -------- +// >>> a = np.array([1+2j,3+4j]) +// >>> b = np.array([5+6j,7+8j]) +// >>> np.vdot(a, b) +// (70-8j) +// >>> np.vdot(b, a) +// (70+8j) +// +// Note that higher-dimensional arrays are flattened! +// +// >>> a = np.array([[1, 4], [5, 6]]) +// >>> b = np.array([[4, 1], [2, 2]]) +// >>> np.vdot(a, b) +// 30 +// >>> np.vdot(b, a) +// 30 +// >>> 1*4 + 4*1 + 5*2 + 6*2 +// 30 +// +// +// +//go:linkname Vdot py.vdot +func Vdot(a *py.Object, b *py.Object) *py.Object +// +// Replaces specified elements of an array with given values. +// +// The indexing works on the flattened target array. `put` is roughly +// equivalent to: +// +// :: +// +// a.flat[ind] = v +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// ind : array_like +// Target indices, interpreted as integers. +// v : array_like +// Values to place in `a` at target indices. If `v` is shorter than +// `ind` it will be repeated as necessary. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. In 'raise' mode, +// if an exception occurs the target array may still be modified. +// +// See Also +// -------- +// putmask, place +// put_along_axis : Put elements by matching the array and the index arrays +// +// Examples +// -------- +// >>> a = np.arange(5) +// >>> np.put(a, [0, 2], [-44, -55]) +// >>> a +// array([-44, 1, -55, 3, 4]) +// +// >>> a = np.arange(5) +// >>> np.put(a, 22, -5, mode='clip') +// >>> a +// array([ 0, 1, 2, 3, -5]) +// +// +// +//go:linkname Put py.put +func Put(a *py.Object, ind *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Return the size of the buffer used in ufuncs. +// +// Returns +// ------- +// getbufsize : int +// Size of ufunc buffer in bytes. +// +// +// +//go:linkname Getbufsize py.getbufsize +func Getbufsize() *py.Object +// +// Convert inputs to arrays with at least one dimension. +// +// Scalar inputs are converted to 1-dimensional arrays, whilst +// higher-dimensional inputs are preserved. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more input arrays. +// +// Returns +// ------- +// ret : ndarray +// An array, or list of arrays, each with ``a.ndim >= 1``. +// Copies are made only if necessary. +// +// See Also +// -------- +// atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> np.atleast_1d(1.0) +// array([1.]) +// +// >>> x = np.arange(9.0).reshape(3,3) +// >>> np.atleast_1d(x) +// array([[0., 1., 2.], +// [3., 4., 5.], +// [6., 7., 8.]]) +// >>> np.atleast_1d(x) is x +// True +// +// >>> np.atleast_1d(1, [3, 4]) +// [array([1]), array([3, 4])] +// +// +// +//go:linkname Atleast1d py.atleast_1d +func Atleast1d(__llgo_va_list ...interface{}) *py.Object +// +// View inputs as arrays with at least three dimensions. +// +// Parameters +// ---------- +// arys1, arys2, ... : array_like +// One or more array-like sequences. Non-array inputs are converted to +// arrays. Arrays that already have three or more dimensions are +// preserved. +// +// Returns +// ------- +// res1, res2, ... : ndarray +// An array, or list of arrays, each with ``a.ndim >= 3``. Copies are +// avoided where possible, and views with three or more dimensions are +// returned. For example, a 1-D array of shape ``(N,)`` becomes a view +// of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a +// view of shape ``(M, N, 1)``. +// +// See Also +// -------- +// atleast_1d, atleast_2d +// +// Examples +// -------- +// >>> np.atleast_3d(3.0) +// array([[[3.]]]) +// +// >>> x = np.arange(3.0) +// >>> np.atleast_3d(x).shape +// (1, 3, 1) +// +// >>> x = np.arange(12.0).reshape(4,3) +// >>> np.atleast_3d(x).shape +// (4, 3, 1) +// >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself +// True +// +// >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): +// ... print(arr, arr.shape) # doctest: +SKIP +// ... +// [[[1] +// [2]]] (1, 2, 1) +// [[[1] +// [2]]] (1, 2, 1) +// [[[1 2]]] (1, 1, 2) +// +// +// +//go:linkname Atleast3d py.atleast_3d +func Atleast3d(__llgo_va_list ...interface{}) *py.Object +// +// Stack arrays in sequence depth wise (along third axis). +// +// This is equivalent to concatenation along the third axis after 2-D arrays +// of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape +// `(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by +// `dsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of arrays +// The arrays must have the same shape along all but the third axis. +// 1-D or 2-D arrays must have the same shape. +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 3-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// dsplit : Split array along third axis. +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.dstack((a,b)) +// array([[[1, 2], +// [2, 3], +// [3, 4]]]) +// +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[2],[3],[4]]) +// >>> np.dstack((a,b)) +// array([[[1, 2]], +// [[2, 3]], +// [[3, 4]]]) +// +// +// +//go:linkname Dstack py.dstack +func Dstack(tup *py.Object) *py.Object +// Find the wrapper for the array with the highest priority. +// +// In case of ties, leftmost wins. If no wrapper is found, return None +// +// +//go:linkname GetArrayWrap py.get_array_wrap +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object +// +// Broadcast any number of arrays against each other. +// +// Parameters +// ---------- +// `*args` : array_likes +// The arrays to broadcast. +// +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned arrays will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcasted : list of arrays +// These arrays are views on the original arrays. They are typically +// not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. If you need +// to write to the arrays, make copies first. While you can set the +// ``writable`` flag True, writing to a single output value may end up +// changing more than one location in the output array. +// +// .. deprecated:: 1.17 +// The output is currently marked so that if written to, a deprecation +// warning will be emitted. A future version will set the +// ``writable`` flag False so writing to it will raise an error. +// +// See Also +// -------- +// broadcast +// broadcast_to +// broadcast_shapes +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> y = np.array([[4],[5]]) +// >>> np.broadcast_arrays(x, y) +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// Here is a useful idiom for getting contiguous copies instead of +// non-contiguous views. +// +// >>> [np.array(a) for a in np.broadcast_arrays(x, y)] +// [array([[1, 2, 3], +// [1, 2, 3]]), array([[4, 4, 4], +// [5, 5, 5]])] +// +// +// +//go:linkname BroadcastArrays py.broadcast_arrays +func BroadcastArrays(__llgo_va_list ...interface{}) *py.Object +// +// concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") +// +// Join a sequence of arrays along an existing axis. +// +// Parameters +// ---------- +// a1, a2, ... : sequence of array_like +// The arrays must have the same shape, except in the dimension +// corresponding to `axis` (the first, by default). +// axis : int, optional +// The axis along which the arrays will be joined. If axis is None, +// arrays are flattened before use. Default is 0. +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what concatenate would have returned if no +// out argument were specified. +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.20.0 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// res : ndarray +// The concatenated array. +// +// See Also +// -------- +// ma.concatenate : Concatenate function that preserves input masks. +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. +// split : Split array into a list of multiple sub-arrays of equal size. +// hsplit : Split array into multiple sub-arrays horizontally (column wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// stack : Stack a sequence of arrays along a new axis. +// block : Assemble arrays from blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// +// Notes +// ----- +// When one or more of the arrays to be concatenated is a MaskedArray, +// this function will return a MaskedArray object instead of an ndarray, +// but the input masks are *not* preserved. In cases where a MaskedArray +// is expected as input, use the ma.concatenate function from the masked +// array module instead. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> b = np.array([[5, 6]]) +// >>> np.concatenate((a, b), axis=0) +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// >>> np.concatenate((a, b.T), axis=1) +// array([[1, 2, 5], +// [3, 4, 6]]) +// >>> np.concatenate((a, b), axis=None) +// array([1, 2, 3, 4, 5, 6]) +// +// This function will not preserve masking of MaskedArray inputs. +// +// >>> a = np.ma.arange(3) +// >>> a[1] = np.ma.masked +// >>> b = np.arange(2, 5) +// >>> a +// masked_array(data=[0, --, 2], +// mask=[False, True, False], +// fill_value=999999) +// >>> b +// array([2, 3, 4]) +// >>> np.concatenate([a, b]) +// masked_array(data=[0, 1, 2, 2, 3, 4], +// mask=False, +// fill_value=999999) +// >>> np.ma.concatenate([a, b]) +// masked_array(data=[0, --, 2, 2, 3, 4], +// mask=[False, True, False, False, False, False], +// fill_value=999999) +// +// +// +//go:linkname Concatenate py.concatenate +func Concatenate(list0 *py.Object, axis *py.Object, out *py.Object, dtype *py.Object, casting *py.Object) *py.Object +// +// can_cast(from_, to, casting='safe') +// +// Returns True if cast between data types can occur according to the +// casting rule. If from is a scalar or array scalar, also returns +// True if the scalar value can be cast without overflow or truncation +// to an integer. +// +// Parameters +// ---------- +// from_ : dtype, dtype specifier, scalar, or array +// Data type, scalar, or array to cast from. +// to : dtype or dtype specifier +// Data type to cast to. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Returns +// ------- +// out : bool +// True if cast can occur according to the casting rule. +// +// Notes +// ----- +// .. versionchanged:: 1.17.0 +// Casting between a simple data type and a structured one is possible only +// for "unsafe" casting. Casting to multiple fields is allowed, but +// casting from multiple fields is not. +// +// .. versionchanged:: 1.9.0 +// Casting from numeric to string types in 'safe' casting mode requires +// that the string dtype length is long enough to store the maximum +// integer/float value converted. +// +// See also +// -------- +// dtype, result_type +// +// Examples +// -------- +// Basic examples +// +// >>> np.can_cast(np.int32, np.int64) +// True +// >>> np.can_cast(np.float64, complex) +// True +// >>> np.can_cast(complex, float) +// False +// +// >>> np.can_cast('i8', 'f8') +// True +// >>> np.can_cast('i8', 'f4') +// False +// >>> np.can_cast('i4', 'S4') +// False +// +// Casting scalars +// +// >>> np.can_cast(100, 'i1') +// True +// >>> np.can_cast(150, 'i1') +// False +// >>> np.can_cast(150, 'u1') +// True +// +// >>> np.can_cast(3.5e100, np.float32) +// False +// >>> np.can_cast(1000.0, np.float32) +// True +// +// Array scalar checks the value, array does not +// +// >>> np.can_cast(np.array(1000.0), np.float32) +// True +// >>> np.can_cast(np.array([1000.0]), np.float32) +// False +// +// Using the casting rules +// +// >>> np.can_cast('i8', 'i8', 'no') +// True +// >>> np.can_cast('i8', 'no') +// False +// +// >>> np.can_cast('i8', 'equiv') +// True +// >>> np.can_cast('i8', 'equiv') +// False +// +// >>> np.can_cast('i8', 'safe') +// True +// >>> np.can_cast('i4', 'safe') +// False +// +// >>> np.can_cast('i4', 'same_kind') +// True +// >>> np.can_cast('u4', 'same_kind') +// False +// +// >>> np.can_cast('u4', 'unsafe') +// True +// +// +// +//go:linkname CanCast py.can_cast +func CanCast(from_ *py.Object, to *py.Object, casting *py.Object) *py.Object +// +// Return the identity array. +// +// The identity array is a square array with ones on +// the main diagonal. +// +// Parameters +// ---------- +// n : int +// Number of rows (and columns) in `n` x `n` output. +// dtype : data-type, optional +// Data-type of the output. Defaults to ``float``. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// `n` x `n` array with its main diagonal set to one, +// and all other elements 0. +// +// Examples +// -------- +// >>> np.identity(3) +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// +// +//go:linkname Identity py.identity +func Identity(n *py.Object, dtype *py.Object) *py.Object +// +// Remove axes of length one from `a`. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// .. versionadded:: 1.7.0 +// +// Selects a subset of the entries of length one in the +// shape. If an axis is selected with shape entry greater than +// one, an error is raised. +// +// Returns +// ------- +// squeezed : ndarray +// The input array, but with all or a subset of the +// dimensions of length 1 removed. This is always `a` itself +// or a view into `a`. Note that if all axes are squeezed, +// the result is a 0d array and not a scalar. +// +// Raises +// ------ +// ValueError +// If `axis` is not None, and an axis being squeezed is not of length 1 +// +// See Also +// -------- +// expand_dims : The inverse operation, adding entries of length one +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// +// Examples +// -------- +// >>> x = np.array([[[0], [1], [2]]]) +// >>> x.shape +// (1, 3, 1) +// >>> np.squeeze(x).shape +// (3,) +// >>> np.squeeze(x, axis=0).shape +// (3, 1) +// >>> np.squeeze(x, axis=1).shape +// Traceback (most recent call last): +// ... +// ValueError: cannot select an axis to squeeze out which has size not equal to one +// >>> np.squeeze(x, axis=2).shape +// (1, 3) +// >>> x = np.array([[1234]]) +// >>> x.shape +// (1, 1) +// >>> np.squeeze(x) +// array(1234) # 0d array +// >>> np.squeeze(x).shape +// () +// >>> np.squeeze(x)[()] +// 1234 +// +// +// +//go:linkname Squeeze py.squeeze +func Squeeze(a *py.Object, axis *py.Object) *py.Object +// cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic cosine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) + np.exp(-x))`` and ``np.cos(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array of same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.cosh(0) +// 1.0 +// +// The hyperbolic cosine describes the shape of a hanging cable: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 1000) +// >>> plt.plot(x, np.cosh(x)) +// >>> plt.show() +// +//go:linkname Cosh py.cosh +func Cosh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices for the lower-triangle of arr. +// +// See `tril_indices` for full details. +// +// Parameters +// ---------- +// arr : array_like +// The indices will be valid for square arrays whose dimensions are +// the same as arr. +// k : int, optional +// Diagonal offset (see `tril` for details). +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Pass the array to get the indices of the lower triangular elements. +// +// >>> trili = np.tril_indices_from(a) +// >>> trili +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// >>> a[trili] +// array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) +// +// This is syntactic sugar for tril_indices(). +// +// >>> np.tril_indices(a.shape[0]) +// (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) +// +// Use the `k` parameter to return the indices for the lower triangular array +// up to the k-th diagonal. +// +// >>> trili1 = np.tril_indices_from(a, k=1) +// >>> a[trili1] +// array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) +// +// See Also +// -------- +// tril_indices, tril, triu_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// +// +//go:linkname TrilIndicesFrom py.tril_indices_from +func TrilIndicesFrom(arr *py.Object, k *py.Object) *py.Object +// +// Difference (subtraction) of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Given two polynomials `a1` and `a2`, returns ``a1 - a2``. +// `a1` and `a2` can be either array_like sequences of the polynomials' +// coefficients (including coefficients equal to zero), or `poly1d` objects. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d +// Minuend and subtrahend polynomials, respectively. +// +// Returns +// ------- +// out : ndarray or poly1d +// Array or `poly1d` object of the difference polynomial's coefficients. +// +// See Also +// -------- +// polyval, polydiv, polymul, polyadd +// +// Examples +// -------- +// .. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) +// +// >>> np.polysub([2, 10, -2], [3, 10, -4]) +// array([-1, 0, 2]) +// +// +// +//go:linkname Polysub py.polysub +func Polysub(a1 *py.Object, a2 *py.Object) *py.Object +// +// Counts the number of non-zero values in the array ``a``. +// +// The word "non-zero" is in reference to the Python 2.x +// built-in method ``__nonzero__()`` (renamed ``__bool__()`` +// in Python 3.x) of Python objects that tests an object's +// "truthfulness". For example, any number is considered +// truthful if it is nonzero, whereas any string is considered +// truthful if it is not the empty string. Thus, this function +// (recursively) counts how many elements in ``a`` (and in +// sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()`` +// method evaluated to ``True``. +// +// Parameters +// ---------- +// a : array_like +// The array for which to count non-zeros. +// axis : int or tuple, optional +// Axis or tuple of axes along which to count non-zeros. +// Default is None, meaning that non-zeros will be counted +// along a flattened version of ``a``. +// +// .. versionadded:: 1.12.0 +// +// keepdims : bool, optional +// If this is set to True, the axes that are counted are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// count : int or array of int +// Number of non-zero values in the array along a given axis. +// Otherwise, the total number of non-zero values in the array +// is returned. +// +// See Also +// -------- +// nonzero : Return the coordinates of all the non-zero values. +// +// Examples +// -------- +// >>> np.count_nonzero(np.eye(4)) +// 4 +// >>> a = np.array([[0, 1, 7, 0], +// ... [3, 0, 2, 19]]) +// >>> np.count_nonzero(a) +// 5 +// >>> np.count_nonzero(a, axis=0) +// array([1, 1, 2, 1]) +// >>> np.count_nonzero(a, axis=1) +// array([2, 3]) +// >>> np.count_nonzero(a, axis=1, keepdims=True) +// array([[2], +// [3]]) +// +// +//go:linkname CountNonzero py.count_nonzero +func CountNonzero(a *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// .. deprecated:: 1.25.0 +// ``product`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `prod` instead. +// +// See Also +// -------- +// prod : equivalent function; see for details. +// +// +//go:linkname Product py.product +func Product(__llgo_va_list ...interface{}) *py.Object +// +// Round an array to the given number of decimals. +// +// `~numpy.round_` is a disrecommended backwards-compatibility +// alias of `~numpy.around` and `~numpy.round`. +// +// .. deprecated:: 1.25.0 +// ``round_`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `round` instead. +// +// See Also +// -------- +// around : equivalent function; see for details. +// +// +//go:linkname Round_ py.round_ +func Round_(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// +// Return the shape of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// shape : tuple of ints +// The elements of the shape tuple give the lengths of the +// corresponding array dimensions. +// +// See Also +// -------- +// len : ``len(a)`` is equivalent to ``np.shape(a)[0]`` for N-D arrays with +// ``N>=1``. +// ndarray.shape : Equivalent array method. +// +// Examples +// -------- +// >>> np.shape(np.eye(3)) +// (3, 3) +// >>> np.shape([[1, 3]]) +// (1, 2) +// >>> np.shape([0]) +// (1,) +// >>> np.shape(0) +// () +// +// >>> a = np.array([(1, 2), (3, 4), (5, 6)], +// ... dtype=[('x', 'i4'), ('y', 'i4')]) +// >>> np.shape(a) +// (3,) +// >>> a.shape +// (3,) +// +// +// +//go:linkname Shape py.shape +func Shape(a *py.Object) *py.Object +// log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Natural logarithm, element-wise. +// +// The natural logarithm `log` is the inverse of the exponential function, +// so that `log(exp(x)) = x`. The natural logarithm is logarithm in base +// `e`. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The natural logarithm of `x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log10, log2, log1p, emath.log +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log` always returns real output. For +// each value that cannot be expressed as a real number or infinity, it +// yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log([1, np.e, np.e**2, 0]) +// array([ 0., 1., 2., -Inf]) +// +//go:linkname Log py.log +func Log(x *py.Object, out *py.Object) *py.Object +// +// Return the scalar type of highest precision of the same kind as the input. +// +// Parameters +// ---------- +// t : dtype or dtype specifier +// The input data type. This can be a `dtype` object or an object that +// is convertible to a `dtype`. +// +// Returns +// ------- +// out : dtype +// The highest precision data type of the same kind (`dtype.kind`) as `t`. +// +// See Also +// -------- +// obj2sctype, mintypecode, sctype2char +// dtype +// +// Examples +// -------- +// >>> np.maximum_sctype(int) +// +// >>> np.maximum_sctype(np.uint8) +// +// >>> np.maximum_sctype(complex) +// # may vary +// +// >>> np.maximum_sctype(str) +// +// +// >>> np.maximum_sctype('i2') +// +// >>> np.maximum_sctype('f4') +// # may vary +// +// +// +//go:linkname MaximumSctype py.maximum_sctype +func MaximumSctype(t *py.Object) *py.Object +// +// Return a description for the given data type code. +// +// Parameters +// ---------- +// char : str +// Data type code. +// +// Returns +// ------- +// out : str +// Description of the input data type code. +// +// See Also +// -------- +// dtype, typecodes +// +// Examples +// -------- +// >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', +// ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] +// >>> for typechar in typechars: +// ... print(typechar, ' : ', np.typename(typechar)) +// ... +// S1 : character +// ? : bool +// B : unsigned char +// D : complex double precision +// G : complex long double precision +// F : complex single precision +// I : unsigned integer +// H : unsigned short +// L : unsigned long integer +// O : object +// Q : unsigned long long integer +// S : string +// U : unicode +// V : void +// b : signed char +// d : double precision +// g : long precision +// f : single precision +// i : integer +// h : short +// l : long integer +// q : long long integer +// +// +// +//go:linkname Typename py.typename +func Typename(char *py.Object) *py.Object +// +// Return the Kaiser window. +// +// The Kaiser window is a taper formed by using a Bessel function. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// beta : float +// Shape parameter for window. +// +// Returns +// ------- +// out : array +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hamming, hanning +// +// Notes +// ----- +// The Kaiser window is defined as +// +// .. math:: w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}} +// \right)/I_0(\beta) +// +// with +// +// .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2}, +// +// where :math:`I_0` is the modified zeroth-order Bessel function. +// +// The Kaiser was named for Jim Kaiser, who discovered a simple +// approximation to the DPSS window based on Bessel functions. The Kaiser +// window is a very good approximation to the Digital Prolate Spheroidal +// Sequence, or Slepian window, which is the transform which maximizes the +// energy in the main lobe of the window relative to total energy. +// +// The Kaiser can approximate many other windows by varying the beta +// parameter. +// +// ==== ======================= +// beta Window shape +// ==== ======================= +// 0 Rectangular +// 5 Similar to a Hamming +// 6 Similar to a Hanning +// 8.6 Similar to a Blackman +// ==== ======================= +// +// A beta value of 14 is probably a good starting point. Note that as beta +// gets large, the window narrows, and so the number of samples needs to be +// large enough to sample the increasingly narrow spike, otherwise NaNs will +// get returned. +// +// Most references to the Kaiser window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by +// digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. +// John Wiley and Sons, New York, (1966). +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 177-178. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.kaiser(12, 14) +// array([7.72686684e-06, 3.46009194e-03, 4.65200189e-02, # may vary +// 2.29737120e-01, 5.99885316e-01, 9.45674898e-01, +// 9.45674898e-01, 5.99885316e-01, 2.29737120e-01, +// 4.65200189e-02, 3.46009194e-03, 7.72686684e-06]) +// +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.kaiser(51, 14) +// >>> plt.plot(window) +// [] +// >>> plt.title("Kaiser window") +// Text(0.5, 1.0, 'Kaiser window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Kaiser window") +// Text(0.5, 1.0, 'Frequency response of Kaiser window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// (-0.5, 0.5, -100.0, ...) # may vary +// >>> plt.show() +// +// +// +//go:linkname Kaiser py.kaiser +func Kaiser(M *py.Object, beta *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the minimum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``min`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// min : ndarray or scalar +// Minimum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// argmin : +// Return the indices of the minimum values. +// +// nanmax, maximum, fmax +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding min value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmin. +// +// Don't use `~numpy.min` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than +// ``min(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.min(a) # Minimum of the flattened array +// 0 +// >>> np.min(a, axis=0) # Minima along the first axis +// array([0, 1]) +// >>> np.min(a, axis=1) # Minima along the second axis +// array([0, 2]) +// >>> np.min(a, where=[False, True], initial=10, axis=0) +// array([10, 1]) +// +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.min(b) +// nan +// >>> np.min(b, where=~np.isnan(b), initial=10) +// 0.0 +// >>> np.nanmin(b) +// 0.0 +// +// >>> np.min([[-50], [10]], axis=-1, initial=0) +// array([-50, 0]) +// +// Notice that the initial value is used as one of the elements for which the +// minimum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// Notice that this isn't the same as Python's ``default`` argument. +// +// >>> np.min([6], initial=5) +// 5 +// >>> min([6], default=5) +// 6 +// +// +//go:linkname Min py.min +func Min(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the variance along the specified axis. +// +// Returns the variance of the array elements, a measure of the spread of a +// distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the variance is computed. The default is to +// compute the variance of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a variance is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of elements. By +// default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `var` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If ``out=None``, returns a new array containing the variance; +// otherwise, a reference to the output array is returned. +// +// See Also +// -------- +// std, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(x)``, where ``x = abs(a - a.mean())**2``. +// +// The mean is typically calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.var(a) +// 1.25 +// >>> np.var(a, axis=0) +// array([1., 1.]) +// >>> np.var(a, axis=1) +// array([0.25, 0.25]) +// +// In single precision, var() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.var(a) +// 0.20250003 +// +// Computing the variance in float64 is more accurate: +// +// >>> np.var(a, dtype=np.float64) +// 0.20249999932944759 # may vary +// >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 +// 0.2025 +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.var(a) +// 6.833333333333333 # may vary +// >>> np.var(a, where=[[True], [True], [False]]) +// 4.0 +// +// +// +//go:linkname Var py.var +func Var(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Reverse the order of elements in an array along the given axis. +// +// The shape of the array is preserved, but the elements are reordered. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// m : array_like +// Input array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to flip over. The default, +// axis=None, will flip over all of the axes of the input array. +// If axis is negative it counts from the last to the first axis. +// +// If axis is a tuple of ints, flipping is performed on all of the axes +// specified in the tuple. +// +// .. versionchanged:: 1.15.0 +// None and tuples of axes are supported +// +// Returns +// ------- +// out : array_like +// A view of `m` with the entries of axis reversed. Since a view is +// returned, this operation is done in constant time. +// +// See Also +// -------- +// flipud : Flip an array vertically (axis=0). +// fliplr : Flip an array horizontally (axis=1). +// +// Notes +// ----- +// flip(m, 0) is equivalent to flipud(m). +// +// flip(m, 1) is equivalent to fliplr(m). +// +// flip(m, n) corresponds to ``m[...,::-1,...]`` with ``::-1`` at position n. +// +// flip(m) corresponds to ``m[::-1,::-1,...,::-1]`` with ``::-1`` at all +// positions. +// +// flip(m, (0, 1)) corresponds to ``m[::-1,::-1,...]`` with ``::-1`` at +// position 0 and position 1. +// +// Examples +// -------- +// >>> A = np.arange(8).reshape((2,2,2)) +// >>> A +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> np.flip(A, 0) +// array([[[4, 5], +// [6, 7]], +// [[0, 1], +// [2, 3]]]) +// >>> np.flip(A, 1) +// array([[[2, 3], +// [0, 1]], +// [[6, 7], +// [4, 5]]]) +// >>> np.flip(A) +// array([[[7, 6], +// [5, 4]], +// [[3, 2], +// [1, 0]]]) +// >>> np.flip(A, (0, 2)) +// array([[[5, 4], +// [7, 6]], +// [[1, 0], +// [3, 2]]]) +// >>> A = np.random.randn(3,4,5) +// >>> np.all(np.flip(A,2) == A[:,:,::-1,...]) +// True +// +// +//go:linkname Flip py.flip +func Flip(m *py.Object, axis *py.Object) *py.Object +// +// Split an array into multiple sub-arrays. +// +// Please refer to the ``split`` documentation. The only difference +// between these functions is that ``array_split`` allows +// `indices_or_sections` to be an integer that does *not* equally +// divide the axis. For an array of length l that should be split +// into n sections, it returns l % n sub-arrays of size l//n + 1 +// and the rest of size l//n. +// +// See Also +// -------- +// split : Split array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(8.0) +// >>> np.array_split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])] +// +// >>> x = np.arange(9) +// >>> np.array_split(x, 4) +// [array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])] +// +// +// +//go:linkname ArraySplit py.array_split +func ArraySplit(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Evaluate a polynomial at specific values. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// If `p` is of length N, this function returns the value: +// +// ``p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]`` +// +// If `x` is a sequence, then ``p(x)`` is returned for each element of ``x``. +// If `x` is another polynomial then the composite polynomial ``p(x(t))`` +// is returned. +// +// Parameters +// ---------- +// p : array_like or poly1d object +// 1D array of polynomial coefficients (including coefficients equal +// to zero) from highest degree to the constant term, or an +// instance of poly1d. +// x : array_like or poly1d object +// A number, an array of numbers, or an instance of poly1d, at +// which to evaluate `p`. +// +// Returns +// ------- +// values : ndarray or poly1d +// If `x` is a poly1d instance, the result is the composition of the two +// polynomials, i.e., `x` is "substituted" in `p` and the simplified +// result is returned. In addition, the type of `x` - array_like or +// poly1d - governs the type of the output: `x` array_like => `values` +// array_like, `x` a poly1d object => `values` is also. +// +// See Also +// -------- +// poly1d: A polynomial class. +// +// Notes +// ----- +// Horner's scheme [1]_ is used to evaluate the polynomial. Even so, +// for polynomials of high degree the values may be inaccurate due to +// rounding errors. Use carefully. +// +// If `x` is a subtype of `ndarray` the return value will be of the same type. +// +// References +// ---------- +// .. [1] I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. +// trans. Ed.), *Handbook of Mathematics*, New York, Van Nostrand +// Reinhold Co., 1985, pg. 720. +// +// Examples +// -------- +// >>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 +// 76 +// >>> np.polyval([3,0,1], np.poly1d(5)) +// poly1d([76]) +// >>> np.polyval(np.poly1d([3,0,1]), 5) +// 76 +// >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) +// poly1d([76]) +// +// +// +//go:linkname Polyval py.polyval +func Polyval(p *py.Object, x *py.Object) *py.Object +// +// Return the indices of the maximum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the +// results cannot be trusted if a slice contains only NaNs and -Infs. +// +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmax, nanargmin +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmax(a) +// 0 +// >>> np.nanargmax(a) +// 1 +// >>> np.nanargmax(a, axis=0) +// array([1, 0]) +// >>> np.nanargmax(a, axis=1) +// array([1, 1]) +// +// +// +//go:linkname Nanargmax py.nanargmax +func Nanargmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Move axes of an array to new positions. +// +// Other axes remain in their original order. +// +// .. versionadded:: 1.11.0 +// +// Parameters +// ---------- +// a : np.ndarray +// The array whose axes should be reordered. +// source : int or sequence of int +// Original positions of the axes to move. These must be unique. +// destination : int or sequence of int +// Destination positions for each of the original axes. These must also be +// unique. +// +// Returns +// ------- +// result : np.ndarray +// Array with moved axes. This array is a view of the input array. +// +// See Also +// -------- +// transpose : Permute the dimensions of an array. +// swapaxes : Interchange two axes of an array. +// +// Examples +// -------- +// >>> x = np.zeros((3, 4, 5)) +// >>> np.moveaxis(x, 0, -1).shape +// (4, 5, 3) +// >>> np.moveaxis(x, -1, 0).shape +// (5, 3, 4) +// +// These all achieve the same result: +// +// >>> np.transpose(x).shape +// (5, 4, 3) +// >>> np.swapaxes(x, 0, -1).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1], [-1, -2]).shape +// (5, 4, 3) +// >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape +// (5, 4, 3) +// +// +// +//go:linkname Moveaxis py.moveaxis +func Moveaxis(a *py.Object, source *py.Object, destination *py.Object) *py.Object +// +// Replace NaN with zero and infinity with large finite numbers (default +// behaviour) or with the numbers defined by the user using the `nan`, +// `posinf` and/or `neginf` keywords. +// +// If `x` is inexact, NaN is replaced by zero or by the user defined value in +// `nan` keyword, infinity is replaced by the largest finite floating point +// values representable by ``x.dtype`` or by the user defined value in +// `posinf` keyword and -infinity is replaced by the most negative finite +// floating point values representable by ``x.dtype`` or by the user defined +// value in `neginf` keyword. +// +// For complex dtypes, the above is applied to each of the real and +// imaginary components of `x` separately. +// +// If `x` is not inexact, then no replacements are made. +// +// Parameters +// ---------- +// x : scalar or array_like +// Input data. +// copy : bool, optional +// Whether to create a copy of `x` (True) or to replace values +// in-place (False). The in-place operation only occurs if +// casting to an array does not require a copy. +// Default is True. +// +// .. versionadded:: 1.13 +// nan : int, float, optional +// Value to be used to fill NaN values. If no value is passed +// then NaN values will be replaced with 0.0. +// +// .. versionadded:: 1.17 +// posinf : int, float, optional +// Value to be used to fill positive infinity values. If no value is +// passed then positive infinity values will be replaced with a very +// large number. +// +// .. versionadded:: 1.17 +// neginf : int, float, optional +// Value to be used to fill negative infinity values. If no value is +// passed then negative infinity values will be replaced with a very +// small (or negative) number. +// +// .. versionadded:: 1.17 +// +// +// +// Returns +// ------- +// out : ndarray +// `x`, with the non-finite values replaced. If `copy` is False, this may +// be `x` itself. +// +// See Also +// -------- +// isinf : Shows which elements are positive or negative infinity. +// isneginf : Shows which elements are negative infinity. +// isposinf : Shows which elements are positive infinity. +// isnan : Shows which elements are Not a Number (NaN). +// isfinite : Shows which elements are finite (not NaN, not infinity) +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.nan_to_num(np.inf) +// 1.7976931348623157e+308 +// >>> np.nan_to_num(-np.inf) +// -1.7976931348623157e+308 +// >>> np.nan_to_num(np.nan) +// 0.0 +// >>> x = np.array([np.inf, -np.inf, np.nan, -128, 128]) +// >>> np.nan_to_num(x) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(x, nan=-9999, posinf=33333333, neginf=33333333) +// array([ 3.3333333e+07, 3.3333333e+07, -9.9990000e+03, +// -1.2800000e+02, 1.2800000e+02]) +// >>> y = np.array([complex(np.inf, np.nan), np.nan, complex(np.nan, np.inf)]) +// array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, # may vary +// -1.28000000e+002, 1.28000000e+002]) +// >>> np.nan_to_num(y) +// array([ 1.79769313e+308 +0.00000000e+000j, # may vary +// 0.00000000e+000 +0.00000000e+000j, +// 0.00000000e+000 +1.79769313e+308j]) +// >>> np.nan_to_num(y, nan=111111, posinf=222222) +// array([222222.+111111.j, 111111. +0.j, 111111.+222222.j]) +// +// +//go:linkname NanToNum py.nan_to_num +func NanToNum(x *py.Object, copy *py.Object, nan *py.Object, posinf *py.Object, neginf *py.Object) *py.Object +// +// Return the Hamming window. +// +// The Hamming window is a taper formed by using a weighted cosine. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value +// one appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, blackman, hanning, kaiser +// +// Notes +// ----- +// The Hamming window is defined as +// +// .. math:: w(n) = 0.54 - 0.46\cos\left(\frac{2\pi{n}}{M-1}\right) +// \qquad 0 \leq n \leq M-1 +// +// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey +// and is described in Blackman and Tukey. It was recommended for +// smoothing the truncated autocovariance function in the time domain. +// Most references to the Hamming window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. +// +// References +// ---------- +// .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power +// spectra, Dover Publications, New York. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The +// University of Alberta Press, 1975, pp. 109-110. +// .. [3] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 425. +// +// Examples +// -------- +// >>> np.hamming(12) +// array([ 0.08 , 0.15302337, 0.34890909, 0.60546483, 0.84123594, # may vary +// 0.98136677, 0.98136677, 0.84123594, 0.60546483, 0.34890909, +// 0.15302337, 0.08 ]) +// +// Plot the window and the frequency response: +// +// >>> import matplotlib.pyplot as plt +// >>> from numpy.fft import fft, fftshift +// >>> window = np.hamming(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Hamming window") +// Text(0.5, 1.0, 'Hamming window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> response = 20 * np.log10(mag) +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Hamming window") +// Text(0.5, 1.0, 'Frequency response of Hamming window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> plt.axis('tight') +// ... +// >>> plt.show() +// +// +// +//go:linkname Hamming py.hamming +func Hamming(M *py.Object) *py.Object +// +// Return the indices of the minimum values in the specified axis ignoring +// NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results +// cannot be trusted if a slice contains only NaNs and Infs. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which to operate. By default flattened input is used. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// +// .. versionadded:: 1.22.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray +// An array of indices or a single index value. +// +// See Also +// -------- +// argmin, nanargmax +// +// Examples +// -------- +// >>> a = np.array([[np.nan, 4], [2, 3]]) +// >>> np.argmin(a) +// 0 +// >>> np.nanargmin(a) +// 2 +// >>> np.nanargmin(a, axis=0) +// array([1, 1]) +// >>> np.nanargmin(a, axis=1) +// array([1, 0]) +// +// +// +//go:linkname Nanargmin py.nanargmin +func Nanargmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// copyto(dst, src, casting='same_kind', where=True) +// +// Copies values from one array to another, broadcasting as necessary. +// +// Raises a TypeError if the `casting` rule is violated, and if +// `where` is provided, it selects which elements to copy. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dst : ndarray +// The array into which values are copied. +// src : array_like +// The array from which values are copied. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur when copying. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// where : array_like of bool, optional +// A boolean array which is broadcasted to match the dimensions +// of `dst`, and selects elements to copy from `src` to `dst` +// wherever it contains the value True. +// +// Examples +// -------- +// >>> A = np.array([4, 5, 6]) +// >>> B = [1, 2, 3] +// >>> np.copyto(A, B) +// >>> A +// array([1, 2, 3]) +// +// >>> A = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> B = [[4, 5, 6], [7, 8, 9]] +// >>> np.copyto(A, B) +// >>> A +// array([[4, 5, 6], +// [7, 8, 9]]) +// +// +// +//go:linkname Copyto py.copyto +func Copyto(dst *py.Object, src *py.Object, casting *py.Object, where *py.Object) *py.Object +// logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 AND x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical AND operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or, logical_not, logical_xor +// bitwise_and +// +// Examples +// -------- +// >>> np.logical_and(True, False) +// False +// >>> np.logical_and([True, False], [False, False]) +// array([False, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_and(x>1, x<4) +// array([False, False, True, True, False]) +// +// +// The ``&`` operator can be used as a shorthand for ``np.logical_and`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a & b +// array([False, False]) +// +//go:linkname LogicalAnd py.logical_and +func LogicalAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical negative, element-wise. +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = -x`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.negative([1.,-1.]) +// array([-1., 1.]) +// +// The unary ``-`` operator can be used as a shorthand for ``np.negative`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> -x1 +// array([-1., 1.]) +// +//go:linkname Negative py.negative +func Negative(x *py.Object, out *py.Object) *py.Object +// right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the right. +// +// Bits are shifted to the right `x2`. Because the internal +// representation of numbers is in binary format, this operation is +// equivalent to dividing `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like, int +// Input values. +// x2 : array_like, int +// Number of bits to remove at the right of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray, int +// Return `x1` with bits shifted `x2` times to the right. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// left_shift : Shift the bits of an integer to the left. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(10) +// '1010' +// >>> np.right_shift(10, 1) +// 5 +// >>> np.binary_repr(5) +// '101' +// +// >>> np.right_shift(10, [1,2,3]) +// array([5, 2, 1]) +// +// The ``>>`` operator can be used as a shorthand for ``np.right_shift`` on +// ndarrays. +// +// >>> x1 = 10 +// >>> x2 = np.array([1,2,3]) +// >>> x1 >> x2 +// array([5, 2, 1]) +// +//go:linkname RightShift py.right_shift +func RightShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set how floating-point errors are handled. +// +// Note that operations on integer scalar types (such as `int16`) are +// handled like floating point, and are affected by these settings. +// +// Parameters +// ---------- +// all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Set treatment for all types of floating-point errors at once: +// +// - ignore: Take no action when the exception occurs. +// - warn: Print a `RuntimeWarning` (via the Python `warnings` module). +// - raise: Raise a `FloatingPointError`. +// - call: Call a function specified using the `seterrcall` function. +// - print: Print a warning directly to ``stdout``. +// - log: Record error in a Log object specified by `seterrcall`. +// +// The default is not to change the current behavior. +// divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for division by zero. +// over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point overflow. +// under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for floating-point underflow. +// invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional +// Treatment for invalid floating-point operation. +// +// Returns +// ------- +// old_settings : dict +// Dictionary containing the old settings. +// +// See also +// -------- +// seterrcall : Set a callback function for the 'call' mode. +// geterr, geterrcall, errstate +// +// Notes +// ----- +// The floating-point exceptions are defined in the IEEE 754 standard [1]_: +// +// - Division by zero: infinite result obtained from finite numbers. +// - Overflow: result too large to be expressed. +// - Underflow: result so close to zero that some precision +// was lost. +// - Invalid operation: result is not an expressible number, typically +// indicates that a NaN was produced. +// +// .. [1] https://en.wikipedia.org/wiki/IEEE_754 +// +// Examples +// -------- +// >>> old_settings = np.seterr(all='ignore') #seterr to known value +// >>> np.seterr(over='raise') +// {'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'} +// >>> np.seterr(**old_settings) # reset to default +// {'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'} +// +// >>> np.int16(32000) * np.int16(3) +// 30464 +// >>> old_settings = np.seterr(all='warn', over='raise') +// >>> np.int16(32000) * np.int16(3) +// Traceback (most recent call last): +// File "", line 1, in +// FloatingPointError: overflow encountered in scalar multiply +// +// >>> old_settings = np.seterr(all='print') +// >>> np.geterr() +// {'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'} +// >>> np.int16(32000) * np.int16(3) +// 30464 +// +// +// +//go:linkname Seterr py.seterr +func Seterr(all *py.Object, divide *py.Object, over *py.Object, under *py.Object, invalid *py.Object) *py.Object +// +// Assemble an nd-array from nested lists of blocks. +// +// Blocks in the innermost lists are concatenated (see `concatenate`) along +// the last dimension (-1), then these are concatenated along the +// second-last dimension (-2), and so on until the outermost list is reached. +// +// Blocks can be of any dimension, but will not be broadcasted using the normal +// rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim`` +// the same for all blocks. This is primarily useful for working with scalars, +// and means that code like ``np.block([v, 1])`` is valid, where +// ``v.ndim == 1``. +// +// When the nested list is two levels deep, this allows block matrices to be +// constructed from their components. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// arrays : nested list of array_like or scalars (but not tuples) +// If passed a single ndarray or scalar (a nested list of depth 0), this +// is returned unmodified (and not copied). +// +// Elements shapes must match along the appropriate axes (without +// broadcasting), but leading 1s will be prepended to the shape as +// necessary to make the dimensions match. +// +// Returns +// ------- +// block_array : ndarray +// The array assembled from the given blocks. +// +// The dimensionality of the output is equal to the greatest of: +// * the dimensionality of all the inputs +// * the depth to which the input list is nested +// +// Raises +// ------ +// ValueError +// * If list depths are mismatched - for instance, ``[[a, b], c]`` is +// illegal, and should be spelt ``[[a, b], [c]]`` +// * If lists are empty - for instance, ``[[a, b], []]`` +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// vstack : Stack arrays in sequence vertically (row wise). +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Notes +// ----- +// +// When called with only scalars, ``np.block`` is equivalent to an ndarray +// call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to +// ``np.array([[1, 2], [3, 4]])``. +// +// This function does not enforce that the blocks lie on a fixed grid. +// ``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form:: +// +// AAAbb +// AAAbb +// cccDD +// +// But is also allowed to produce, for some ``a, b, c, d``:: +// +// AAAbb +// AAAbb +// cDDDD +// +// Since concatenation happens along the last axis first, `block` is _not_ +// capable of producing the following directly:: +// +// AAAbb +// cccbb +// cccDD +// +// Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is +// equivalent to ``np.block([[A, B, ...], [p, q, ...]])``. +// +// Examples +// -------- +// The most common use of this function is to build a block matrix +// +// >>> A = np.eye(2) * 2 +// >>> B = np.eye(3) * 3 +// >>> np.block([ +// ... [A, np.zeros((2, 3))], +// ... [np.ones((3, 2)), B ] +// ... ]) +// array([[2., 0., 0., 0., 0.], +// [0., 2., 0., 0., 0.], +// [1., 1., 3., 0., 0.], +// [1., 1., 0., 3., 0.], +// [1., 1., 0., 0., 3.]]) +// +// With a list of depth 1, `block` can be used as `hstack` +// +// >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) +// array([1, 2, 3]) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([a, b, 10]) # hstack([a, b, 10]) +// array([ 1, 2, 3, 4, 5, 6, 10]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([A, B]) # hstack([A, B]) +// array([[1, 1, 2, 2], +// [1, 1, 2, 2]]) +// +// With a list of depth 2, `block` can be used in place of `vstack`: +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.block([[a], [b]]) # vstack([a, b]) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> A = np.ones((2, 2), int) +// >>> B = 2 * A +// >>> np.block([[A], [B]]) # vstack([A, B]) +// array([[1, 1], +// [1, 1], +// [2, 2], +// [2, 2]]) +// +// It can also be used in places of `atleast_1d` and `atleast_2d` +// +// >>> a = np.array(0) +// >>> b = np.array([1]) +// >>> np.block([a]) # atleast_1d(a) +// array([0]) +// >>> np.block([b]) # atleast_1d(b) +// array([1]) +// +// >>> np.block([[a]]) # atleast_2d(a) +// array([[0]]) +// >>> np.block([[b]]) # atleast_2d(b) +// array([[1]]) +// +// +// +// +//go:linkname Block py.block +func Block(arrays *py.Object) *py.Object +// +// One-dimensional linear interpolation for monotonically increasing sample points. +// +// Returns the one-dimensional piecewise linear interpolant to a function +// with given discrete data points (`xp`, `fp`), evaluated at `x`. +// +// Parameters +// ---------- +// x : array_like +// The x-coordinates at which to evaluate the interpolated values. +// +// xp : 1-D sequence of floats +// The x-coordinates of the data points, must be increasing if argument +// `period` is not specified. Otherwise, `xp` is internally sorted after +// normalizing the periodic boundaries with ``xp = xp % period``. +// +// fp : 1-D sequence of float or complex +// The y-coordinates of the data points, same length as `xp`. +// +// left : optional float or complex corresponding to fp +// Value to return for `x < xp[0]`, default is `fp[0]`. +// +// right : optional float or complex corresponding to fp +// Value to return for `x > xp[-1]`, default is `fp[-1]`. +// +// period : None or float, optional +// A period for the x-coordinates. This parameter allows the proper +// interpolation of angular x-coordinates. Parameters `left` and `right` +// are ignored if `period` is specified. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// y : float or complex (corresponding to fp) or ndarray +// The interpolated values, same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `xp` and `fp` have different length +// If `xp` or `fp` are not 1-D sequences +// If `period == 0` +// +// See Also +// -------- +// scipy.interpolate +// +// Warnings +// -------- +// The x-coordinate sequence is expected to be increasing, but this is not +// explicitly enforced. However, if the sequence `xp` is non-increasing, +// interpolation results are meaningless. +// +// Note that, since NaN is unsortable, `xp` also cannot contain NaNs. +// +// A simple check for `xp` being strictly increasing is:: +// +// np.all(np.diff(xp) > 0) +// +// Examples +// -------- +// >>> xp = [1, 2, 3] +// >>> fp = [3, 2, 0] +// >>> np.interp(2.5, xp, fp) +// 1.0 +// >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp) +// array([3. , 3. , 2.5 , 0.56, 0. ]) +// >>> UNDEF = -99.0 +// >>> np.interp(3.14, xp, fp, right=UNDEF) +// -99.0 +// +// Plot an interpolant to the sine function: +// +// >>> x = np.linspace(0, 2*np.pi, 10) +// >>> y = np.sin(x) +// >>> xvals = np.linspace(0, 2*np.pi, 50) +// >>> yinterp = np.interp(xvals, x, y) +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(x, y, 'o') +// [] +// >>> plt.plot(xvals, yinterp, '-x') +// [] +// >>> plt.show() +// +// Interpolation with periodic x-coordinates: +// +// >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] +// >>> xp = [190, -190, 350, -350] +// >>> fp = [5, 10, 3, 4] +// >>> np.interp(x, xp, fp, period=360) +// array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75]) +// +// Complex interpolation: +// +// >>> x = [1.5, 4.0] +// >>> xp = [2,3,5] +// >>> fp = [1.0j, 0, 2+3j] +// >>> np.interp(x, xp, fp) +// array([0.+1.j , 1.+1.5j]) +// +// +// +//go:linkname Interp py.interp +func Interp(x *py.Object, xp *py.Object, fp *py.Object, left *py.Object, right *py.Object, period *py.Object) *py.Object +// +// Put values into the destination array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to place values into the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Destination array. +// indices : ndarray (Ni..., J, Nk...) +// Indices to change along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast +// against `arr`. +// values : array_like (Ni..., J, Nk...) +// values to insert at those indices. Its shape and dimension are +// broadcast to match that of `indices`. +// axis : int +// The axis to take 1d slices along. If axis is None, the destination +// array is treated as if a flattened 1d view had been created of it. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// values_1d = values [ii + s_[:,] + kk] +// for j in range(J): +// a_1d[indices_1d[j]] = values_1d[j] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// a_1d[indices_1d] = values_1d +// +// See Also +// -------- +// take_along_axis : +// Take values from the input array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can replace the maximum values with: +// +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.put_along_axis(a, ai, 99, axis=1) +// >>> a +// array([[10, 99, 20], +// [99, 40, 50]]) +// +// +// +//go:linkname PutAlongAxis py.put_along_axis +func PutAlongAxis(arr *py.Object, indices *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the minimum of an array or minimum along an axis. +// +// `amin` is an alias of `~numpy.min`. +// +// See Also +// -------- +// min : alias of this function +// ndarray.min : equivalent method +// +// +//go:linkname Amin py.amin +func Amin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to operate. By default, flattened input is +// used. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, the maximum is selected over multiple axes, +// instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternative output array in which to place the result. Must +// be of the same shape and buffer length as the expected output. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the ``max`` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// max : ndarray or scalar +// Maximum of `a`. If `axis` is None, the result is a scalar value. +// If `axis` is an int, the result is an array of dimension +// ``a.ndim - 1``. If `axis` is a tuple, the result is an array of +// dimension ``a.ndim - len(axis)``. +// +// See Also +// -------- +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// argmax : +// Return the indices of the maximum values. +// +// nanmin, minimum, fmin +// +// Notes +// ----- +// NaN values are propagated, that is if at least one item is NaN, the +// corresponding max value will be NaN as well. To ignore NaN values +// (MATLAB behavior), please use nanmax. +// +// Don't use `~numpy.max` for element-wise comparison of 2 arrays; when +// ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than +// ``max(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape((2,2)) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> np.max(a) # Maximum of the flattened array +// 3 +// >>> np.max(a, axis=0) # Maxima along the first axis +// array([2, 3]) +// >>> np.max(a, axis=1) # Maxima along the second axis +// array([1, 3]) +// >>> np.max(a, where=[False, True], initial=-1, axis=0) +// array([-1, 3]) +// >>> b = np.arange(5, dtype=float) +// >>> b[2] = np.NaN +// >>> np.max(b) +// nan +// >>> np.max(b, where=~np.isnan(b), initial=-1) +// 4.0 +// >>> np.nanmax(b) +// 4.0 +// +// You can use an initial value to compute the maximum of an empty slice, or +// to initialize it to a different value: +// +// >>> np.max([[-50], [10]], axis=-1, initial=0) +// array([ 0, 10]) +// +// Notice that the initial value is used as one of the elements for which the +// maximum is determined, unlike for the default argument Python's max +// function, which is only used for empty iterables. +// +// >>> np.max([5], initial=6) +// 6 +// >>> max([5], default=6) +// 5 +// +// +//go:linkname Max py.max +func Max(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Test element-wise for negative infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a numpy boolean array is +// returned with values True where the corresponding element of the +// input is negative infinity and values False where the element of +// the input is not negative infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as +// zeros and ones, if the type is boolean then as False and True. The +// return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values. +// +// Examples +// -------- +// >>> np.isneginf(np.NINF) +// True +// >>> np.isneginf(np.inf) +// False +// >>> np.isneginf(np.PINF) +// False +// >>> np.isneginf([-np.inf, 0., np.inf]) +// array([ True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isneginf(x, y) +// array([1, 0, 0]) +// >>> y +// array([1, 0, 0]) +// +// +// +//go:linkname Isneginf py.isneginf +func Isneginf(x *py.Object, out *py.Object) *py.Object +// +// Returns the quotient and remainder of polynomial division. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The input arrays are the coefficients (including any coefficients +// equal to zero) of the "numerator" (dividend) and "denominator" +// (divisor) polynomials, respectively. +// +// Parameters +// ---------- +// u : array_like or poly1d +// Dividend polynomial's coefficients. +// +// v : array_like or poly1d +// Divisor polynomial's coefficients. +// +// Returns +// ------- +// q : ndarray +// Coefficients, including those equal to zero, of the quotient. +// r : ndarray +// Coefficients, including those equal to zero, of the remainder. +// +// See Also +// -------- +// poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub +// polyval +// +// Notes +// ----- +// Both `u` and `v` must be 0-d or 1-d (ndim = 0 or 1), but `u.ndim` need +// not equal `v.ndim`. In other words, all four possible combinations - +// ``u.ndim = v.ndim = 0``, ``u.ndim = v.ndim = 1``, +// ``u.ndim = 1, v.ndim = 0``, and ``u.ndim = 0, v.ndim = 1`` - work. +// +// Examples +// -------- +// .. math:: \frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 +// +// >>> x = np.array([3.0, 5.0, 2.0]) +// >>> y = np.array([2.0, 1.0]) +// >>> np.polydiv(x, y) +// (array([1.5 , 1.75]), array([0.25])) +// +// +// +//go:linkname Polydiv py.polydiv +func Polydiv(u *py.Object, v *py.Object) *py.Object +// +// Determine if a class is a subclass of a second class. +// +// `issubclass_` is equivalent to the Python built-in ``issubclass``, +// except that it returns False instead of raising a TypeError if one +// of the arguments is not a class. +// +// Parameters +// ---------- +// arg1 : class +// Input class. True is returned if `arg1` is a subclass of `arg2`. +// arg2 : class or tuple of classes. +// Input class. If a tuple of classes, True is returned if `arg1` is a +// subclass of any of the tuple elements. +// +// Returns +// ------- +// out : bool +// Whether `arg1` is a subclass of `arg2` or not. +// +// See Also +// -------- +// issubsctype, issubdtype, issctype +// +// Examples +// -------- +// >>> np.issubclass_(np.int32, int) +// False +// >>> np.issubclass_(np.int32, float) +// False +// >>> np.issubclass_(np.float64, float) +// True +// +// +// +//go:linkname Issubclass_ py.issubclass_ +func Issubclass_(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Determine if the first argument is a subclass of the second argument. +// +// Parameters +// ---------- +// arg1, arg2 : dtype or dtype specifier +// Data-types. +// +// Returns +// ------- +// out : bool +// The result. +// +// See Also +// -------- +// issctype, issubdtype, obj2sctype +// +// Examples +// -------- +// >>> np.issubsctype('S8', str) +// False +// >>> np.issubsctype(np.array([1]), int) +// True +// >>> np.issubsctype(np.array([1]), float) +// False +// +// +// +//go:linkname Issubsctype py.issubsctype +func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis, ignoring any +// NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is +// raised and NaN is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose maximum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the maximum is computed. The default is to compute +// the maximum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `max` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The minimum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the maximum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmax : ndarray +// An array with the same shape as `a`, with the specified axis removed. +// If `a` is a 0-d array, or if axis is None, an ndarray scalar is +// returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmin : +// The minimum value of an array along a given axis, ignoring any NaNs. +// amax : +// The maximum value of an array along a given axis, propagating any NaNs. +// fmax : +// Element-wise maximum of two arrays, ignoring any NaNs. +// maximum : +// Element-wise maximum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amin, fmin, minimum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.max. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmax(a) +// 3.0 +// >>> np.nanmax(a, axis=0) +// array([3., 2.]) +// >>> np.nanmax(a, axis=1) +// array([2., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmax([1, 2, np.nan, np.NINF]) +// 2.0 +// >>> np.nanmax([1, 2, np.nan, np.inf]) +// inf +// +// +// +//go:linkname Nanmax py.nanmax +func Nanmax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis, ignoring NaNs. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the means are computed. The default is to compute +// the mean of the flattened array. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for inexact inputs, it is the same as the input +// dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. Nan is +// returned for slices that contain only NaNs. +// +// See Also +// -------- +// average : Weighted average +// mean : Arithmetic mean taken while not ignoring NaNs +// var, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the non-NaN elements along the axis +// divided by the number of non-NaN elements. +// +// Note that for floating-point input, the mean is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32`. Specifying a +// higher-precision accumulator using the `dtype` keyword can alleviate +// this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanmean(a) +// 2.6666666666666665 +// >>> np.nanmean(a, axis=0) +// array([2., 4.]) +// >>> np.nanmean(a, axis=1) +// array([1., 3.5]) # may vary +// +// +// +//go:linkname Nanmean py.nanmean +func Nanmean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// +// putmask(a, mask, values) +// +// Changes elements of an array based on conditional and input values. +// +// Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. +// +// If `values` is not the same size as `a` and `mask` then it will repeat. +// This gives behavior different from ``a[mask] = values``. +// +// Parameters +// ---------- +// a : ndarray +// Target array. +// mask : array_like +// Boolean mask array. It has to be the same shape as `a`. +// values : array_like +// Values to put into `a` where `mask` is True. If `values` is smaller +// than `a` it will be repeated. +// +// See Also +// -------- +// place, put, take, copyto +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2, 3) +// >>> np.putmask(x, x>2, x**2) +// >>> x +// array([[ 0, 1, 2], +// [ 9, 16, 25]]) +// +// If `values` is smaller than `a` it is repeated: +// +// >>> x = np.arange(5) +// >>> np.putmask(x, x>1, [-33, -44]) +// >>> x +// array([ 0, 1, -33, -44, -33]) +// +// +// +//go:linkname Putmask py.putmask +func Putmask(a *py.Object, mask *py.Object, values *py.Object) *py.Object +// +// Returns the indices that would sort an array. +// +// Perform an indirect sort along the given axis using the algorithm specified +// by the `kind` keyword. It returns an array of indices of the same shape as +// `a` that index data along the given axis in sorted order. +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If None, +// the flattened array is used. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort under the covers and, in general, the +// actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that sort `a` along the specified `axis`. +// If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the sorted `a`, irrespective of dimensionality. +// +// See Also +// -------- +// sort : Describes sorting algorithms used. +// lexsort : Indirect stable sort with multiple keys. +// ndarray.sort : Inplace sort. +// argpartition : Indirect partial sort. +// take_along_axis : Apply ``index_array`` from argsort +// to an array as if by calling sort. +// +// Notes +// ----- +// See `sort` for notes on the different sorting algorithms. +// +// As of NumPy 1.4.0 `argsort` works with real/complex arrays containing +// nan values. The enhanced sort order is documented in `sort`. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 1, 2]) +// >>> np.argsort(x) +// array([1, 2, 0]) +// +// Two-dimensional array: +// +// >>> x = np.array([[0, 3], [2, 2]]) +// >>> x +// array([[0, 3], +// [2, 2]]) +// +// >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) +// >>> ind +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) +// array([[0, 2], +// [2, 3]]) +// +// >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) +// >>> ind +// array([[0, 1], +// [0, 1]]) +// >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) +// array([[0, 3], +// [2, 2]]) +// +// Indices of the sorted elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) +// >>> ind +// (array([0, 1, 1, 0]), array([0, 0, 1, 1])) +// >>> x[ind] # same as np.sort(x, axis=None) +// array([0, 2, 2, 3]) +// +// Sorting with keys: +// +// >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '>> x +// array([(1, 0), (0, 1)], +// dtype=[('x', '>> np.argsort(x, order=('x','y')) +// array([1, 0]) +// +// >>> np.argsort(x, order=('y','x')) +// array([0, 1]) +// +// +// +//go:linkname Argsort py.argsort +func Argsort(a *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Given the "legs" of a right triangle, return its hypotenuse. +// +// Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or +// `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type), +// it is broadcast for use with each element of the other argument. +// (See Examples) +// +// Parameters +// ---------- +// x1, x2 : array_like +// Leg of the triangle(s). +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// z : ndarray +// The hypotenuse of the triangle(s). +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +// Example showing broadcast of scalar_like argument: +// +// >>> np.hypot(3*np.ones((3, 3)), [4]) +// array([[ 5., 5., 5.], +// [ 5., 5., 5.], +// [ 5., 5., 5.]]) +// +//go:linkname Hypot py.hypot +func Hypot(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Test element-wise for positive infinity, return result as bool array. +// +// Parameters +// ---------- +// x : array_like +// The input array. +// out : array_like, optional +// A location into which the result is stored. If provided, it must have a +// shape that the input broadcasts to. If not provided or None, a +// freshly-allocated boolean array is returned. +// +// Returns +// ------- +// out : ndarray +// A boolean array with the same dimensions as the input. +// If second argument is not supplied then a boolean array is returned +// with values True where the corresponding element of the input is +// positive infinity and values False where the element of the input is +// not positive infinity. +// +// If a second argument is supplied the result is stored there. If the +// type of that array is a numeric type the result is represented as zeros +// and ones, if the type is boolean then as False and True. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// isinf, isneginf, isfinite, isnan +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is also supplied when x is a scalar +// input, if first and second arguments have different shapes, or if the +// first argument has complex values +// +// Examples +// -------- +// >>> np.isposinf(np.PINF) +// True +// >>> np.isposinf(np.inf) +// True +// >>> np.isposinf(np.NINF) +// False +// >>> np.isposinf([-np.inf, 0., np.inf]) +// array([False, False, True]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isposinf(x, y) +// array([0, 0, 1]) +// >>> y +// array([0, 0, 1]) +// +// +// +//go:linkname Isposinf py.isposinf +func Isposinf(x *py.Object, out *py.Object) *py.Object +// +// Returns True if two arrays are element-wise equal within a tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// NaNs are treated as equal if they are in the same place and if +// ``equal_nan=True``. Infs are treated as equal if they are in the same +// place and of the same sign in both arrays. +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// .. versionadded:: 1.10.0 +// +// Returns +// ------- +// allclose : bool +// Returns True if the two arrays are equal within the given +// tolerance; False otherwise. +// +// See Also +// -------- +// isclose, all, any, equal +// +// Notes +// ----- +// If the following equation is element-wise True, then allclose returns +// True. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// The above equation is not symmetric in `a` and `b`, so that +// ``allclose(a, b)`` might be different from ``allclose(b, a)`` in +// some rare cases. +// +// The comparison of `a` and `b` uses standard broadcasting, which +// means that `a` and `b` need not have the same shape in order for +// ``allclose(a, b)`` to evaluate to True. The same is true for +// `equal` but not `array_equal`. +// +// `allclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) +// False +// >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) +// True +// >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan]) +// False +// >>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// True +// +// +// +//go:linkname Allclose py.allclose +func Allclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Compute the variance along the specified axis, while ignoring NaNs. +// +// Returns the variance of the array elements, a measure of the spread of +// a distribution. The variance is computed for the flattened array by +// default, otherwise over the specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose variance is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the variance is computed. The default is to compute +// the variance of the flattened array. +// dtype : data-type, optional +// Type to use in computing the variance. For arrays of integer type +// the default is `float64`; for arrays of float types it is the same as +// the array type. +// out : ndarray, optional +// Alternate output array in which to place the result. It must have +// the same shape as the expected output, but the type is cast if +// necessary. +// ddof : int, optional +// "Delta Degrees of Freedom": the divisor used in the calculation is +// ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// where : array_like of bool, optional +// Elements to include in the variance. See `~numpy.ufunc.reduce` for +// details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// variance : ndarray, see dtype parameter above +// If `out` is None, return a new array containing the variance, +// otherwise return a reference to the output array. If ddof is >= the +// number of non-NaN elements in a slice or the slice contains only +// NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// std : Standard deviation +// mean : Average +// var : Variance while not ignoring NaNs +// nanstd, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The variance is the average of the squared deviations from the mean, +// i.e., ``var = mean(abs(x - x.mean())**2)``. +// +// The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. +// If, however, `ddof` is specified, the divisor ``N - ddof`` is used +// instead. In standard statistical practice, ``ddof=1`` provides an +// unbiased estimator of the variance of a hypothetical infinite +// population. ``ddof=0`` provides a maximum likelihood estimate of the +// variance for normally distributed variables. +// +// Note that for complex numbers, the absolute value is taken before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the variance is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for `float32` (see example +// below). Specifying a higher-accuracy accumulator using the ``dtype`` +// keyword can alleviate this issue. +// +// For this function to work on sub-classes of ndarray, they must define +// `sum` with the kwarg `keepdims` +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanvar(a) +// 1.5555555555555554 +// >>> np.nanvar(a, axis=0) +// array([1., 0.]) +// >>> np.nanvar(a, axis=1) +// array([0., 0.25]) # may vary +// +// +// +//go:linkname Nanvar py.nanvar +func Nanvar(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Cross-correlation of two 1-dimensional sequences. +// +// This function computes the correlation as generally defined in signal +// processing texts: +// +// .. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n +// +// with a and v sequences being zero-padded where necessary and +// :math:`\overline x` denoting complex conjugation. +// +// Parameters +// ---------- +// a, v : array_like +// Input sequences. +// mode : {'valid', 'same', 'full'}, optional +// Refer to the `convolve` docstring. Note that the default +// is 'valid', unlike `convolve`, which uses 'full'. +// old_behavior : bool +// `old_behavior` was removed in NumPy 1.10. If you need the old +// behavior, use `multiarray.correlate`. +// +// Returns +// ------- +// out : ndarray +// Discrete cross-correlation of `a` and `v`. +// +// See Also +// -------- +// convolve : Discrete, linear convolution of two one-dimensional sequences. +// multiarray.correlate : Old, no conjugate, version of correlate. +// scipy.signal.correlate : uses FFT which has superior performance on large arrays. +// +// Notes +// ----- +// The definition of correlation above is not unique and sometimes correlation +// may be defined differently. Another common definition is: +// +// .. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}} +// +// which is related to :math:`c_k` by :math:`c'_k = c_{-k}`. +// +// `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does +// not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might +// be preferable. +// +// +// Examples +// -------- +// >>> np.correlate([1, 2, 3], [0, 1, 0.5]) +// array([3.5]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "same") +// array([2. , 3.5, 3. ]) +// >>> np.correlate([1, 2, 3], [0, 1, 0.5], "full") +// array([0.5, 2. , 3.5, 3. , 0. ]) +// +// Using complex sequences: +// +// >>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full') +// array([ 0.5-0.5j, 1.0+0.j , 1.5-1.5j, 3.0-1.j , 0.0+0.j ]) +// +// Note that you get the time reversed, complex conjugated result +// (:math:`\overline{c_{-k}}`) when the two input sequences a and v change +// places: +// +// >>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full') +// array([ 0.0+0.j , 3.0+1.j , 1.5+1.5j, 1.0+0.j , 0.5+0.5j]) +// +// +// +//go:linkname Correlate py.correlate +func Correlate(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// +// Compute the arithmetic mean along the specified axis. +// +// Returns the average of the array elements. The average is taken over +// the flattened array by default, otherwise over the specified axis. +// `float64` intermediate and return values are used for integer inputs. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose mean is desired. If `a` is not an +// array, a conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the means are computed. The default is to +// compute the mean of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a mean is performed over multiple axes, +// instead of a single axis or all the axes as before. +// dtype : data-type, optional +// Type to use in computing the mean. For integer inputs, the default +// is `float64`; for floating point inputs, it is the same as the +// input dtype. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. +// See :ref:`ufuncs-output-type` for more details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `mean` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the mean. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// m : ndarray, see dtype parameter above +// If `out=None`, returns a new array containing the mean values, +// otherwise a reference to the output array is returned. +// +// See Also +// -------- +// average : Weighted average +// std, var, nanmean, nanstd, nanvar +// +// Notes +// ----- +// The arithmetic mean is the sum of the elements along the axis divided +// by the number of elements. +// +// Note that for floating-point input, the mean is computed using the +// same precision the input has. Depending on the input data, this can +// cause the results to be inaccurate, especially for `float32` (see +// example below). Specifying a higher-precision accumulator using the +// `dtype` keyword can alleviate this issue. +// +// By default, `float16` results are computed using `float32` intermediates +// for extra precision. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.mean(a) +// 2.5 +// >>> np.mean(a, axis=0) +// array([2., 3.]) +// >>> np.mean(a, axis=1) +// array([1.5, 3.5]) +// +// In single precision, `mean` can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.mean(a) +// 0.54999924 +// +// Computing the mean in float64 is more accurate: +// +// >>> np.mean(a, dtype=np.float64) +// 0.55000000074505806 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]]) +// >>> np.mean(a) +// 12.0 +// >>> np.mean(a, where=[[True], [False], [False]]) +// 9.0 +// +// +// +//go:linkname Mean py.mean +func Mean(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic sine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `arcsinh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that `sinh(z) = x`. The convention is to return the +// `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arcsinh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, it +// returns ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arccos` is a complex analytical function that +// has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from +// the right on the former and from the left on the latter. +// +// The inverse hyperbolic sine is also known as `asinh` or ``sinh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arcsinh +// +// Examples +// -------- +// >>> np.arcsinh(np.array([np.e, 10.0])) +// array([ 1.72538256, 2.99822295]) +// +//go:linkname Arcsinh py.arcsinh +func Arcsinh(x *py.Object, out *py.Object) *py.Object +// floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the floor of the input, element-wise. +// +// The floor of the scalar `x` is the largest integer `i`, such that +// `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The floor of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, trunc, rint, fix +// +// Notes +// ----- +// Some spreadsheet programs calculate the "floor-towards-zero", where +// ``floor(-2.5) == -2``. NumPy instead uses the definition of +// `floor` where `floor(-2.5) == -3`. The "floor-towards-zero" +// function is called ``fix`` in NumPy. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.floor(a) +// array([-2., -2., -1., 0., 1., 1., 2.]) +// +//go:linkname Floor py.floor +func Floor(x *py.Object, out *py.Object) *py.Object +// sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the non-negative square-root of an array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// The values whose square-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the positive +// square-root of each element in `x`. If any element in `x` is +// complex, a complex array is returned (and the square-roots of +// negative reals are calculated). If all of the elements in `x` +// are real, so is `y`, with negative elements returning ``nan``. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.sqrt +// A version which returns complex numbers when given negative reals. +// Note that 0.0 and -0.0 are handled differently for complex inputs. +// +// Notes +// ----- +// *sqrt* has--consistent with common convention--as its branch cut the +// real "interval" [`-inf`, 0), and is continuous from above on it. +// A branch cut is a curve in the complex plane across which a given +// complex function fails to be continuous. +// +// Examples +// -------- +// >>> np.sqrt([1,4,9]) +// array([ 1., 2., 3.]) +// +// >>> np.sqrt([4, -1, -3+4J]) +// array([ 2.+0.j, 0.+1.j, 1.+2.j]) +// +// >>> np.sqrt([4, -1, np.inf]) +// array([ 2., nan, inf]) +// +//go:linkname Sqrt py.sqrt +func Sqrt(x *py.Object, out *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale. +// +// In linear space, the sequence starts at ``base ** start`` +// (`base` to the power of `start`) and ends with ``base ** stop`` +// (see `endpoint` below). +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.25.0 +// Non-scalar 'base` is now supported +// +// Parameters +// ---------- +// start : array_like +// ``base ** start`` is the starting value of the sequence. +// stop : array_like +// ``base ** stop`` is the final value of the sequence, unless `endpoint` +// is False. In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// base : array_like, optional +// The base of the log space. The step size between the elements in +// ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform. +// Default is 10.0. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred type will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start, +// stop, or base are array-like. By default (0), the samples will be +// along a new axis inserted at the beginning. Use -1 to get an axis at +// the end. +// +// .. versionadded:: 1.16.0 +// +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. Note that, when used with a float endpoint, the +// endpoint may or may not be included. +// linspace : Similar to logspace, but with the samples uniformly distributed +// in linear space, instead of log space. +// geomspace : Similar to logspace, but with endpoints specified directly. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If base is a scalar, logspace is equivalent to the code +// +// >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) +// ... # doctest: +SKIP +// >>> power(base, y).astype(dtype) +// ... # doctest: +SKIP +// +// Examples +// -------- +// >>> np.logspace(2.0, 3.0, num=4) +// array([ 100. , 215.443469 , 464.15888336, 1000. ]) +// >>> np.logspace(2.0, 3.0, num=4, endpoint=False) +// array([100. , 177.827941 , 316.22776602, 562.34132519]) +// >>> np.logspace(2.0, 3.0, num=4, base=2.0) +// array([4. , 5.0396842 , 6.34960421, 8. ]) +// >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) +// array([[ 4. , 5.0396842 , 6.34960421, 8. ], +// [ 9. , 12.98024613, 18.72075441, 27. ]]) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> x1 = np.logspace(0.1, 1, N, endpoint=True) +// >>> x2 = np.logspace(0.1, 1, N, endpoint=False) +// >>> y = np.zeros(N) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Logspace py.logspace +func Logspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, base *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Return a scalar type which is common to the input arrays. +// +// The return type will always be an inexact (i.e. floating point) scalar +// type, even if all the arrays are integer arrays. If one of the inputs is +// an integer array, the minimum precision type that is returned is a +// 64-bit floating point dtype. +// +// All input arrays except int64 and uint64 can be safely cast to the +// returned dtype without loss of information. +// +// Parameters +// ---------- +// array1, array2, ... : ndarrays +// Input arrays. +// +// Returns +// ------- +// out : data type code +// Data type code. +// +// See Also +// -------- +// dtype, mintypecode +// +// Examples +// -------- +// >>> np.common_type(np.arange(2, dtype=np.float32)) +// +// >>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2)) +// +// >>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0])) +// +// +// +// +//go:linkname CommonType py.common_type +func CommonType(__llgo_va_list ...interface{}) *py.Object +// +// Upper triangle of an array. +// +// Return a copy of an array with the elements below the `k`-th diagonal +// zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the +// final two axes. +// +// Please refer to the documentation for `tril` for further details. +// +// See Also +// -------- +// tril : lower triangle of an array +// +// Examples +// -------- +// >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) +// array([[ 1, 2, 3], +// [ 4, 5, 6], +// [ 0, 8, 9], +// [ 0, 0, 12]]) +// +// >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) +// array([[[ 0, 1, 2, 3, 4], +// [ 0, 6, 7, 8, 9], +// [ 0, 0, 12, 13, 14], +// [ 0, 0, 0, 18, 19]], +// [[20, 21, 22, 23, 24], +// [ 0, 26, 27, 28, 29], +// [ 0, 0, 32, 33, 34], +// [ 0, 0, 0, 38, 39]], +// [[40, 41, 42, 43, 44], +// [ 0, 46, 47, 48, 49], +// [ 0, 0, 52, 53, 54], +// [ 0, 0, 0, 58, 59]]]) +// +// +// +//go:linkname Triu py.triu +func Triu(m *py.Object, k *py.Object) *py.Object +// expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate ``exp(x) - 1`` for all elements in the array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise exponential minus one: ``out = exp(x) - 1``. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log1p : ``log(1 + x)``, the inverse of expm1. +// +// +// Notes +// ----- +// This function provides greater precision than ``exp(x) - 1`` +// for small values of ``x``. +// +// Examples +// -------- +// The true value of ``exp(1e-10) - 1`` is ``1.00000000005e-10`` to +// about 32 significant digits. This example shows the superiority of +// expm1 in this case. +// +// >>> np.expm1(1e-10) +// 1.00000000005e-10 +// >>> np.exp(1e-10) - 1 +// 1.000000082740371e-10 +// +//go:linkname Expm1 py.expm1 +func Expm1(x *py.Object, out *py.Object) *py.Object +// log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the natural logarithm of one plus the input array, element-wise. +// +// Calculates ``log(1 + x)``. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Natural logarithm of `1 + x`, element-wise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : ``exp(x) - 1``, the inverse of `log1p`. +// +// Notes +// ----- +// For real-valued input, `log1p` is accurate also for `x` so small +// that `1 + x == 1` in floating-point accuracy. +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `exp(z) = 1 + x`. The convention is to return +// the `z` whose imaginary part lies in `[-pi, pi]`. +// +// For real-valued input data types, `log1p` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log1p` is a complex analytical function that +// has a branch cut `[-inf, -1]` and is continuous from above on it. +// `log1p` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log1p(1e-99) +// 1e-99 +// >>> np.log(1 + 1e-99) +// 0.0 +// +//go:linkname Log1p py.log1p +func Log1p(x *py.Object, out *py.Object) *py.Object +// power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in +// `x2`. `x1` and `x2` must be broadcastable to the same shape. +// +// An integer type raised to a negative integer power will raise a +// ``ValueError``. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// float_power : power function that promotes integers to float +// +// Examples +// -------- +// Cube each element in an array. +// +// >>> x1 = np.arange(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.power(x1, 3) +// array([ 0, 1, 8, 27, 64, 125]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.power(x1, x2) +// array([[ 0, 1, 8, 27, 16, 5], +// [ 0, 1, 8, 27, 16, 5]]) +// +// The ``**`` operator can be used as a shorthand for ``np.power`` on +// ndarrays. +// +// >>> x2 = np.array([1, 2, 3, 3, 2, 1]) +// >>> x1 = np.arange(6) +// >>> x1 ** x2 +// array([ 0, 1, 8, 27, 16, 5]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1.0, -4.0]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname Power py.power +func Power(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return a 2-D array with ones on the diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the output. +// M : int, optional +// Number of columns in the output. If None, defaults to `N`. +// k : int, optional +// Index of the diagonal: 0 (the default) refers to the main diagonal, +// a positive value refers to an upper diagonal, and a negative value +// to a lower diagonal. +// dtype : data-type, optional +// Data-type of the returned array. +// order : {'C', 'F'}, optional +// Whether the output should be stored in row-major (C-style) or +// column-major (Fortran-style) order in memory. +// +// .. versionadded:: 1.14.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// I : ndarray of shape (N,M) +// An array where all elements are equal to zero, except for the `k`-th +// diagonal, whose values are equal to one. +// +// See Also +// -------- +// identity : (almost) equivalent function +// diag : diagonal 2-D array from a 1-D array specified by the user. +// +// Examples +// -------- +// >>> np.eye(2, dtype=int) +// array([[1, 0], +// [0, 1]]) +// >>> np.eye(3, k=1) +// array([[0., 1., 0.], +// [0., 0., 1.], +// [0., 0., 0.]]) +// +// +// +//go:linkname Eye py.eye +func Eye(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Save an array to a binary file in NumPy ``.npy`` format. +// +// Parameters +// ---------- +// file : file, str, or pathlib.Path +// File or filename to which the data is saved. If file is a file-object, +// then the filename is unchanged. If file is a string or Path, a ``.npy`` +// extension will be appended to the filename if it does not already +// have one. +// arr : array_like +// Array data to be saved. +// allow_pickle : bool, optional +// Allow saving object arrays using Python pickles. Reasons for disallowing +// pickles include security (loading pickled data can execute arbitrary +// code) and portability (pickled objects may not be loadable on different +// Python installations, for example if the stored objects require libraries +// that are not available, and not all pickled data is compatible between +// Python 2 and Python 3). +// Default: True +// fix_imports : bool, optional +// Only useful in forcing objects in object arrays on Python 3 to be +// pickled in a Python 2 compatible way. If `fix_imports` is True, pickle +// will try to map the new Python 3 names to the old module names used in +// Python 2, so that the pickle data stream is readable with Python 2. +// +// See Also +// -------- +// savez : Save several arrays into a ``.npz`` archive +// savetxt, load +// +// Notes +// ----- +// For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// Any data saved to the file is appended to the end of the file. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// +// >>> x = np.arange(10) +// >>> np.save(outfile, x) +// +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> np.load(outfile) +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// >>> with open('test.npy', 'wb') as f: +// ... np.save(f, np.array([1, 2])) +// ... np.save(f, np.array([1, 3])) +// >>> with open('test.npy', 'rb') as f: +// ... a = np.load(f) +// ... b = np.load(f) +// >>> print(a, b) +// # [1 2] [1 3] +// +// +//go:linkname Save py.save +func Save(file *py.Object, arr *py.Object, allowPickle *py.Object, fixImports *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Mat py.mat +func Mat(data *py.Object, dtype *py.Object) *py.Object +// +// Return a new array of given shape and type, filled with `fill_value`. +// +// Parameters +// ---------- +// shape : int or sequence of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// fill_value : scalar or array_like +// Fill value. +// dtype : data-type, optional +// The desired data-type for the array The default, None, means +// ``np.array(fill_value).dtype``. +// order : {'C', 'F'}, optional +// Whether to store multidimensional data in C- or Fortran-contiguous +// (row- or column-wise) order in memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the given shape, dtype, and order. +// +// See Also +// -------- +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// +// Examples +// -------- +// >>> np.full((2, 2), np.inf) +// array([[inf, inf], +// [inf, inf]]) +// >>> np.full((2, 2), 10) +// array([[10, 10], +// [10, 10]]) +// +// >>> np.full((2, 2), [1, 2]) +// array([[1, 2], +// [1, 2]]) +// +// +// +//go:linkname Full py.full +func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conjugate py.conjugate +func Conjugate(x *py.Object, out *py.Object) *py.Object +// subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Subtract arguments, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays to be subtracted from each other. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The difference of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// Equivalent to ``x1 - x2`` in terms of array broadcasting. +// +// Examples +// -------- +// >>> np.subtract(1.0, 4.0) +// -3.0 +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.subtract(x1, x2) +// array([[ 0., 0., 0.], +// [ 3., 3., 3.], +// [ 6., 6., 6.]]) +// +// The ``-`` operator can be used as a shorthand for ``np.subtract`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> x1 - x2 +// array([[0., 0., 0.], +// [3., 3., 3.], +// [6., 6., 6.]]) +// +//go:linkname Subtract py.subtract +func Subtract(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// bincount(x, /, weights=None, minlength=0) +// +// Count number of occurrences of each value in array of non-negative ints. +// +// The number of bins (of size 1) is one larger than the largest value in +// `x`. If `minlength` is specified, there will be at least this number +// of bins in the output array (though it will be longer if necessary, +// depending on the contents of `x`). +// Each bin gives the number of occurrences of its index value in `x`. +// If `weights` is specified the input array is weighted by it, i.e. if a +// value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead +// of ``out[n] += 1``. +// +// Parameters +// ---------- +// x : array_like, 1 dimension, nonnegative ints +// Input array. +// weights : array_like, optional +// Weights, array of the same shape as `x`. +// minlength : int, optional +// A minimum number of bins for the output array. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// out : ndarray of ints +// The result of binning the input array. +// The length of `out` is equal to ``np.amax(x)+1``. +// +// Raises +// ------ +// ValueError +// If the input is not 1-dimensional, or contains elements with negative +// values, or if `minlength` is negative. +// TypeError +// If the type of the input is float or complex. +// +// See Also +// -------- +// histogram, digitize, unique +// +// Examples +// -------- +// >>> np.bincount(np.arange(5)) +// array([1, 1, 1, 1, 1]) +// >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7])) +// array([1, 3, 1, 1, 0, 0, 0, 1]) +// +// >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23]) +// >>> np.bincount(x).size == np.amax(x)+1 +// True +// +// The input array needs to be of integer dtype, otherwise a +// TypeError is raised: +// +// >>> np.bincount(np.arange(5, dtype=float)) +// Traceback (most recent call last): +// ... +// TypeError: Cannot cast array data from dtype('float64') to dtype('int64') +// according to the rule 'safe' +// +// A possible use of ``bincount`` is to perform sums over +// variable-size chunks of an array, using the ``weights`` keyword. +// +// >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights +// >>> x = np.array([0, 1, 1, 2, 2, 2]) +// >>> np.bincount(x, weights=w) +// array([ 0.3, 0.7, 1.1]) +// +// +// +//go:linkname Bincount py.bincount +func Bincount(x *py.Object, weights *py.Object, minlength *py.Object) *py.Object +// +// The differences between consecutive elements of an array. +// +// Parameters +// ---------- +// ary : array_like +// If necessary, will be flattened before the differences are taken. +// to_end : array_like, optional +// Number(s) to append at the end of the returned differences. +// to_begin : array_like, optional +// Number(s) to prepend at the beginning of the returned differences. +// +// Returns +// ------- +// ediff1d : ndarray +// The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``. +// +// See Also +// -------- +// diff, gradient +// +// Notes +// ----- +// When applied to masked arrays, this function drops the mask information +// if the `to_begin` and/or `to_end` parameters are used. +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.ediff1d(x) +// array([ 1, 2, 3, -7]) +// +// >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) +// array([-99, 1, 2, ..., -7, 88, 99]) +// +// The returned array is always 1D. +// +// >>> y = [[1, 2, 4], [1, 6, 24]] +// >>> np.ediff1d(y) +// array([ 1, 2, -3, 5, 18]) +// +// +// +//go:linkname Ediff1d py.ediff1d +func Ediff1d(ary *py.Object, toEnd *py.Object, toBegin *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis, while +// ignoring NaNs. +// +// Returns the standard deviation, a measure of the spread of a +// distribution, of the non-NaN array elements. The standard deviation is +// computed for the flattened array by default, otherwise over the +// specified axis. +// +// For all-NaN slices or slices with zero degrees of freedom, NaN is +// returned and a `RuntimeWarning` is raised. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of the non-NaN values. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the standard deviation is computed. The default is +// to compute the standard deviation of the flattened array. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it +// is the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the +// calculated values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of non-NaN +// elements. By default `ddof` is zero. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this value is anything but the default it is passed through +// as-is to the relevant functions of the sub-classes. If these +// functions do not have a `keepdims` kwarg, a RuntimeError will +// be raised. +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard +// deviation, otherwise return a reference to the output array. If +// ddof is >= the number of non-NaN elements in a slice or the slice +// contains only NaNs, then the result for that slice is NaN. +// +// See Also +// -------- +// var, mean, std +// nanvar, nanmean +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean: ``std = sqrt(mean(abs(x - x.mean())**2))``. +// +// The average squared deviation is normally calculated as +// ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is +// specified, the divisor ``N - ddof`` is used instead. In standard +// statistical practice, ``ddof=1`` provides an unbiased estimator of the +// variance of the infinite population. ``ddof=0`` provides a maximum +// likelihood estimate of the variance for normally distributed variables. +// The standard deviation computed in this function is the square root of +// the estimated variance, so even with ``ddof=1``, it will not be an +// unbiased estimate of the standard deviation per se. +// +// Note that, for complex numbers, `std` takes the absolute value before +// squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example +// below). Specifying a higher-accuracy accumulator using the `dtype` +// keyword can alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, np.nan], [3, 4]]) +// >>> np.nanstd(a) +// 1.247219128924647 +// >>> np.nanstd(a, axis=0) +// array([1., 0.]) +// >>> np.nanstd(a, axis=1) +// array([0., 0.5]) # may vary +// +// +// +//go:linkname Nanstd py.nanstd +func Nanstd(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +// +// Compute the multidimensional histogram of some data. +// +// Parameters +// ---------- +// sample : (N, D) array, or (N, D) array_like +// The data to be histogrammed. +// +// Note the unusual interpretation of sample when an array_like: +// +// * When an array, each row is a coordinate in a D-dimensional space - +// such as ``histogramdd(np.array([p1, p2, p3]))``. +// * When an array_like, each element is the list of values for single +// coordinate - such as ``histogramdd((X, Y, Z))``. +// +// The first form should be preferred. +// +// bins : sequence or int, optional +// The bin specification: +// +// * A sequence of arrays describing the monotonically increasing bin +// edges along each dimension. +// * The number of bins for each dimension (nx, ny, ... =bins) +// * The number of bins for all dimensions (nx=ny=...=bins). +// +// range : sequence, optional +// A sequence of length D, each an optional (lower, upper) tuple giving +// the outer bin edges to be used if the edges are not given explicitly in +// `bins`. +// An entry of None in the sequence results in the minimum and maximum +// values being used for the corresponding dimension. +// The default, None, is equivalent to passing a tuple of D None values. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_volume``. +// weights : (N,) array_like, optional +// An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. +// Weights are normalized to 1 if density is True. If density is False, +// the values of the returned histogram are equal to the sum of the +// weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray +// The multidimensional histogram of sample x. See density and weights +// for the different possible semantics. +// edges : list +// A list of D arrays describing the bin edges for each dimension. +// +// See Also +// -------- +// histogram: 1-D histogram +// histogram2d: 2-D histogram +// +// Examples +// -------- +// >>> r = np.random.randn(100,3) +// >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) +// >>> H.shape, edges[0].size, edges[1].size, edges[2].size +// ((5, 8, 4), 6, 9, 5) +// +// +// +//go:linkname Histogramdd py.histogramdd +func Histogramdd(sample *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Interpret the input as a matrix. +// +// Unlike `matrix`, `asmatrix` does not make a copy if the input is already +// a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. +// +// Parameters +// ---------- +// data : array_like +// Input data. +// dtype : data-type +// Data-type of the output matrix. +// +// Returns +// ------- +// mat : matrix +// `data` interpreted as a matrix. +// +// Examples +// -------- +// >>> x = np.array([[1, 2], [3, 4]]) +// +// >>> m = np.asmatrix(x) +// +// >>> x[0,0] = 5 +// +// >>> m +// matrix([[5, 2], +// [3, 4]]) +// +// +// +//go:linkname Asmatrix py.asmatrix +func Asmatrix(data *py.Object, dtype *py.Object) *py.Object +// matmul(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis]) +// +// Matrix product of two arrays. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays, scalars not allowed. +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that matches the signature `(n,k),(k,m)->(n,m)`. If not +// provided or None, a freshly-allocated array is returned. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.16 +// Now handles ufunc kwargs +// +// Returns +// ------- +// y : ndarray +// The matrix product of the inputs. +// This is a scalar only when both x1, x2 are 1-d vectors. +// +// Raises +// ------ +// ValueError +// If the last dimension of `x1` is not the same size as +// the second-to-last dimension of `x2`. +// +// If a scalar value is passed in. +// +// See Also +// -------- +// vdot : Complex-conjugating dot product. +// tensordot : Sum products over arbitrary axes. +// einsum : Einstein summation convention. +// dot : alternative matrix product with different broadcasting rules. +// +// Notes +// ----- +// +// The behavior depends on the arguments in the following way. +// +// - If both arguments are 2-D they are multiplied like conventional +// matrices. +// - If either argument is N-D, N > 2, it is treated as a stack of +// matrices residing in the last two indexes and broadcast accordingly. +// - If the first argument is 1-D, it is promoted to a matrix by +// prepending a 1 to its dimensions. After matrix multiplication +// the prepended 1 is removed. +// - If the second argument is 1-D, it is promoted to a matrix by +// appending a 1 to its dimensions. After matrix multiplication +// the appended 1 is removed. +// +// ``matmul`` differs from ``dot`` in two important ways: +// +// - Multiplication by scalars is not allowed, use ``*`` instead. +// - Stacks of matrices are broadcast together as if the matrices +// were elements, respecting the signature ``(n,k),(k,m)->(n,m)``: +// +// >>> a = np.ones([9, 5, 7, 4]) +// >>> c = np.ones([9, 5, 4, 3]) +// >>> np.dot(a, c).shape +// (9, 5, 7, 9, 5, 3) +// >>> np.matmul(a, c).shape +// (9, 5, 7, 3) +// >>> # n is 7, k is 4, m is 3 +// +// The matmul function implements the semantics of the ``@`` operator +// introduced in Python 3.5 following :pep:`465`. +// +// It uses an optimized BLAS library when possible (see `numpy.linalg`). +// +// Examples +// -------- +// For 2-D arrays it is the matrix product: +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([[4, 1], +// ... [2, 2]]) +// >>> np.matmul(a, b) +// array([[4, 1], +// [2, 2]]) +// +// For 2-D mixed with 1-D, the result is the usual. +// +// >>> a = np.array([[1, 0], +// ... [0, 1]]) +// >>> b = np.array([1, 2]) +// >>> np.matmul(a, b) +// array([1, 2]) +// >>> np.matmul(b, a) +// array([1, 2]) +// +// +// Broadcasting is conventional for stacks of arrays +// +// >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) +// >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) +// >>> np.matmul(a,b).shape +// (2, 2, 2) +// >>> np.matmul(a, b)[0, 1, 1] +// 98 +// >>> sum(a[0, 1, :] * b[0 , :, 1]) +// 98 +// +// Vector, vector returns the scalar inner product, but neither argument +// is complex-conjugated: +// +// >>> np.matmul([2j, 3j], [2j, 3j]) +// (-13+0j) +// +// Scalar multiplication raises an error. +// +// >>> np.matmul([1,2], 3) +// Traceback (most recent call last): +// ... +// ValueError: matmul: Input operand 1 does not have enough dimensions ... +// +// The ``@`` operator can be used as a shorthand for ``np.matmul`` on +// ndarrays. +// +// >>> x1 = np.array([2j, 3j]) +// >>> x2 = np.array([2j, 3j]) +// >>> x1 @ x2 +// (-13+0j) +// +// .. versionadded:: 1.10.0 +// +//go:linkname Matmul py.matmul +func Matmul(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Check if all elements of input array are true. +// +// .. deprecated:: 1.25.0 +// ``alltrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `all` instead. +// +// See Also +// -------- +// numpy.all : Equivalent function; see for details. +// +// +//go:linkname Alltrue py.alltrue +func Alltrue(__llgo_va_list ...interface{}) *py.Object +// +// is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// Calculates which of the given dates are valid days, and which are not. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of bool, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of bool +// An array with the same shape as ``dates``, containing True for +// each valid day, and False for each invalid day. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// busday_offset : Applies an offset counted in valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # The weekdays are Friday, Saturday, and Monday +// ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'], +// ... holidays=['2011-07-01', '2011-07-04', '2011-07-17']) +// array([False, False, True]) +// +// +//go:linkname IsBusday py.is_busday +func IsBusday(dates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return a string representation of the data in an array. +// +// The data in the array is returned as a single string. This function is +// similar to `array_repr`, the difference being that `array_repr` also +// returns information on the kind of array and its data type. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// See Also +// -------- +// array2string, array_repr, set_printoptions +// +// Examples +// -------- +// >>> np.array_str(np.arange(3)) +// '[0 1 2]' +// +// +// +//go:linkname ArrayStr py.array_str +func ArrayStr(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Expand the shape of an array. +// +// Insert a new axis that will appear at the `axis` position in the expanded +// array shape. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int or tuple of ints +// Position in the expanded axes where the new axis (or axes) is placed. +// +// .. deprecated:: 1.13.0 +// Passing an axis where ``axis > a.ndim`` will be treated as +// ``axis == a.ndim``, and passing ``axis < -a.ndim - 1`` will +// be treated as ``axis == 0``. This behavior is deprecated. +// +// .. versionchanged:: 1.18.0 +// A tuple of axes is now supported. Out of range axes as +// described above are now forbidden and raise an `AxisError`. +// +// Returns +// ------- +// result : ndarray +// View of `a` with the number of dimensions increased. +// +// See Also +// -------- +// squeeze : The inverse operation, removing singleton dimensions +// reshape : Insert, remove, and combine dimensions, and resize existing ones +// doc.indexing, atleast_1d, atleast_2d, atleast_3d +// +// Examples +// -------- +// >>> x = np.array([1, 2]) +// >>> x.shape +// (2,) +// +// The following is equivalent to ``x[np.newaxis, :]`` or ``x[np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=0) +// >>> y +// array([[1, 2]]) +// >>> y.shape +// (1, 2) +// +// The following is equivalent to ``x[:, np.newaxis]``: +// +// >>> y = np.expand_dims(x, axis=1) +// >>> y +// array([[1], +// [2]]) +// >>> y.shape +// (2, 1) +// +// ``axis`` may also be a tuple: +// +// >>> y = np.expand_dims(x, axis=(0, 1)) +// >>> y +// array([[[1, 2]]]) +// +// >>> y = np.expand_dims(x, axis=(2, 0)) +// >>> y +// array([[[1], +// [2]]]) +// +// Note that some examples may use ``None`` instead of ``np.newaxis``. These +// are the same objects: +// +// >>> np.newaxis is None +// True +// +// +// +//go:linkname ExpandDims py.expand_dims +func ExpandDims(a *py.Object, axis *py.Object) *py.Object +// +// Return an array of ones with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of ones with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// ones : Return a new array setting values to one. +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> x = x.reshape((2, 3)) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.ones_like(x) +// array([[1, 1, 1], +// [1, 1, 1]]) +// +// >>> y = np.arange(3, dtype=float) +// >>> y +// array([0., 1., 2.]) +// >>> np.ones_like(y) +// array([1., 1., 1.]) +// +// +// +//go:linkname OnesLike py.ones_like +func OnesLike(__llgo_va_list ...interface{}) *py.Object +// +// Return True if x is a not complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. So even if the input +// has an imaginary part equal to zero, `isrealobj` evaluates to False +// if the data type is complex. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// y : bool +// The return value, False if `x` is of a complex type. +// +// See Also +// -------- +// iscomplexobj, isreal +// +// Notes +// ----- +// The function is only meant for arrays with numerical values but it +// accepts all other objects. Since it assumes array input, the return +// value of other objects may be True. +// +// >>> np.isrealobj('A string') +// True +// >>> np.isrealobj(False) +// True +// >>> np.isrealobj(None) +// True +// +// Examples +// -------- +// >>> np.isrealobj(1) +// True +// >>> np.isrealobj(1+0j) +// False +// >>> np.isrealobj([3, 1+0j, True]) +// False +// +// +// +//go:linkname Isrealobj py.isrealobj +func Isrealobj(x *py.Object) *py.Object +// +// Sort a complex array using the real part first, then the imaginary part. +// +// Parameters +// ---------- +// a : array_like +// Input array +// +// Returns +// ------- +// out : complex ndarray +// Always returns a sorted complex array. +// +// Examples +// -------- +// >>> np.sort_complex([5, 3, 6, 2, 1]) +// array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) +// +// >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j]) +// array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j]) +// +// +// +//go:linkname SortComplex py.sort_complex +func SortComplex(a *py.Object) *py.Object +// +// Return the Blackman window. +// +// The Blackman window is a taper formed by using the first three +// terms of a summation of cosines. It was designed to have close to the +// minimal leakage possible. It is close to optimal, only slightly worse +// than a Kaiser window. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an empty +// array is returned. +// +// Returns +// ------- +// out : ndarray +// The window, with the maximum value normalized to one (the value one +// appears only if the number of samples is odd). +// +// See Also +// -------- +// bartlett, hamming, hanning, kaiser +// +// Notes +// ----- +// The Blackman window is defined as +// +// .. math:: w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M) +// +// Most references to the Blackman window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. It is also known as an apodization (which means +// "removing the foot", i.e. smoothing discontinuities at the beginning +// and end of the sampled signal) or tapering function. It is known as a +// "near optimal" tapering function, almost as good (by some measures) +// as the kaiser window. +// +// References +// ---------- +// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, +// Dover Publications, New York. +// +// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. +// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.blackman(12) +// array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary +// 4.14397981e-01, 7.36045180e-01, 9.67046769e-01, +// 9.67046769e-01, 7.36045180e-01, 4.14397981e-01, +// 1.59903635e-01, 3.26064346e-02, -1.38777878e-17]) +// +// Plot the window and the frequency response: +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.blackman(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Blackman window") +// Text(0.5, 1.0, 'Blackman window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Blackman window") +// Text(0.5, 1.0, 'Frequency response of Blackman window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Blackman py.blackman +func Blackman(M *py.Object) *py.Object +// +// Broadcast the input shapes into a single shape. +// +// :ref:`Learn more about broadcasting here `. +// +// .. versionadded:: 1.20.0 +// +// Parameters +// ---------- +// `*args` : tuples of ints, or ints +// The shapes to be broadcast against each other. +// +// Returns +// ------- +// tuple +// Broadcasted shape. +// +// Raises +// ------ +// ValueError +// If the shapes are not compatible and cannot be broadcast according +// to NumPy's broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_to +// +// Examples +// -------- +// >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2)) +// (3, 2) +// +// >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) +// (5, 6, 7) +// +// +//go:linkname BroadcastShapes py.broadcast_shapes +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object +// +// Find the union of two arrays. +// +// Return the unique, sorted array of values that are in either of the two +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. They are flattened if they are not already 1D. +// +// Returns +// ------- +// union1d : ndarray +// Unique, sorted union of the input arrays. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.union1d([-1, 0, 1], [-2, 0, 2]) +// array([-2, -1, 0, 1, 2]) +// +// To find the union of more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([1, 2, 3, 4, 6]) +// +// +//go:linkname Union1d py.union1d +func Union1d(ar1 *py.Object, ar2 *py.Object) *py.Object +// +// Find the indices of array elements that are non-zero, grouped by element. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// index_array : (N, a.ndim) ndarray +// Indices of elements that are non-zero. Indices are grouped by element. +// This array will have shape ``(N, a.ndim)`` where ``N`` is the number of +// non-zero items. +// +// See Also +// -------- +// where, nonzero +// +// Notes +// ----- +// ``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``, +// but produces a result of the correct shape for a 0D array. +// +// The output of ``argwhere`` is not suitable for indexing arrays. +// For this purpose use ``nonzero(a)`` instead. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.argwhere(x>1) +// array([[0, 2], +// [1, 0], +// [1, 1], +// [1, 2]]) +// +// +// +//go:linkname Argwhere py.argwhere +func Argwhere(a *py.Object) *py.Object +// +// True if two arrays have the same shape and elements, False otherwise. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// equal_nan : bool +// Whether to compare NaN's as equal. If the dtype of a1 and a2 is +// complex, values will be considered equal if either the real or the +// imaginary component of a given value is ``nan``. +// +// .. versionadded:: 1.19.0 +// +// Returns +// ------- +// b : bool +// Returns True if the arrays are equal. +// +// See Also +// -------- +// allclose: Returns True if two arrays are element-wise equal within a +// tolerance. +// array_equiv: Returns True if input arrays are shape consistent and all +// elements equal. +// +// Examples +// -------- +// >>> np.array_equal([1, 2], [1, 2]) +// True +// >>> np.array_equal(np.array([1, 2]), np.array([1, 2])) +// True +// >>> np.array_equal([1, 2], [1, 2, 3]) +// False +// >>> np.array_equal([1, 2], [1, 4]) +// False +// >>> a = np.array([1, np.nan]) +// >>> np.array_equal(a, a) +// False +// >>> np.array_equal(a, a, equal_nan=True) +// True +// +// When ``equal_nan`` is True, complex values with nan components are +// considered equal if either the real *or* the imaginary components are nan. +// +// >>> a = np.array([1 + 1j]) +// >>> b = a.copy() +// >>> a.real = np.nan +// >>> b.imag = np.nan +// >>> np.array_equal(a, b, equal_nan=True) +// True +// +// +//go:linkname ArrayEqual py.array_equal +func ArrayEqual(a1 *py.Object, a2 *py.Object, equalNan *py.Object) *py.Object +// +// Join a sequence of arrays along a new axis. +// +// The ``axis`` parameter specifies the index of the new axis in the +// dimensions of the result. For example, if ``axis=0`` it will be the first +// dimension and if ``axis=-1`` it will be the last dimension. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// arrays : sequence of array_like +// Each array must have the same shape. +// +// axis : int, optional +// The axis in the result array along which the input arrays are stacked. +// +// out : ndarray, optional +// If provided, the destination to place the result. The shape must be +// correct, matching that of what stack would have returned if no +// out argument were specified. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// +// Returns +// ------- +// stacked : ndarray +// The stacked array has one more dimension than the input arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// block : Assemble an nd-array from nested lists of blocks. +// split : Split array into a list of multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> arrays = [np.random.randn(3, 4) for _ in range(10)] +// >>> np.stack(arrays, axis=0).shape +// (10, 3, 4) +// +// >>> np.stack(arrays, axis=1).shape +// (3, 10, 4) +// +// >>> np.stack(arrays, axis=2).shape +// (3, 4, 10) +// +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.stack((a, b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> np.stack((a, b), axis=-1) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Stack py.stack +func Stack(arrays *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Returns a bool array, where True if input element is complex. +// +// What is tested is whether the input has a non-zero imaginary part, not if +// the input type is complex. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray of bools +// Output array. +// +// See Also +// -------- +// isreal +// iscomplexobj : Return True if x is a complex type or an array of complex +// numbers. +// +// Examples +// -------- +// >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j]) +// array([ True, False, False, False, False, True]) +// +// +// +//go:linkname Iscomplex py.iscomplex +func Iscomplex(x *py.Object) *py.Object +// +// Return an array converted to a float type. +// +// Parameters +// ---------- +// a : array_like +// The input array. +// dtype : str or dtype object, optional +// Float type code to coerce input array `a`. If `dtype` is one of the +// 'int' dtypes, it is replaced with float64. +// +// Returns +// ------- +// out : ndarray +// The input `a` as a float ndarray. +// +// Examples +// -------- +// >>> np.asfarray([2, 3]) +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='float') +// array([2., 3.]) +// >>> np.asfarray([2, 3], dtype='int8') +// array([2., 3.]) +// +// +// +//go:linkname Asfarray py.asfarray +func Asfarray(a *py.Object, dtype *py.Object) *py.Object +// +// Rotate an array by 90 degrees in the plane specified by axes. +// +// Rotation direction is from the first towards the second axis. +// This means for a 2D array with the default `k` and `axes`, the +// rotation will be counterclockwise. +// +// Parameters +// ---------- +// m : array_like +// Array of two or more dimensions. +// k : integer +// Number of times the array is rotated by 90 degrees. +// axes : (2,) array_like +// The array is rotated in the plane defined by the axes. +// Axes must be different. +// +// .. versionadded:: 1.12.0 +// +// Returns +// ------- +// y : ndarray +// A rotated view of `m`. +// +// See Also +// -------- +// flip : Reverse the order of elements in an array along the given axis. +// fliplr : Flip an array horizontally. +// flipud : Flip an array vertically. +// +// Notes +// ----- +// ``rot90(m, k=1, axes=(1,0))`` is the reverse of +// ``rot90(m, k=1, axes=(0,1))`` +// +// ``rot90(m, k=1, axes=(1,0))`` is equivalent to +// ``rot90(m, k=-1, axes=(0,1))`` +// +// Examples +// -------- +// >>> m = np.array([[1,2],[3,4]], int) +// >>> m +// array([[1, 2], +// [3, 4]]) +// >>> np.rot90(m) +// array([[2, 4], +// [1, 3]]) +// >>> np.rot90(m, 2) +// array([[4, 3], +// [2, 1]]) +// >>> m = np.arange(8).reshape((2,2,2)) +// >>> np.rot90(m, 1, (1,2)) +// array([[[1, 3], +// [0, 2]], +// [[5, 7], +// [4, 6]]]) +// +// +// +//go:linkname Rot90 py.rot90 +func Rot90(m *py.Object, k *py.Object, axes *py.Object) *py.Object +// +// Return a new array with sub-arrays along an axis deleted. For a one +// dimensional array, this returns those entries not returned by +// `arr[obj]`. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : slice, int or array of ints +// Indicate indices of sub-arrays to remove along the specified axis. +// +// .. versionchanged:: 1.19.0 +// Boolean indices are now treated as a mask of elements to remove, +// rather than being cast to the integers 0 and 1. +// +// axis : int, optional +// The axis along which to delete the subarray defined by `obj`. +// If `axis` is None, `obj` is applied to the flattened array. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with the elements specified by `obj` removed. Note +// that `delete` does not occur in-place. If `axis` is None, `out` is +// a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// append : Append elements at the end of an array. +// +// Notes +// ----- +// Often it is preferable to use a boolean mask. For example: +// +// >>> arr = np.arange(12) + 1 +// >>> mask = np.ones(len(arr), dtype=bool) +// >>> mask[[0,2,4]] = False +// >>> result = arr[mask,...] +// +// Is equivalent to ``np.delete(arr, [0,2,4], axis=0)``, but allows further +// use of `mask`. +// +// Examples +// -------- +// >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) +// >>> arr +// array([[ 1, 2, 3, 4], +// [ 5, 6, 7, 8], +// [ 9, 10, 11, 12]]) +// >>> np.delete(arr, 1, 0) +// array([[ 1, 2, 3, 4], +// [ 9, 10, 11, 12]]) +// +// >>> np.delete(arr, np.s_[::2], 1) +// array([[ 2, 4], +// [ 6, 8], +// [10, 12]]) +// >>> np.delete(arr, [1,3,5], None) +// array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) +// +// +// +//go:linkname Delete py.delete +func Delete(arr *py.Object, obj *py.Object, axis *py.Object) *py.Object +// +// Return the product of array elements over a given axis treating Not a +// Numbers (NaNs) as ones. +// +// One is returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose product is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the product is computed. The default is to compute +// the product of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// keepdims : bool, optional +// If True, the axes which are reduced are left in the result as +// dimensions with size one. With this option, the result will +// broadcast correctly against the original `arr`. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.prod : Product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nanprod(1) +// 1 +// >>> np.nanprod([1]) +// 1 +// >>> np.nanprod([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanprod(a) +// 6.0 +// >>> np.nanprod(a, axis=0) +// array([3., 2.]) +// +// +// +//go:linkname Nanprod py.nanprod +func Nanprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Returns True if input arrays are shape consistent and all elements equal. +// +// Shape consistent means they are either the same shape, or one input array +// can be broadcasted to create the same shape as the other one. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Input arrays. +// +// Returns +// ------- +// out : bool +// True if equivalent, False otherwise. +// +// Examples +// -------- +// >>> np.array_equiv([1, 2], [1, 2]) +// True +// >>> np.array_equiv([1, 2], [1, 3]) +// False +// +// Showing the shape equivalence: +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 2]]) +// True +// >>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]]) +// False +// +// >>> np.array_equiv([1, 2], [[1, 2], [1, 3]]) +// False +// +// +// +//go:linkname ArrayEquiv py.array_equiv +func ArrayEquiv(a1 *py.Object, a2 *py.Object) *py.Object +// +// Return the binary representation of the input number as a string. +// +// For negative numbers, if width is not given, a minus sign is added to the +// front. If width is given, the two's complement of the number is +// returned, with respect to that width. +// +// In a two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit two's-complement +// system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// num : int +// Only an integer decimal number can be used. +// width : int, optional +// The length of the returned string if `num` is positive, or the length +// of the two's complement if `num` is negative, provided that `width` is +// at least a sufficient number of bits for `num` to be represented in the +// designated form. +// +// If the `width` value is insufficient, it will be ignored, and `num` will +// be returned in binary (`num` > 0) or two's complement (`num` < 0) form +// with its width equal to the minimum number of bits needed to represent +// the number in the designated form. This behavior is deprecated and will +// later raise an error. +// +// .. deprecated:: 1.12.0 +// +// Returns +// ------- +// bin : str +// Binary representation of `num` or two's complement of `num`. +// +// See Also +// -------- +// base_repr: Return a string representation of a number in the given base +// system. +// bin: Python's built-in binary representation generator of an integer. +// +// Notes +// ----- +// `binary_repr` is equivalent to using `base_repr` with base 2, but about 25x +// faster. +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// >>> np.binary_repr(3) +// '11' +// >>> np.binary_repr(-3) +// '-11' +// >>> np.binary_repr(3, width=4) +// '0011' +// +// The two's complement is returned when the input number is negative and +// width is specified: +// +// >>> np.binary_repr(-3, width=3) +// '101' +// >>> np.binary_repr(-3, width=5) +// '11101' +// +// +// +//go:linkname BinaryRepr py.binary_repr +func BinaryRepr(num *py.Object, width *py.Object) *py.Object +// +// Test whether all array elements along a given axis evaluate to True. +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a logical AND reduction is performed. +// The default (``axis=None``) is to perform a logical AND over all +// the dimensions of the input array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : ndarray, optional +// Alternate output array in which to place the result. +// It must have the same shape as the expected output and its +// type is preserved (e.g., if ``dtype(out)`` is float, the result +// will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more +// details. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `all` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in checking for all `True` values. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// all : ndarray, bool +// A new boolean or array is returned unless `out` is specified, +// in which case a reference to `out` is returned. +// +// See Also +// -------- +// ndarray.all : equivalent method +// +// any : Test whether any element along a given axis evaluates to True. +// +// Notes +// ----- +// Not a Number (NaN), positive infinity and negative infinity +// evaluate to `True` because these are not equal to zero. +// +// Examples +// -------- +// >>> np.all([[True,False],[True,True]]) +// False +// +// >>> np.all([[True,False],[True,True]], axis=0) +// array([ True, False]) +// +// >>> np.all([-1, 4, 5]) +// True +// +// >>> np.all([1.0, np.nan]) +// True +// +// >>> np.all([[True, True], [False, True]], where=[[True], [False]]) +// True +// +// >>> o=np.array(False) +// >>> z=np.all([-1, 4, 5], out=o) +// >>> id(z), id(o), z +// (28293632, 28293632, array(True)) # may vary +// +// +// +//go:linkname All py.all +func All(__llgo_va_list ...interface{}) *py.Object +// +// Return the number of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : int, optional +// Axis along which the elements are counted. By default, give +// the total number of elements. +// +// Returns +// ------- +// element_count : int +// Number of elements along the specified axis. +// +// See Also +// -------- +// shape : dimensions of array +// ndarray.shape : dimensions of array +// ndarray.size : number of elements in array +// +// Examples +// -------- +// >>> a = np.array([[1,2,3],[4,5,6]]) +// >>> np.size(a) +// 6 +// >>> np.size(a,1) +// 3 +// >>> np.size(a,0) +// 2 +// +// +// +//go:linkname Size py.size +func Size(a *py.Object, axis *py.Object) *py.Object +// +// busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) +// +// Counts the number of valid days between `begindates` and +// `enddates`, not including the day of `enddates`. +// +// If ``enddates`` specifies a date value that is earlier than the +// corresponding ``begindates`` date value, the count will be negative. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// begindates : array_like of datetime64[D] +// The array of the first dates for counting. +// enddates : array_like of datetime64[D] +// The array of the end dates for counting, which are excluded +// from the count themselves. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of int, optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of int +// An array with a shape from broadcasting ``begindates`` and ``enddates`` +// together, containing the number of valid days between +// the begin and end dates. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_offset : Applies an offset counted in valid days. +// +// Examples +// -------- +// >>> # Number of weekdays in January 2011 +// ... np.busday_count('2011-01', '2011-02') +// 21 +// >>> # Number of weekdays in 2011 +// >>> np.busday_count('2011', '2012') +// 260 +// >>> # Number of Saturdays in 2011 +// ... np.busday_count('2011', '2012', weekmask='Sat') +// 53 +// +// +//go:linkname BusdayCount py.busday_count +func BusdayCount(begindates *py.Object, enddates *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Compute the qth quantile of the data along the specified axis, +// while ignoring nan values. +// Returns the qth quantile(s) of the array elements. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The +// default is to compute the quantile(s) along a flattened +// version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probability levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// quantile +// nanmean, nanmedian +// nanmedian : equivalent to ``nanquantile(..., 0.5)`` +// nanpercentile : same as nanquantile, but with q in the range [0, 100]. +// +// Notes +// ----- +// For more information please see `numpy.quantile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.quantile(a, 0.5) +// nan +// >>> np.nanquantile(a, 0.5) +// 3.0 +// >>> np.nanquantile(a, 0.5, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanquantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanquantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanquantile(a, 0.5, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// >>> b = a.copy() +// >>> np.nanquantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanquantile py.nanquantile +func Nanquantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// empty(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, without initializing entries. +// +// Parameters +// ---------- +// shape : int or tuple of int +// Shape of the empty array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// Desired output data-type for the array, e.g, `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data of the given shape, dtype, and +// order. Object arrays will be initialized to None. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// `empty`, unlike `zeros`, does not set the array values to zero, +// and may therefore be marginally faster. On the other hand, it requires +// the user to manually set all the values in the array, and should be +// used with caution. +// +// Examples +// -------- +// >>> np.empty([2, 2]) +// array([[ -9.74499359e+001, 6.69583040e-309], +// [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized +// +// >>> np.empty([2, 2], dtype=int) +// array([[-1073741821, -1067949133], +// [ 496041986, 19249760]]) #uninitialized +// +//go:linkname Empty py.empty +func Empty(shape *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// Return a list of coordinate matrices from coordinate vectors. +// +// Make N-D coordinate arrays for vectorized evaluations of +// N-D scalar/vector fields over N-D grids, given +// one-dimensional coordinate arrays x1, x2,..., xn. +// +// .. versionchanged:: 1.9 +// 1-D and 0-D cases are allowed. +// +// Parameters +// ---------- +// x1, x2,..., xn : array_like +// 1-D arrays representing the coordinates of a grid. +// indexing : {'xy', 'ij'}, optional +// Cartesian ('xy', default) or matrix ('ij') indexing of output. +// See Notes for more details. +// +// .. versionadded:: 1.7.0 +// sparse : bool, optional +// If True the shape of the returned coordinate array for dimension *i* +// is reduced from ``(N1, ..., Ni, ... Nn)`` to +// ``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are +// intended to be use with :ref:`basics.broadcasting`. When all +// coordinates are used in an expression, broadcasting still leads to a +// fully-dimensonal result array. +// +// Default is False. +// +// .. versionadded:: 1.7.0 +// copy : bool, optional +// If False, a view into the original arrays are returned in order to +// conserve memory. Default is True. Please note that +// ``sparse=False, copy=False`` will likely return non-contiguous +// arrays. Furthermore, more than one element of a broadcast array +// may refer to a single memory location. If you need to write to the +// arrays, make copies first. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// X1, X2,..., XN : list of ndarrays +// For vectors `x1`, `x2`,..., `xn` with lengths ``Ni=len(xi)``, +// returns ``(N1, N2, N3,..., Nn)`` shaped arrays if indexing='ij' +// or ``(N2, N1, N3,..., Nn)`` shaped arrays if indexing='xy' +// with the elements of `xi` repeated to fill the matrix along +// the first dimension for `x1`, the second for `x2` and so on. +// +// Notes +// ----- +// This function supports both indexing conventions through the indexing +// keyword argument. Giving the string 'ij' returns a meshgrid with +// matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing. +// In the 2-D case with inputs of length M and N, the outputs are of shape +// (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case +// with inputs of length M, N and P, outputs are of shape (N, M, P) for +// 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is +// illustrated by the following code snippet:: +// +// xv, yv = np.meshgrid(x, y, indexing='ij') +// for i in range(nx): +// for j in range(ny): +// # treat xv[i,j], yv[i,j] +// +// xv, yv = np.meshgrid(x, y, indexing='xy') +// for i in range(nx): +// for j in range(ny): +// # treat xv[j,i], yv[j,i] +// +// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. +// +// See Also +// -------- +// mgrid : Construct a multi-dimensional "meshgrid" using indexing notation. +// ogrid : Construct an open multi-dimensional "meshgrid" using indexing +// notation. +// how-to-index +// +// Examples +// -------- +// >>> nx, ny = (3, 2) +// >>> x = np.linspace(0, 1, nx) +// >>> y = np.linspace(0, 1, ny) +// >>> xv, yv = np.meshgrid(x, y) +// >>> xv +// array([[0. , 0.5, 1. ], +// [0. , 0.5, 1. ]]) +// >>> yv +// array([[0., 0., 0.], +// [1., 1., 1.]]) +// +// The result of `meshgrid` is a coordinate grid: +// +// >>> import matplotlib.pyplot as plt +// >>> plt.plot(xv, yv, marker='o', color='k', linestyle='none') +// >>> plt.show() +// +// You can create sparse output arrays to save memory and computation time. +// +// >>> xv, yv = np.meshgrid(x, y, sparse=True) +// >>> xv +// array([[0. , 0.5, 1. ]]) +// >>> yv +// array([[0.], +// [1.]]) +// +// `meshgrid` is very useful to evaluate functions on a grid. If the +// function depends on all coordinates, both dense and sparse outputs can be +// used. +// +// >>> x = np.linspace(-5, 5, 101) +// >>> y = np.linspace(-5, 5, 101) +// >>> # full coordinate arrays +// >>> xx, yy = np.meshgrid(x, y) +// >>> zz = np.sqrt(xx**2 + yy**2) +// >>> xx.shape, yy.shape, zz.shape +// ((101, 101), (101, 101), (101, 101)) +// >>> # sparse coordinate arrays +// >>> xs, ys = np.meshgrid(x, y, sparse=True) +// >>> zs = np.sqrt(xs**2 + ys**2) +// >>> xs.shape, ys.shape, zs.shape +// ((1, 101), (101, 1), (101, 101)) +// >>> np.array_equal(zz, zs) +// True +// +// >>> h = plt.contourf(x, y, zs) +// >>> plt.axis('scaled') +// >>> plt.colorbar() +// >>> plt.show() +// +// +//go:linkname Meshgrid py.meshgrid +func Meshgrid(__llgo_va_list ...interface{}) *py.Object +// Broadcast an array to a new shape. +// +// Parameters +// ---------- +// array : array_like +// The array to broadcast. +// shape : tuple or int +// The shape of the desired array. A single integer ``i`` is interpreted +// as ``(i,)``. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// +// Returns +// ------- +// broadcast : array +// A readonly view on the original array with the given shape. It is +// typically not contiguous. Furthermore, more than one element of a +// broadcasted array may refer to a single memory location. +// +// Raises +// ------ +// ValueError +// If the array is not compatible with the new shape according to NumPy's +// broadcasting rules. +// +// See Also +// -------- +// broadcast +// broadcast_arrays +// broadcast_shapes +// +// Notes +// ----- +// .. versionadded:: 1.10.0 +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3]) +// >>> np.broadcast_to(x, (3, 3)) +// array([[1, 2, 3], +// [1, 2, 3], +// [1, 2, 3]]) +// +// +//go:linkname BroadcastTo py.broadcast_to +func BroadcastTo(array *py.Object, shape *py.Object, subok *py.Object) *py.Object +// +// Compute the bi-dimensional histogram of two data samples. +// +// Parameters +// ---------- +// x : array_like, shape (N,) +// An array containing the x coordinates of the points to be +// histogrammed. +// y : array_like, shape (N,) +// An array containing the y coordinates of the points to be +// histogrammed. +// bins : int or array_like or [int, int] or [array, array], optional +// The bin specification: +// +// * If int, the number of bins for the two dimensions (nx=ny=bins). +// * If array_like, the bin edges for the two dimensions +// (x_edges=y_edges=bins). +// * If [int, int], the number of bins in each dimension +// (nx, ny = bins). +// * If [array, array], the bin edges in each dimension +// (x_edges, y_edges = bins). +// * A combination [int, array] or [array, int], where int +// is the number of bins and array is the bin edges. +// +// range : array_like, shape(2,2), optional +// The leftmost and rightmost edges of the bins along each dimension +// (if not specified explicitly in the `bins` parameters): +// ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range +// will be considered outliers and not tallied in the histogram. +// density : bool, optional +// If False, the default, returns the number of samples in each bin. +// If True, returns the probability *density* function at the bin, +// ``bin_count / sample_count / bin_area``. +// weights : array_like, shape(N,), optional +// An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. +// Weights are normalized to 1 if `density` is True. If `density` is +// False, the values of the returned histogram are equal to the sum of +// the weights belonging to the samples falling into each bin. +// +// Returns +// ------- +// H : ndarray, shape(nx, ny) +// The bi-dimensional histogram of samples `x` and `y`. Values in `x` +// are histogrammed along the first dimension and values in `y` are +// histogrammed along the second dimension. +// xedges : ndarray, shape(nx+1,) +// The bin edges along the first dimension. +// yedges : ndarray, shape(ny+1,) +// The bin edges along the second dimension. +// +// See Also +// -------- +// histogram : 1D histogram +// histogramdd : Multidimensional histogram +// +// Notes +// ----- +// When `density` is True, then the returned histogram is the sample +// density, defined such that the sum over bins of the product +// ``bin_value * bin_area`` is 1. +// +// Please note that the histogram does not follow the Cartesian convention +// where `x` values are on the abscissa and `y` values on the ordinate +// axis. Rather, `x` is histogrammed along the first dimension of the +// array (vertical), and `y` along the second dimension of the array +// (horizontal). This ensures compatibility with `histogramdd`. +// +// Examples +// -------- +// >>> from matplotlib.image import NonUniformImage +// >>> import matplotlib.pyplot as plt +// +// Construct a 2-D histogram with variable bin width. First define the bin +// edges: +// +// >>> xedges = [0, 1, 3, 5] +// >>> yedges = [0, 2, 3, 4, 6] +// +// Next we create a histogram H with random bin content: +// +// >>> x = np.random.normal(2, 1, 100) +// >>> y = np.random.normal(1, 1, 100) +// >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) +// >>> # Histogram does not follow Cartesian convention (see Notes), +// >>> # therefore transpose H for visualization purposes. +// >>> H = H.T +// +// :func:`imshow ` can only display square bins: +// +// >>> fig = plt.figure(figsize=(7, 3)) +// >>> ax = fig.add_subplot(131, title='imshow: square bins') +// >>> plt.imshow(H, interpolation='nearest', origin='lower', +// ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) +// +// +// :func:`pcolormesh ` can display actual edges: +// +// >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', +// ... aspect='equal') +// >>> X, Y = np.meshgrid(xedges, yedges) +// >>> ax.pcolormesh(X, Y, H) +// +// +// :class:`NonUniformImage ` can be used to +// display actual bin edges with interpolation: +// +// >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', +// ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) +// >>> im = NonUniformImage(ax, interpolation='bilinear') +// >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 +// >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 +// >>> im.set_data(xcenters, ycenters, H) +// >>> ax.add_image(im) +// >>> plt.show() +// +// It is also possible to construct a 2-D histogram without specifying bin +// edges: +// +// >>> # Generate non-symmetric test data +// >>> n = 10000 +// >>> x = np.linspace(1, 100, n) +// >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 +// >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges +// >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) +// +// Now we can plot the histogram using +// :func:`pcolormesh `, and a +// :func:`hexbin ` for comparison. +// +// >>> # Plot histogram using pcolormesh +// >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) +// >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') +// >>> ax1.plot(x, 2*np.log(x), 'k-') +// >>> ax1.set_xlim(x.min(), x.max()) +// >>> ax1.set_ylim(y.min(), y.max()) +// >>> ax1.set_xlabel('x') +// >>> ax1.set_ylabel('y') +// >>> ax1.set_title('histogram2d') +// >>> ax1.grid() +// +// >>> # Create hexbin plot for comparison +// >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') +// >>> ax2.plot(x, 2*np.log(x), 'k-') +// >>> ax2.set_title('hexbin') +// >>> ax2.set_xlim(x.min(), x.max()) +// >>> ax2.set_xlabel('x') +// >>> ax2.grid() +// +// >>> plt.show() +// +// +//go:linkname Histogram2d py.histogram2d +func Histogram2d(x *py.Object, y *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Return an antiderivative (indefinite integral) of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The returned order `m` antiderivative `P` of polynomial `p` satisfies +// :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` +// integration constants `k`. The constants determine the low-order +// polynomial part +// +// .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} +// +// of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. +// +// Parameters +// ---------- +// p : array_like or poly1d +// Polynomial to integrate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of the antiderivative. (Default: 1) +// k : list of `m` scalars or scalar, optional +// Integration constants. They are given in the order of integration: +// those corresponding to highest-order terms come first. +// +// If ``None`` (default), all constants are assumed to be zero. +// If `m = 1`, a single scalar can be given instead of a list. +// +// See Also +// -------- +// polyder : derivative of a polynomial +// poly1d.integ : equivalent method +// +// Examples +// -------- +// The defining property of the antiderivative: +// +// >>> p = np.poly1d([1,1,1]) +// >>> P = np.polyint(p) +// >>> P +// poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary +// >>> np.polyder(P) == p +// True +// +// The integration constants default to zero, but can be specified: +// +// >>> P = np.polyint(p, 3) +// >>> P(0) +// 0.0 +// >>> np.polyder(P)(0) +// 0.0 +// >>> np.polyder(P, 2)(0) +// 0.0 +// >>> P = np.polyint(p, 3, k=[6,5,3]) +// >>> P +// poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary +// +// Note that 3 = 6 / 2!, and that the constants are given in the order of +// integrations. Constant of the highest-order polynomial term comes first: +// +// >>> np.polyder(P, 2)(0) +// 6.0 +// >>> np.polyder(P, 1)(0) +// 5.0 +// >>> P(0) +// 3.0 +// +// +// +//go:linkname Polyint py.polyint +func Polyint(p *py.Object, m *py.Object, k *py.Object) *py.Object +// +// Deprecates a function and includes the deprecation in its docstring. +// +// This function is used as a decorator. It returns an object that can be +// used to issue a DeprecationWarning, by passing the to-be decorated +// function as argument, this adds warning to the to-be decorated function's +// docstring and returns the new function object. +// +// See Also +// -------- +// deprecate : Decorate a function such that it issues a `DeprecationWarning` +// +// Parameters +// ---------- +// msg : str +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// obj : object +// +// +// +//go:linkname DeprecateWithDoc py.deprecate_with_doc +func DeprecateWithDoc(msg *py.Object) *py.Object +// +// Return the sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. +// +// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or +// empty. In later versions zero is returned. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose sum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the sum is computed. The default is to compute the +// sum of the flattened array. +// dtype : data-type, optional +// The type of the returned array and of the accumulator in which the +// elements are summed. By default, the dtype of `a` is used. An +// exception is when `a` has an integer type with less precision than +// the platform (u)intp. In that case, the default will be either +// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 +// bits. For inexact inputs, dtype must be inexact. +// +// .. versionadded:: 1.8.0 +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``. If provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. The casting of NaN to integer +// can yield unexpected results. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `mean` or `sum` methods +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// Starting value for the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to include in the sum. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nansum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.sum : Sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// isfinite : Show which elements are not NaN or +/-inf. +// +// Notes +// ----- +// If both positive and negative infinity are present, the sum will be Not +// A Number (NaN). +// +// Examples +// -------- +// >>> np.nansum(1) +// 1 +// >>> np.nansum([1]) +// 1 +// >>> np.nansum([1, np.nan]) +// 1.0 +// >>> a = np.array([[1, 1], [1, np.nan]]) +// >>> np.nansum(a) +// 3.0 +// >>> np.nansum(a, axis=0) +// array([2., 1.]) +// >>> np.nansum([1, np.nan, np.inf]) +// inf +// >>> np.nansum([1, np.nan, np.NINF]) +// -inf +// >>> from numpy.testing import suppress_warnings +// >>> with suppress_warnings() as sup: +// ... sup.filter(RuntimeWarning) +// ... np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present +// nan +// +// +// +//go:linkname Nansum py.nansum +func Nansum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// zeros(shape, dtype=float, order='C', *, like=None) +// +// Return a new array of given shape and type, filled with zeros. +// +// Parameters +// ---------- +// shape : int or tuple of ints +// Shape of the new array, e.g., ``(2, 3)`` or ``2``. +// dtype : data-type, optional +// The desired data-type for the array, e.g., `numpy.int8`. Default is +// `numpy.float64`. +// order : {'C', 'F'}, optional, default: 'C' +// Whether to store multi-dimensional data in row-major +// (C-style) or column-major (Fortran-style) order in +// memory. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array of zeros with the given shape, dtype, and order. +// +// See Also +// -------- +// zeros_like : Return an array of zeros with shape and type of input. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> np.zeros(5) +// array([ 0., 0., 0., 0., 0.]) +// +// >>> np.zeros((5,), dtype=int) +// array([0, 0, 0, 0, 0]) +// +// >>> np.zeros((2, 1)) +// array([[ 0.], +// [ 0.]]) +// +// >>> s = (2,2) +// >>> np.zeros(s) +// array([[ 0., 0.], +// [ 0., 0.]]) +// +// >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype +// array([(0, 0), (0, 0)], +// dtype=[('x', '>> a = np.arange(6).reshape((3, 2)) +// >>> a +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// +// You can think of reshaping as first raveling the array (using the given +// index order), then inserting the elements from the raveled array into the +// new array using the same kind of index ordering as was used for the +// raveling. +// +// >>> np.reshape(a, (2, 3)) # C-like index ordering +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.reshape(a, (2, 3), order='F') # Fortran-like index ordering +// array([[0, 4, 3], +// [2, 1, 5]]) +// >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') +// array([[0, 4, 3], +// [2, 1, 5]]) +// +// Examples +// -------- +// >>> a = np.array([[1,2,3], [4,5,6]]) +// >>> np.reshape(a, 6) +// array([1, 2, 3, 4, 5, 6]) +// >>> np.reshape(a, 6, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 +// array([[1, 2], +// [3, 4], +// [5, 6]]) +// +// +//go:linkname Reshape py.reshape +func Reshape(a *py.Object, newshape *py.Object, order *py.Object) *py.Object +// logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs in base-2. +// +// Calculates ``log2(2**x1 + 2**x2)``. This function is useful in machine +// learning when the calculated probabilities of events may be so small as +// to exceed the range of normal floating point numbers. In such cases +// the base-2 logarithm of the calculated probability can be used instead. +// This function allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Base-2 logarithm of ``2**x1 + 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp: Logarithm of the sum of exponentiations of the inputs. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log2(1e-50) +// >>> prob2 = np.log2(2.5e-50) +// >>> prob12 = np.logaddexp2(prob1, prob2) +// >>> prob1, prob2, prob12 +// (-166.09640474436813, -164.77447664948076, -164.28904982231052) +// >>> 2**prob12 +// 3.4999999999999914e-50 +// +//go:linkname Logaddexp2 py.logaddexp2 +func Logaddexp2(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the gradient of an N-dimensional array. +// +// The gradient is computed using second order accurate central differences +// in the interior points and either first or second order accurate one-sides +// (forward or backwards) differences at the boundaries. +// The returned gradient hence has the same shape as the input array. +// +// Parameters +// ---------- +// f : array_like +// An N-dimensional array containing samples of a scalar function. +// varargs : list of scalar or array, optional +// Spacing between f values. Default unitary spacing for all dimensions. +// Spacing can be specified using: +// +// 1. single scalar to specify a sample distance for all dimensions. +// 2. N scalars to specify a constant sample distance for each dimension. +// i.e. `dx`, `dy`, `dz`, ... +// 3. N arrays to specify the coordinates of the values along each +// dimension of F. The length of the array must match the size of +// the corresponding dimension +// 4. Any combination of N scalars/arrays with the meaning of 2. and 3. +// +// If `axis` is given, the number of varargs must equal the number of axes. +// Default: 1. +// +// edge_order : {1, 2}, optional +// Gradient is calculated using N-th order accurate differences +// at the boundaries. Default: 1. +// +// .. versionadded:: 1.9.1 +// +// axis : None or int or tuple of ints, optional +// Gradient is calculated only along the given axis or axes +// The default (axis = None) is to calculate the gradient for all the axes +// of the input array. axis may be negative, in which case it counts from +// the last to the first axis. +// +// .. versionadded:: 1.11.0 +// +// Returns +// ------- +// gradient : ndarray or list of ndarray +// A list of ndarrays (or a single ndarray if there is only one dimension) +// corresponding to the derivatives of f with respect to each dimension. +// Each derivative has the same shape as f. +// +// Examples +// -------- +// >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float) +// >>> np.gradient(f) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// >>> np.gradient(f, 2) +// array([0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) +// +// Spacing can be also specified with an array that represents the coordinates +// of the values F along the dimensions. +// For instance a uniform spacing: +// +// >>> x = np.arange(f.size) +// >>> np.gradient(f, x) +// array([1. , 1.5, 2.5, 3.5, 4.5, 5. ]) +// +// Or a non uniform one: +// +// >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) +// >>> np.gradient(f, x) +// array([1. , 3. , 3.5, 6.7, 6.9, 2.5]) +// +// For two dimensional arrays, the return will be two arrays ordered by +// axis. In this example the first array stands for the gradient in +// rows and the second one in columns direction: +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) +// [array([[ 2., 2., -1.], +// [ 2., 2., -1.]]), array([[1. , 2.5, 4. ], +// [1. , 1. , 1. ]])] +// +// In this example the spacing is also specified: +// uniform for axis=0 and non uniform for axis=1 +// +// >>> dx = 2. +// >>> y = [1., 1.5, 3.5] +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) +// [array([[ 1. , 1. , -0.5], +// [ 1. , 1. , -0.5]]), array([[2. , 2. , 2. ], +// [2. , 1.7, 0.5]])] +// +// It is possible to specify how boundaries are treated using `edge_order` +// +// >>> x = np.array([0, 1, 2, 3, 4]) +// >>> f = x**2 +// >>> np.gradient(f, edge_order=1) +// array([1., 2., 4., 6., 7.]) +// >>> np.gradient(f, edge_order=2) +// array([0., 2., 4., 6., 8.]) +// +// The `axis` keyword can be used to specify a subset of axes of which the +// gradient is calculated +// +// >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) +// array([[ 2., 2., -1.], +// [ 2., 2., -1.]]) +// +// Notes +// ----- +// Assuming that :math:`f\in C^{3}` (i.e., :math:`f` has at least 3 continuous +// derivatives) and let :math:`h_{*}` be a non-homogeneous stepsize, we +// minimize the "consistency error" :math:`\eta_{i}` between the true gradient +// and its estimate from a linear combination of the neighboring grid-points: +// +// .. math:: +// +// \eta_{i} = f_{i}^{\left(1\right)} - +// \left[ \alpha f\left(x_{i}\right) + +// \beta f\left(x_{i} + h_{d}\right) + +// \gamma f\left(x_{i}-h_{s}\right) +// \right] +// +// By substituting :math:`f(x_{i} + h_{d})` and :math:`f(x_{i} - h_{s})` +// with their Taylor series expansion, this translates into solving +// the following the linear system: +// +// .. math:: +// +// \left\{ +// \begin{array}{r} +// \alpha+\beta+\gamma=0 \\ +// \beta h_{d}-\gamma h_{s}=1 \\ +// \beta h_{d}^{2}+\gamma h_{s}^{2}=0 +// \end{array} +// \right. +// +// The resulting approximation of :math:`f_{i}^{(1)}` is the following: +// +// .. math:: +// +// \hat f_{i}^{(1)} = +// \frac{ +// h_{s}^{2}f\left(x_{i} + h_{d}\right) +// + \left(h_{d}^{2} - h_{s}^{2}\right)f\left(x_{i}\right) +// - h_{d}^{2}f\left(x_{i}-h_{s}\right)} +// { h_{s}h_{d}\left(h_{d} + h_{s}\right)} +// + \mathcal{O}\left(\frac{h_{d}h_{s}^{2} +// + h_{s}h_{d}^{2}}{h_{d} +// + h_{s}}\right) +// +// It is worth noting that if :math:`h_{s}=h_{d}` +// (i.e., data are evenly spaced) +// we find the standard second order approximation: +// +// .. math:: +// +// \hat f_{i}^{(1)}= +// \frac{f\left(x_{i+1}\right) - f\left(x_{i-1}\right)}{2h} +// + \mathcal{O}\left(h^{2}\right) +// +// With a similar procedure the forward/backward approximations used for +// boundaries can be derived. +// +// References +// ---------- +// .. [1] Quarteroni A., Sacco R., Saleri F. (2007) Numerical Mathematics +// (Texts in Applied Mathematics). New York: Springer. +// .. [2] Durran D. R. (1999) Numerical Methods for Wave Equations +// in Geophysical Fluid Dynamics. New York: Springer. +// .. [3] Fornberg B. (1988) Generation of Finite Difference Formulas on +// Arbitrarily Spaced Grids, +// Mathematics of Computation 51, no. 184 : 699-706. +// `PDF `_. +// +// +//go:linkname Gradient py.gradient +func Gradient(f *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Kronecker product of two arrays. +// +// Computes the Kronecker product, a composite array made of blocks of the +// second array scaled by the first. +// +// Parameters +// ---------- +// a, b : array_like +// +// Returns +// ------- +// out : ndarray +// +// See Also +// -------- +// outer : The outer product +// +// Notes +// ----- +// The function assumes that the number of dimensions of `a` and `b` +// are the same, if necessary prepending the smallest with ones. +// If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, +// the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. +// The elements are products of elements from `a` and `b`, organized +// explicitly by:: +// +// kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN] +// +// where:: +// +// kt = it * st + jt, t = 0,...,N +// +// In the common 2-D case (N=1), the block structure can be visualized:: +// +// [[ a[0,0]*b, a[0,1]*b, ... , a[0,-1]*b ], +// [ ... ... ], +// [ a[-1,0]*b, a[-1,1]*b, ... , a[-1,-1]*b ]] +// +// +// Examples +// -------- +// >>> np.kron([1,10,100], [5,6,7]) +// array([ 5, 6, 7, ..., 500, 600, 700]) +// >>> np.kron([5,6,7], [1,10,100]) +// array([ 5, 50, 500, ..., 7, 70, 700]) +// +// >>> np.kron(np.eye(2), np.ones((2,2))) +// array([[1., 1., 0., 0.], +// [1., 1., 0., 0.], +// [0., 0., 1., 1.], +// [0., 0., 1., 1.]]) +// +// >>> a = np.arange(100).reshape((2,5,2,5)) +// >>> b = np.arange(24).reshape((2,3,4)) +// >>> c = np.kron(a,b) +// >>> c.shape +// (2, 10, 6, 20) +// >>> I = (1,3,0,2) +// >>> J = (0,2,1) +// >>> J1 = (0,) + J # extend to ndim=4 +// >>> S1 = (1,) + b.shape +// >>> K = tuple(np.array(I) * np.array(S1) + np.array(J1)) +// >>> c[K] == a[I]*b[J] +// True +// +// +// +//go:linkname Kron py.kron +func Kron(a *py.Object, b *py.Object) *py.Object +// +// inner(a, b, /) +// +// Inner product of two arrays. +// +// Ordinary inner product of vectors for 1-D arrays (without complex +// conjugation), in higher dimensions a sum product over the last axes. +// +// Parameters +// ---------- +// a, b : array_like +// If `a` and `b` are nonscalar, their last dimensions must match. +// +// Returns +// ------- +// out : ndarray +// If `a` and `b` are both +// scalars or both 1-D arrays then a scalar is returned; otherwise +// an array is returned. +// ``out.shape = (*a.shape[:-1], *b.shape[:-1])`` +// +// Raises +// ------ +// ValueError +// If both `a` and `b` are nonscalar and their last dimensions have +// different sizes. +// +// See Also +// -------- +// tensordot : Sum products over arbitrary axes. +// dot : Generalised matrix product, using second last dimension of `b`. +// einsum : Einstein summation convention. +// +// Notes +// ----- +// For vectors (1-D arrays) it computes the ordinary inner-product:: +// +// np.inner(a, b) = sum(a[:]*b[:]) +// +// More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``:: +// +// np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1)) +// +// or explicitly:: +// +// np.inner(a, b)[i0,...,ir-2,j0,...,js-2] +// = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:]) +// +// In addition `a` or `b` may be scalars, in which case:: +// +// np.inner(a,b) = a*b +// +// Examples +// -------- +// Ordinary inner product for vectors: +// +// >>> a = np.array([1,2,3]) +// >>> b = np.array([0,1,0]) +// >>> np.inner(a, b) +// 2 +// +// Some multidimensional examples: +// +// >>> a = np.arange(24).reshape((2,3,4)) +// >>> b = np.arange(4) +// >>> c = np.inner(a, b) +// >>> c.shape +// (2, 3) +// >>> c +// array([[ 14, 38, 62], +// [ 86, 110, 134]]) +// +// >>> a = np.arange(2).reshape((1,1,2)) +// >>> b = np.arange(6).reshape((3,2)) +// >>> c = np.inner(a, b) +// >>> c.shape +// (1, 1, 3) +// >>> c +// array([[[1, 3, 5]]]) +// +// An example where `b` is a scalar: +// +// >>> np.inner(np.eye(2), 7) +// array([[7., 0.], +// [0., 7.]]) +// +// +// +//go:linkname Inner py.inner +func Inner(a *py.Object, b *py.Object) *py.Object +//go:linkname Arccos py.arccos +func Arccos(__llgo_va_list ...interface{}) *py.Object +// float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// First array elements raised to powers from second array, element-wise. +// +// Raise each base in `x1` to the positionally-corresponding power in `x2`. +// `x1` and `x2` must be broadcastable to the same shape. This differs from +// the power function in that integers, float16, and float32 are promoted to +// floats with a minimum precision of float64 so that the result is always +// inexact. The intent is that the function will return a usable result for +// negative powers and seldom overflow for positive powers. +// +// Negative values raised to a non-integral value will return ``nan``. +// To get complex results, cast the input to complex, or specify the +// ``dtype`` to be ``complex`` (see the example below). +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// x1 : array_like +// The bases. +// x2 : array_like +// The exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The bases in `x1` raised to the exponents in `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// power : power function that preserves type +// +// Examples +// -------- +// Cube each element in a list. +// +// >>> x1 = range(6) +// >>> x1 +// [0, 1, 2, 3, 4, 5] +// >>> np.float_power(x1, 3) +// array([ 0., 1., 8., 27., 64., 125.]) +// +// Raise the bases to different exponents. +// +// >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] +// >>> np.float_power(x1, x2) +// array([ 0., 1., 8., 27., 16., 5.]) +// +// The effect of broadcasting. +// +// >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) +// >>> x2 +// array([[1, 2, 3, 3, 2, 1], +// [1, 2, 3, 3, 2, 1]]) +// >>> np.float_power(x1, x2) +// array([[ 0., 1., 8., 27., 16., 5.], +// [ 0., 1., 8., 27., 16., 5.]]) +// +// Negative values raised to a non-integral value will result in ``nan`` +// (and a warning will be generated). +// +// >>> x3 = np.array([-1, -4]) +// >>> with np.errstate(invalid='ignore'): +// ... p = np.float_power(x3, 1.5) +// ... +// >>> p +// array([nan, nan]) +// +// To get complex results, give the argument ``dtype=complex``. +// +// >>> np.float_power(x3, 1.5, dtype=complex) +// array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) +// +//go:linkname FloatPower py.float_power +func FloatPower(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute hyperbolic tangent element-wise. +// +// Equivalent to ``np.sinh(x)/np.cosh(x)`` or ``-1j * np.tan(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// .. [1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// https://personal.math.ubc.ca/~cbm/aands/page_83.htm +// +// .. [2] Wikipedia, "Hyperbolic function", +// https://en.wikipedia.org/wiki/Hyperbolic_function +// +// Examples +// -------- +// >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) +// array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) +// +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.tanh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tanh py.tanh +func Tanh(x *py.Object, out *py.Object) *py.Object +// +// Return an array drawn from elements in choicelist, depending on conditions. +// +// Parameters +// ---------- +// condlist : list of bool ndarrays +// The list of conditions which determine from which array in `choicelist` +// the output elements are taken. When multiple conditions are satisfied, +// the first one encountered in `condlist` is used. +// choicelist : list of ndarrays +// The list of arrays from which the output elements are taken. It has +// to be of the same length as `condlist`. +// default : scalar, optional +// The element inserted in `output` when all conditions evaluate to False. +// +// Returns +// ------- +// output : ndarray +// The output at position m is the m-th element of the array in +// `choicelist` where the m-th element of the corresponding array in +// `condlist` is True. +// +// See Also +// -------- +// where : Return elements from one of two arrays depending on condition. +// take, choose, compress, diag, diagonal +// +// Examples +// -------- +// >>> x = np.arange(6) +// >>> condlist = [x<3, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 42) +// array([ 0, 1, 2, 42, 16, 25]) +// +// >>> condlist = [x<=4, x>3] +// >>> choicelist = [x, x**2] +// >>> np.select(condlist, choicelist, 55) +// array([ 0, 1, 2, 3, 4, 25]) +// +// +// +//go:linkname Select py.select +func Select(condlist *py.Object, choicelist *py.Object, Default *py.Object) *py.Object +// +// Least squares polynomial fit. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` +// to points `(x, y)`. Returns a vector of coefficients `p` that minimises +// the squared error in the order `deg`, `deg-1`, ... `0`. +// +// The `Polynomial.fit ` class +// method is recommended for new code as it is more stable numerically. See +// the documentation of the method for more information. +// +// Parameters +// ---------- +// x : array_like, shape (M,) +// x-coordinates of the M sample points ``(x[i], y[i])``. +// y : array_like, shape (M,) or (M, K) +// y-coordinates of the sample points. Several data sets of sample +// points sharing the same x-coordinates can be fitted at once by +// passing in a 2D-array that contains one dataset per column. +// deg : int +// Degree of the fitting polynomial +// rcond : float, optional +// Relative condition number of the fit. Singular values smaller than +// this relative to the largest singular value will be ignored. The +// default value is len(x)*eps, where eps is the relative precision of +// the float type, about 2e-16 in most cases. +// full : bool, optional +// Switch determining nature of return value. When it is False (the +// default) just the coefficients are returned, when True diagnostic +// information from the singular value decomposition is also returned. +// w : array_like, shape (M,), optional +// Weights. If not None, the weight ``w[i]`` applies to the unsquared +// residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are +// chosen so that the errors of the products ``w[i]*y[i]`` all have the +// same variance. When using inverse-variance weighting, use +// ``w[i] = 1/sigma(y[i])``. The default value is None. +// cov : bool or str, optional +// If given and not `False`, return not just the estimate but also its +// covariance matrix. By default, the covariance are scaled by +// chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed +// to be unreliable except in a relative sense and everything is scaled +// such that the reduced chi2 is unity. This scaling is omitted if +// ``cov='unscaled'``, as is relevant for the case that the weights are +// w = 1/sigma, with sigma known to be a reliable estimate of the +// uncertainty. +// +// Returns +// ------- +// p : ndarray, shape (deg + 1,) or (deg + 1, K) +// Polynomial coefficients, highest power first. If `y` was 2-D, the +// coefficients for `k`-th data set are in ``p[:,k]``. +// +// residuals, rank, singular_values, rcond +// These values are only returned if ``full == True`` +// +// - residuals -- sum of squared residuals of the least squares fit +// - rank -- the effective rank of the scaled Vandermonde +// coefficient matrix +// - singular_values -- singular values of the scaled Vandermonde +// coefficient matrix +// - rcond -- value of `rcond`. +// +// For more details, see `numpy.linalg.lstsq`. +// +// V : ndarray, shape (M,M) or (M,M,K) +// Present only if ``full == False`` and ``cov == True``. The covariance +// matrix of the polynomial coefficient estimates. The diagonal of +// this matrix are the variance estimates for each coefficient. If y +// is a 2-D array, then the covariance matrix for the `k`-th data set +// are in ``V[:,:,k]`` +// +// +// Warns +// ----- +// RankWarning +// The rank of the coefficient matrix in the least-squares fit is +// deficient. The warning is only raised if ``full == False``. +// +// The warnings can be turned off by +// +// >>> import warnings +// >>> warnings.simplefilter('ignore', np.RankWarning) +// +// See Also +// -------- +// polyval : Compute polynomial values. +// linalg.lstsq : Computes a least-squares fit. +// scipy.interpolate.UnivariateSpline : Computes spline fits. +// +// Notes +// ----- +// The solution minimizes the squared error +// +// .. math:: +// E = \sum_{j=0}^k |p(x_j) - y_j|^2 +// +// in the equations:: +// +// x[0]**n * p[0] + ... + x[0] * p[n-1] + p[n] = y[0] +// x[1]**n * p[0] + ... + x[1] * p[n-1] + p[n] = y[1] +// ... +// x[k]**n * p[0] + ... + x[k] * p[n-1] + p[n] = y[k] +// +// The coefficient matrix of the coefficients `p` is a Vandermonde matrix. +// +// `polyfit` issues a `RankWarning` when the least-squares fit is badly +// conditioned. This implies that the best fit is not well-defined due +// to numerical error. The results may be improved by lowering the polynomial +// degree or by replacing `x` by `x` - `x`.mean(). The `rcond` parameter +// can also be set to a value smaller than its default, but the resulting +// fit may be spurious: including contributions from the small singular +// values can add numerical noise to the result. +// +// Note that fitting polynomial coefficients is inherently badly conditioned +// when the degree of the polynomial is large or the interval of sample points +// is badly centered. The quality of the fit should always be checked in these +// cases. When polynomial fits are not satisfactory, splines may be a good +// alternative. +// +// References +// ---------- +// .. [1] Wikipedia, "Curve fitting", +// https://en.wikipedia.org/wiki/Curve_fitting +// .. [2] Wikipedia, "Polynomial interpolation", +// https://en.wikipedia.org/wiki/Polynomial_interpolation +// +// Examples +// -------- +// >>> import warnings +// >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) +// >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) +// >>> z = np.polyfit(x, y, 3) +// >>> z +// array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # may vary +// +// It is convenient to use `poly1d` objects for dealing with polynomials: +// +// >>> p = np.poly1d(z) +// >>> p(0.5) +// 0.6143849206349179 # may vary +// >>> p(3.5) +// -0.34732142857143039 # may vary +// >>> p(10) +// 22.579365079365115 # may vary +// +// High-order polynomials may oscillate wildly: +// +// >>> with warnings.catch_warnings(): +// ... warnings.simplefilter('ignore', np.RankWarning) +// ... p30 = np.poly1d(np.polyfit(x, y, 30)) +// ... +// >>> p30(4) +// -0.80000000000000204 # may vary +// >>> p30(5) +// -0.99999999999999445 # may vary +// >>> p30(4.5) +// -0.10547061179440398 # may vary +// +// Illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> xp = np.linspace(-2, 6, 100) +// >>> _ = plt.plot(x, y, '.', xp, p(xp), '-', xp, p30(xp), '--') +// >>> plt.ylim(-2,2) +// (-2, 2) +// >>> plt.show() +// +// +// +//go:linkname Polyfit py.polyfit +func Polyfit(x *py.Object, y *py.Object, deg *py.Object, rcond *py.Object, full *py.Object, w *py.Object, cov *py.Object) *py.Object +// +// Return minimum of an array or minimum along an axis, ignoring any NaNs. +// When all-NaN slices are encountered a ``RuntimeWarning`` is raised and +// Nan is returned for that slice. +// +// Parameters +// ---------- +// a : array_like +// Array containing numbers whose minimum is desired. If `a` is not an +// array, a conversion is attempted. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the minimum is computed. The default is to compute +// the minimum of the flattened array. +// out : ndarray, optional +// Alternate output array in which to place the result. The default +// is ``None``; if provided, it must have the same shape as the +// expected output, but the type will be cast if necessary. See +// :ref:`ufuncs-output-type` for more details. +// +// .. versionadded:: 1.8.0 +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If the value is anything but the default, then +// `keepdims` will be passed through to the `min` method +// of sub-classes of `ndarray`. If the sub-classes methods +// does not implement `keepdims` any exceptions will be raised. +// +// .. versionadded:: 1.8.0 +// initial : scalar, optional +// The maximum value of an output element. Must be present to allow +// computation on empty slice. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.22.0 +// where : array_like of bool, optional +// Elements to compare for the minimum. See `~numpy.ufunc.reduce` +// for details. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// nanmin : ndarray +// An array with the same shape as `a`, with the specified axis +// removed. If `a` is a 0-d array, or if axis is None, an ndarray +// scalar is returned. The same dtype as `a` is returned. +// +// See Also +// -------- +// nanmax : +// The maximum value of an array along a given axis, ignoring any NaNs. +// amin : +// The minimum value of an array along a given axis, propagating any NaNs. +// fmin : +// Element-wise minimum of two arrays, ignoring any NaNs. +// minimum : +// Element-wise minimum of two arrays, propagating any NaNs. +// isnan : +// Shows which elements are Not a Number (NaN). +// isfinite: +// Shows which elements are neither NaN nor infinity. +// +// amax, fmax, maximum +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Positive infinity is treated as a very large number and negative +// infinity is treated as a very small (i.e. negative) number. +// +// If the input has a integer type the function is equivalent to np.min. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nanmin(a) +// 1.0 +// >>> np.nanmin(a, axis=0) +// array([1., 2.]) +// >>> np.nanmin(a, axis=1) +// array([1., 3.]) +// +// When positive infinity and negative infinity are present: +// +// >>> np.nanmin([1, 2, np.nan, np.inf]) +// 1.0 +// >>> np.nanmin([1, 2, np.nan, np.NINF]) +// -inf +// +// +// +//go:linkname Nanmin py.nanmin +func Nanmin(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Cosine element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding cosine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> np.cos(np.array([0, np.pi/2, np.pi])) +// array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00]) +// >>> +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Cos py.cos +func Cos(x *py.Object, out *py.Object) *py.Object +// gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the greatest common divisor of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The greatest common divisor of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// lcm : The lowest common multiple +// +// Examples +// -------- +// >>> np.gcd(12, 20) +// 4 +// >>> np.gcd.reduce([15, 25, 35]) +// 5 +// >>> np.gcd(np.arange(6), 20) +// array([20, 1, 2, 1, 4, 5]) +// +//go:linkname Gcd py.gcd +func Gcd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Set the floating-point error callback function or log object. +// +// There are two ways to capture floating-point error messages. The first +// is to set the error-handler to 'call', using `seterr`. Then, set +// the function to call using this function. +// +// The second is to set the error-handler to 'log', using `seterr`. +// Floating-point errors then trigger a call to the 'write' method of +// the provided object. +// +// Parameters +// ---------- +// func : callable f(err, flag) or object with write method +// Function to call upon floating-point errors ('call'-mode) or +// object whose 'write' method is used to log such message ('log'-mode). +// +// The call function takes two arguments. The first is a string describing +// the type of error (such as "divide by zero", "overflow", "underflow", +// or "invalid value"), and the second is the status flag. The flag is a +// byte, whose four least-significant bits indicate the type of error, one +// of "divide", "over", "under", "invalid":: +// +// [0 0 0 0 divide over under invalid] +// +// In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. +// +// If an object is provided, its write method should take one argument, +// a string. +// +// Returns +// ------- +// h : callable, log instance or None +// The old error handler. +// +// See Also +// -------- +// seterr, geterr, geterrcall +// +// Examples +// -------- +// Callback upon error: +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// +// >>> saved_handler = np.seterrcall(err_handler) +// >>> save_err = np.seterr(all='call') +// +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'} +// +// Log error message: +// +// >>> class Log: +// ... def write(self, msg): +// ... print("LOG: %s" % msg) +// ... +// +// >>> log = Log() +// >>> saved_handler = np.seterrcall(log) +// >>> save_err = np.seterr(all='log') +// +// >>> np.array([1, 2, 3]) / 0.0 +// LOG: Warning: divide by zero encountered in divide +// array([inf, inf, inf]) +// +// >>> np.seterrcall(saved_handler) +// +// >>> np.seterr(**save_err) +// {'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'} +// +// +// +//go:linkname Seterrcall py.seterrcall +func Seterrcall(Func *py.Object) *py.Object +// +// Check whether or not an object can be iterated over. +// +// Parameters +// ---------- +// y : object +// Input object. +// +// Returns +// ------- +// b : bool +// Return ``True`` if the object has an iterator method or is a +// sequence and ``False`` otherwise. +// +// +// Examples +// -------- +// >>> np.iterable([1, 2, 3]) +// True +// >>> np.iterable(2) +// False +// +// Notes +// ----- +// In most cases, the results of ``np.iterable(obj)`` are consistent with +// ``isinstance(obj, collections.abc.Iterable)``. One notable exception is +// the treatment of 0-dimensional arrays:: +// +// >>> from collections.abc import Iterable +// >>> a = np.array(1.0) # 0-dimensional numpy array +// >>> isinstance(a, Iterable) +// True +// >>> np.iterable(a) +// False +// +// +// +//go:linkname Iterable py.iterable +func Iterable(y *py.Object) *py.Object +// +// Reverse the order of elements along axis 0 (up/down). +// +// For a 2-D array, this flips the entries in each column in the up/down +// direction. Rows are preserved, but appear in a different order than before. +// +// Parameters +// ---------- +// m : array_like +// Input array. +// +// Returns +// ------- +// out : array_like +// A view of `m` with the rows reversed. Since a view is +// returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// fliplr : Flip array in the left/right direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. +// Requires the array to be at least 1-D. +// +// Examples +// -------- +// >>> A = np.diag([1.0, 2, 3]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.flipud(A) +// array([[0., 0., 3.], +// [0., 2., 0.], +// [1., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.flipud(A) == A[::-1,...]) +// True +// +// >>> np.flipud([1,2]) +// array([2, 1]) +// +// +// +//go:linkname Flipud py.flipud +func Flipud(m *py.Object) *py.Object +// +// Construct an array by executing a function over each coordinate. +// +// The resulting array therefore has a value ``fn(x, y, z)`` at +// coordinate ``(x, y, z)``. +// +// Parameters +// ---------- +// function : callable +// The function is called with N parameters, where N is the rank of +// `shape`. Each parameter represents the coordinates of the array +// varying along a specific axis. For example, if `shape` +// were ``(2, 2)``, then the parameters would be +// ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])`` +// shape : (N,) tuple of ints +// Shape of the output array, which also determines the shape of +// the coordinate arrays passed to `function`. +// dtype : data-type, optional +// Data-type of the coordinate arrays passed to `function`. +// By default, `dtype` is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// fromfunction : any +// The result of the call to `function` is passed back directly. +// Therefore the shape of `fromfunction` is completely determined by +// `function`. If `function` returns a scalar value, the shape of +// `fromfunction` would not match the `shape` parameter. +// +// See Also +// -------- +// indices, meshgrid +// +// Notes +// ----- +// Keywords other than `dtype` and `like` are passed to `function`. +// +// Examples +// -------- +// >>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float) +// array([[0., 0.], +// [1., 1.]]) +// +// >>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float) +// array([[0., 1.], +// [0., 1.]]) +// +// >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) +// array([[ True, False, False], +// [False, True, False], +// [False, False, True]]) +// +// >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) +// array([[0, 1, 2], +// [1, 2, 3], +// [2, 3, 4]]) +// +// +// +//go:linkname Fromfunction py.fromfunction +func Fromfunction(function *py.Object, shape *py.Object) *py.Object +// +// Determine common type following standard coercion rules. +// +// .. deprecated:: NumPy 1.25 +// +// This function is deprecated, use `numpy.promote_types` or +// `numpy.result_type` instead. To achieve semantics for the +// `scalar_types` argument, use `numpy.result_type` and pass the Python +// values `0`, `0.0`, or `0j`. +// This will give the same results in almost all cases. +// More information and rare exception can be found in the +// `NumPy 1.25 release notes `_. +// +// Parameters +// ---------- +// array_types : sequence +// A list of dtypes or dtype convertible objects representing arrays. +// scalar_types : sequence +// A list of dtypes or dtype convertible objects representing scalars. +// +// Returns +// ------- +// datatype : dtype +// The common data type, which is the maximum of `array_types` ignoring +// `scalar_types`, unless the maximum of `scalar_types` is of a +// different kind (`dtype.kind`). If the kind is not understood, then +// None is returned. +// +// See Also +// -------- +// dtype, common_type, can_cast, mintypecode +// +// Examples +// -------- +// >>> np.find_common_type([], [np.int64, np.float32, complex]) +// dtype('complex128') +// >>> np.find_common_type([np.int64, np.float32], []) +// dtype('float64') +// +// The standard casting rules ensure that a scalar cannot up-cast an +// array unless the scalar is of a fundamentally different kind of data +// (i.e. under a different hierarchy in the data type hierarchy) then +// the array: +// +// >>> np.find_common_type([np.float32], [np.int64, np.float64]) +// dtype('float32') +// +// Complex is of a different type, so it up-casts the float in the +// `array_types` argument: +// +// >>> np.find_common_type([np.float32], [complex]) +// dtype('complex128') +// +// Type specifier strings are convertible to dtypes and can therefore +// be used instead of dtypes: +// +// >>> np.find_common_type(['f4', 'f4', 'i4'], ['c8']) +// dtype('complex128') +// +// +// +//go:linkname FindCommonType py.find_common_type +func FindCommonType(arrayTypes *py.Object, scalarTypes *py.Object) *py.Object +// +// Set the size of the buffer used in ufuncs. +// +// Parameters +// ---------- +// size : int +// Size of buffer. +// +// +// +//go:linkname Setbufsize py.setbufsize +func Setbufsize(size *py.Object) *py.Object +// +// Estimate a covariance matrix, given data and weights. +// +// Covariance indicates the level to which two variables vary together. +// If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, +// then the covariance matrix element :math:`C_{ij}` is the covariance of +// :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance +// of :math:`x_i`. +// +// See the notes for an outline of the algorithm. +// +// Parameters +// ---------- +// m : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `m` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same form +// as that of `m`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : bool, optional +// Default normalization (False) is by ``(N - 1)``, where ``N`` is the +// number of observations given (unbiased estimate). If `bias` is True, +// then normalization is by ``N``. These values can be overridden by using +// the keyword ``ddof`` in numpy versions >= 1.5. +// ddof : int, optional +// If not ``None`` the default value implied by `bias` is overridden. +// Note that ``ddof=1`` will return the unbiased estimate, even if both +// `fweights` and `aweights` are specified, and ``ddof=0`` will return +// the simple average. See the notes for the details. The default value +// is ``None``. +// +// .. versionadded:: 1.5 +// fweights : array_like, int, optional +// 1-D array of integer frequency weights; the number of times each +// observation vector should be repeated. +// +// .. versionadded:: 1.10 +// aweights : array_like, optional +// 1-D array of observation vector weights. These relative weights are +// typically large for observations considered "important" and smaller for +// observations considered less "important". If ``ddof=0`` the array of +// weights can be used to assign probabilities to observation vectors. +// +// .. versionadded:: 1.10 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// out : ndarray +// The covariance matrix of the variables. +// +// See Also +// -------- +// corrcoef : Normalized covariance matrix +// +// Notes +// ----- +// Assume that the observations are in the columns of the observation +// array `m` and let ``f = fweights`` and ``a = aweights`` for brevity. The +// steps to compute the weighted covariance are as follows:: +// +// >>> m = np.arange(10, dtype=np.float64) +// >>> f = np.arange(10) * 2 +// >>> a = np.arange(10) ** 2. +// >>> ddof = 1 +// >>> w = f * a +// >>> v1 = np.sum(w) +// >>> v2 = np.sum(w * a) +// >>> m -= np.sum(m * w, axis=None, keepdims=True) / v1 +// >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) +// +// Note that when ``a == 1``, the normalization factor +// ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` +// as it should. +// +// Examples +// -------- +// Consider two variables, :math:`x_0` and :math:`x_1`, which +// correlate perfectly, but in opposite directions: +// +// >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T +// >>> x +// array([[0, 1, 2], +// [2, 1, 0]]) +// +// Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance +// matrix shows this clearly: +// +// >>> np.cov(x) +// array([[ 1., -1.], +// [-1., 1.]]) +// +// Note that element :math:`C_{0,1}`, which shows the correlation between +// :math:`x_0` and :math:`x_1`, is negative. +// +// Further, note how `x` and `y` are combined: +// +// >>> x = [-2.1, -1, 4.3] +// >>> y = [3, 1.1, 0.12] +// >>> X = np.stack((x, y), axis=0) +// >>> np.cov(X) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x, y) +// array([[11.71 , -4.286 ], # may vary +// [-4.286 , 2.144133]]) +// >>> np.cov(x) +// array(11.71) +// +// +// +//go:linkname Cov py.cov +func Cov(m *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object, fweights *py.Object, aweights *py.Object) *py.Object +// +// Find the sum of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the polynomial resulting from the sum of two input polynomials. +// Each input must be either a poly1d object or a 1D sequence of polynomial +// coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The sum of the inputs. If either input is a poly1d object, then the +// output is also a poly1d object. Otherwise, it is a 1D array of +// polynomial coefficients from highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// +// Examples +// -------- +// >>> np.polyadd([1, 2], [9, 5, 4]) +// array([9, 6, 6]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2]) +// >>> p2 = np.poly1d([9, 5, 4]) +// >>> print(p1) +// 1 x + 2 +// >>> print(p2) +// 2 +// 9 x + 5 x + 4 +// >>> print(np.polyadd(p1, p2)) +// 2 +// 9 x + 6 x + 6 +// +// +// +//go:linkname Polyadd py.polyadd +func Polyadd(a1 *py.Object, a2 *py.Object) *py.Object +// maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// fmin, amin, nanmin +// +// Notes +// ----- +// The maximum is equivalent to ``np.where(x1 >= x2, x1, x2)`` when +// neither x1 nor x2 are nans, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.maximum([2, 3, 4], [1, 5, 2]) +// array([2, 5, 4]) +// +// >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.maximum(np.Inf, 1) +// inf +// +//go:linkname Maximum py.maximum +func Maximum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an array. +// +// This returns a tuple of indices that can be used to access the main +// diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape +// (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for +// ``a.ndim > 2`` this is the set of indices to access ``a[i, i, ..., i]`` +// for ``i = [0..n-1]``. +// +// Parameters +// ---------- +// n : int +// The size, along each dimension, of the arrays for which the returned +// indices can be used. +// +// ndim : int, optional +// The number of dimensions. +// +// See Also +// -------- +// diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Create a set of indices to access the diagonal of a (4, 4) array: +// +// >>> di = np.diag_indices(4) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// >>> a[di] = 100 +// >>> a +// array([[100, 1, 2, 3], +// [ 4, 100, 6, 7], +// [ 8, 9, 100, 11], +// [ 12, 13, 14, 100]]) +// +// Now, we create indices to manipulate a 3-D array: +// +// >>> d3 = np.diag_indices(2, 3) +// >>> d3 +// (array([0, 1]), array([0, 1]), array([0, 1])) +// +// And use it to set the diagonal of an array of zeros to 1: +// +// >>> a = np.zeros((2, 2, 2), dtype=int) +// >>> a[d3] = 1 +// >>> a +// array([[[1, 0], +// [0, 0]], +// [[0, 0], +// [0, 1]]]) +// +// +// +//go:linkname DiagIndices py.diag_indices +func DiagIndices(n *py.Object, ndim *py.Object) *py.Object +// +// Print or write to a file the source code for a NumPy object. +// +// The source code is only returned for objects written in Python. Many +// functions and classes are defined in C and will therefore not return +// useful information. +// +// Parameters +// ---------- +// object : numpy object +// Input object. This can be any object (function, class, module, +// ...). +// output : file object, optional +// If `output` not supplied then source code is printed to screen +// (sys.stdout). File object must be created with either write 'w' or +// append 'a' modes. +// +// See Also +// -------- +// lookfor, info +// +// Examples +// -------- +// >>> np.source(np.interp) #doctest: +SKIP +// In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py +// def interp(x, xp, fp, left=None, right=None): +// """.... (full docstring printed)""" +// if isinstance(x, (float, int, number)): +// return compiled_interp([x], xp, fp, left, right).item() +// else: +// return compiled_interp(x, xp, fp, left, right) +// +// The source code is only returned for objects written in Python. +// +// >>> np.source(np.array) #doctest: +SKIP +// Not available for this object. +// +// +// +//go:linkname Source py.source +func Source(object *py.Object, output *py.Object) *py.Object +// arange([start,] stop[, step,], dtype=None, *, like=None) +// +// Return evenly spaced values within a given interval. +// +// ``arange`` can be called with a varying number of positional arguments: +// +// * ``arange(stop)``: Values are generated within the half-open interval +// ``[0, stop)`` (in other words, the interval including `start` but +// excluding `stop`). +// * ``arange(start, stop)``: Values are generated within the half-open +// interval ``[start, stop)``. +// * ``arange(start, stop, step)`` Values are generated within the half-open +// interval ``[start, stop)``, with spacing between values given by +// ``step``. +// +// For integer arguments the function is roughly equivalent to the Python +// built-in :py:class:`range`, but returns an ndarray rather than a ``range`` +// instance. +// +// When using a non-integer step, such as 0.1, it is often better to use +// `numpy.linspace`. +// +// See the Warning sections below for more information. +// +// Parameters +// ---------- +// start : integer or real, optional +// Start of interval. The interval includes this value. The default +// start value is 0. +// stop : integer or real +// End of interval. The interval does not include this value, except +// in some cases where `step` is not an integer and floating point +// round-off affects the length of `out`. +// step : integer or real, optional +// Spacing between values. For any output `out`, this is the distance +// between two adjacent values, ``out[i+1] - out[i]``. The default +// step size is 1. If `step` is specified as a position argument, +// `start` must also be given. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, infer the data +// type from the other input arguments. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arange : ndarray +// Array of evenly spaced values. +// +// For floating point arguments, the length of the result is +// ``ceil((stop - start)/step)``. Because of floating point overflow, +// this rule may result in the last element of `out` being greater +// than `stop`. +// +// Warnings +// -------- +// The length of the output might not be numerically stable. +// +// Another stability issue is due to the internal implementation of +// `numpy.arange`. +// The actual step value used to populate the array is +// ``dtype(start + step) - dtype(start)`` and not `step`. Precision loss +// can occur here, due to casting or due to using floating points when +// `start` is much larger than `step`. This can lead to unexpected +// behaviour. For example:: +// +// >>> np.arange(0, 5, 0.5, dtype=int) +// array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +// >>> np.arange(-3, 3, 0.5, dtype=int) +// array([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) +// +// In such cases, the use of `numpy.linspace` should be preferred. +// +// The built-in :py:class:`range` generates :std:doc:`Python built-in integers +// that have arbitrary size `, while `numpy.arange` +// produces `numpy.int32` or `numpy.int64` numbers. This may result in +// incorrect results for large integer values:: +// +// >>> power = 40 +// >>> modulo = 10000 +// >>> x1 = [(n ** power) % modulo for n in range(8)] +// >>> x2 = [(n ** power) % modulo for n in np.arange(8)] +// >>> print(x1) +// [0, 1, 7776, 8801, 6176, 625, 6576, 4001] # correct +// >>> print(x2) +// [0, 1, 7776, 7185, 0, 5969, 4816, 3361] # incorrect +// +// See Also +// -------- +// numpy.linspace : Evenly spaced numbers with careful handling of endpoints. +// numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. +// numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.arange(3) +// array([0, 1, 2]) +// >>> np.arange(3.0) +// array([ 0., 1., 2.]) +// >>> np.arange(3,7) +// array([3, 4, 5, 6]) +// >>> np.arange(3,7,2) +// array([3, 5]) +// +//go:linkname Arange py.arange +func Arange(start *py.Object, stop *py.Object, step *py.Object, dtype *py.Object) *py.Object +// +// Return a string representation of a number in the given base system. +// +// Parameters +// ---------- +// number : int +// The value to convert. Positive and negative values are handled. +// base : int, optional +// Convert `number` to the `base` number system. The valid range is 2-36, +// the default value is 2. +// padding : int, optional +// Number of zeros padded on the left. Default is 0 (no padding). +// +// Returns +// ------- +// out : str +// String representation of `number` in `base` system. +// +// See Also +// -------- +// binary_repr : Faster version of `base_repr` for base 2. +// +// Examples +// -------- +// >>> np.base_repr(5) +// '101' +// >>> np.base_repr(6, 5) +// '11' +// >>> np.base_repr(7, base=5, padding=3) +// '00012' +// +// >>> np.base_repr(10, base=16) +// 'A' +// >>> np.base_repr(32, base=16) +// '20' +// +// +// +//go:linkname BaseRepr py.base_repr +func BaseRepr(number *py.Object, base *py.Object, padding *py.Object) *py.Object +// +// Return a full array with the same shape and type as a given array. +// +// Parameters +// ---------- +// a : array_like +// The shape and data-type of `a` define these same attributes of +// the returned array. +// fill_value : array_like +// Fill value. +// dtype : data-type, optional +// Overrides the data type of the result. +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous, +// 'C' otherwise. 'K' means match the layout of `a` as closely +// as possible. +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `a`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of `fill_value` with the same shape and type as `a`. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full : Return a new array of given shape filled with value. +// +// Examples +// -------- +// >>> x = np.arange(6, dtype=int) +// >>> np.full_like(x, 1) +// array([1, 1, 1, 1, 1, 1]) +// >>> np.full_like(x, 0.1) +// array([0, 0, 0, 0, 0, 0]) +// >>> np.full_like(x, 0.1, dtype=np.double) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// >>> np.full_like(x, np.nan, dtype=np.double) +// array([nan, nan, nan, nan, nan, nan]) +// +// >>> y = np.arange(6, dtype=np.double) +// >>> np.full_like(y, 0.1) +// array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) +// +// >>> y = np.zeros([2, 2, 3], dtype=int) +// >>> np.full_like(y, [0, 0, 255]) +// array([[[ 0, 0, 255], +// [ 0, 0, 255]], +// [[ 0, 0, 255], +// [ 0, 0, 255]]]) +// +// +//go:linkname FullLike py.full_like +func FullLike(a *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Return the maximum of an array or maximum along an axis. +// +// `amax` is an alias of `~numpy.max`. +// +// See Also +// -------- +// max : alias of this function +// ndarray.max : equivalent method +// +// +//go:linkname Amax py.amax +func Amax(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric inverse tangent, element-wise. +// +// The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. +// +// Parameters +// ---------- +// x : array_like +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Out has the same shape as `x`. Its real part is in +// ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) +// and the positive `x`-axis. +// angle : Argument of complex values. +// +// Notes +// ----- +// `arctan` is a multi-valued function: for each `x` there are infinitely +// many numbers `z` such that tan(`z`) = `x`. The convention is to return +// the angle `z` whose real part lies in [-pi/2, pi/2]. +// +// For real-valued input data types, `arctan` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctan` is a complex analytic function that +// has [``1j, infj``] and [``-1j, -infj``] as branch cuts, and is continuous +// from the left on the former and from the right on the latter. +// +// The inverse tangent is also known as `atan` or tan^{-1}. +// +// References +// ---------- +// Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, +// 10th printing, New York: Dover, 1964, pp. 79. +// https://personal.math.ubc.ca/~cbm/aands/page_79.htm +// +// Examples +// -------- +// We expect the arctan of 0 to be 0, and of 1 to be pi/4: +// +// >>> np.arctan([0, 1]) +// array([ 0. , 0.78539816]) +// +// >>> np.pi/4 +// 0.78539816339744828 +// +// Plot arctan: +// +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-10, 10) +// >>> plt.plot(x, np.arctan(x)) +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Arctan py.arctan +func Arctan(x *py.Object, out *py.Object) *py.Object +// +// busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) +// +// First adjusts the date to fall on a valid day according to +// the ``roll`` rule, then applies offsets to the given dates +// counted in valid days. +// +// .. versionadded:: 1.7.0 +// +// Parameters +// ---------- +// dates : array_like of datetime64[D] +// The array of dates to process. +// offsets : array_like of int +// The array of offsets, which is broadcast with ``dates``. +// roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', 'modifiedfollowing', 'modifiedpreceding'}, optional +// How to treat dates that do not fall on a valid day. The default +// is 'raise'. +// +// * 'raise' means to raise an exception for an invalid day. +// * 'nat' means to return a NaT (not-a-time) for an invalid day. +// * 'forward' and 'following' mean to take the first valid day +// later in time. +// * 'backward' and 'preceding' mean to take the first valid day +// earlier in time. +// * 'modifiedfollowing' means to take the first valid day +// later in time unless it is across a Month boundary, in which +// case to take the first valid day earlier in time. +// * 'modifiedpreceding' means to take the first valid day +// earlier in time unless it is across a Month boundary, in which +// case to take the first valid day later in time. +// weekmask : str or array_like of bool, optional +// A seven-element array indicating which of Monday through Sunday are +// valid days. May be specified as a length-seven list or array, like +// [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string +// like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for +// weekdays, optionally separated by white space. Valid abbreviations +// are: Mon Tue Wed Thu Fri Sat Sun +// holidays : array_like of datetime64[D], optional +// An array of dates to consider as invalid dates. They may be +// specified in any order, and NaT (not-a-time) dates are ignored. +// This list is saved in a normalized form that is suited for +// fast calculations of valid days. +// busdaycal : busdaycalendar, optional +// A `busdaycalendar` object which specifies the valid days. If this +// parameter is provided, neither weekmask nor holidays may be +// provided. +// out : array of datetime64[D], optional +// If provided, this array is filled with the result. +// +// Returns +// ------- +// out : array of datetime64[D] +// An array with a shape from broadcasting ``dates`` and ``offsets`` +// together, containing the dates with offsets applied. +// +// See Also +// -------- +// busdaycalendar : An object that specifies a custom set of valid days. +// is_busday : Returns a boolean array indicating valid days. +// busday_count : Counts how many valid days are in a half-open date range. +// +// Examples +// -------- +// >>> # First business day in October 2011 (not accounting for holidays) +// ... np.busday_offset('2011-10', 0, roll='forward') +// numpy.datetime64('2011-10-03') +// >>> # Last business day in February 2012 (not accounting for holidays) +// ... np.busday_offset('2012-03', -1, roll='forward') +// numpy.datetime64('2012-02-29') +// >>> # Third Wednesday in January 2011 +// ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed') +// numpy.datetime64('2011-01-19') +// >>> # 2012 Mother's Day in Canada and the U.S. +// ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun') +// numpy.datetime64('2012-05-13') +// +// >>> # First business day on or after a date +// ... np.busday_offset('2011-03-20', 0, roll='forward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 0, roll='forward') +// numpy.datetime64('2011-03-22') +// >>> # First business day after a date +// ... np.busday_offset('2011-03-20', 1, roll='backward') +// numpy.datetime64('2011-03-21') +// >>> np.busday_offset('2011-03-22', 1, roll='backward') +// numpy.datetime64('2011-03-23') +// +// +//go:linkname BusdayOffset py.busday_offset +func BusdayOffset(dates *py.Object, offsets *py.Object, roll *py.Object, weekmask *py.Object, holidays *py.Object, busdaycal *py.Object, out *py.Object) *py.Object +// +// Return the indices for the upper-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The size of the arrays for which the returned indices will +// be valid. +// k : int, optional +// Diagonal offset (see `triu` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple, shape(2) of ndarrays, shape(`n`) +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. Can be used +// to slice a ndarray of shape(`n`, `n`). +// +// See also +// -------- +// tril_indices : similar function, for lower-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// triu, tril +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// upper triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> iu1 = np.triu_indices(4) +// >>> iu2 = np.triu_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[iu1] +// array([ 0, 1, 2, ..., 10, 11, 15]) +// +// And for assigning values: +// +// >>> a[iu1] = -1 +// >>> a +// array([[-1, -1, -1, -1], +// [ 4, -1, -1, -1], +// [ 8, 9, -1, -1], +// [12, 13, 14, -1]]) +// +// These cover only a small part of the whole array (two diagonals right +// of the main one): +// +// >>> a[iu2] = -10 +// >>> a +// array([[ -1, -1, -10, -10], +// [ 4, -1, -1, -10], +// [ 8, 9, -1, -1], +// [ 12, 13, 14, -1]]) +// +// +// +//go:linkname TriuIndices py.triu_indices +func TriuIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +//go:linkname GreaterEqual py.greater_equal +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object +// rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Round elements of the array to the nearest integer. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array is same shape and type as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// fix, ceil, floor, trunc +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.rint(a) +// array([-2., -2., -0., 0., 2., 2., 2.]) +// +//go:linkname Rint py.rint +func Rint(x *py.Object, out *py.Object) *py.Object +// +// datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind') +// +// Convert an array of datetimes into an array of strings. +// +// Parameters +// ---------- +// arr : array_like of datetime64 +// The array of UTC timestamps to format. +// unit : str +// One of None, 'auto', or a :ref:`datetime unit `. +// timezone : {'naive', 'UTC', 'local'} or tzinfo +// Timezone information to use when displaying the datetime. If 'UTC', end +// with a Z to indicate UTC time. If 'local', convert to the local timezone +// first, and suffix with a +-#### timezone offset. If a tzinfo object, +// then do as with 'local', but use the specified timezone. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'} +// Casting to allow when changing between datetime units. +// +// Returns +// ------- +// str_arr : ndarray +// An array of strings the same shape as `arr`. +// +// Examples +// -------- +// >>> import pytz +// >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]') +// >>> d +// array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30', +// '2002-10-27T07:30'], dtype='datetime64[m]') +// +// Setting the timezone to UTC shows the same information, but with a Z suffix +// +// >>> np.datetime_as_string(d, timezone='UTC') +// array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z', +// '2002-10-27T07:30Z'], dtype='>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern')) +// array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400', +// '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='>> np.datetime_as_string(d, unit='h') +// array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'], +// dtype='>> np.datetime_as_string(d, unit='s') +// array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00', +// '2002-10-27T07:30:00'], dtype='>> np.datetime_as_string(d, unit='h', casting='safe') +// Traceback (most recent call last): +// ... +// TypeError: Cannot create a datetime string as units 'h' from a NumPy +// datetime with units 'm' according to the rule 'safe' +// +// +//go:linkname DatetimeAsString py.datetime_as_string +func DatetimeAsString(arr *py.Object, unit *py.Object, timezone *py.Object, casting *py.Object) *py.Object +// +// Split an array into multiple sub-arrays vertically (row-wise). +// +// Please refer to the ``split`` documentation. ``vsplit`` is equivalent +// to ``split`` with `axis=0` (default), the array is always split along the +// first axis regardless of the array dimension. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.vsplit(x, 2) +// [array([[0., 1., 2., 3.], +// [4., 5., 6., 7.]]), array([[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]])] +// >>> np.vsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.]]), array([[12., 13., 14., 15.]]), array([], shape=(0, 4), dtype=float64)] +// +// With a higher dimensional array the split is still along the first axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.vsplit(x, 2) +// [array([[[0., 1.], +// [2., 3.]]]), array([[[4., 5.], +// [6., 7.]]])] +// +// +// +//go:linkname Vsplit py.vsplit +func Vsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the indices for the lower-triangle of an (n, m) array. +// +// Parameters +// ---------- +// n : int +// The row dimension of the arrays for which the returned +// indices will be valid. +// k : int, optional +// Diagonal offset (see `tril` for details). +// m : int, optional +// .. versionadded:: 1.9.0 +// +// The column dimension of the arrays for which the returned +// arrays will be valid. +// By default `m` is taken equal to `n`. +// +// +// Returns +// ------- +// inds : tuple of arrays +// The indices for the triangle. The returned tuple contains two arrays, +// each with the indices along one dimension of the array. +// +// See also +// -------- +// triu_indices : similar function, for upper-triangular. +// mask_indices : generic function accepting an arbitrary mask function. +// tril, triu +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// Compute two different sets of indices to access 4x4 arrays, one for the +// lower triangular part starting at the main diagonal, and one starting two +// diagonals further right: +// +// >>> il1 = np.tril_indices(4) +// >>> il2 = np.tril_indices(4, 2) +// +// Here is how they can be used with a sample array: +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Both for indexing: +// +// >>> a[il1] +// array([ 0, 4, 5, ..., 13, 14, 15]) +// +// And for assigning values: +// +// >>> a[il1] = -1 +// >>> a +// array([[-1, 1, 2, 3], +// [-1, -1, 6, 7], +// [-1, -1, -1, 11], +// [-1, -1, -1, -1]]) +// +// These cover almost the whole array (two diagonals right of the main one): +// +// >>> a[il2] = -10 +// >>> a +// array([[-10, -10, -10, 3], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10], +// [-10, -10, -10, -10]]) +// +// +// +//go:linkname TrilIndices py.tril_indices +func TrilIndices(n *py.Object, k *py.Object, m *py.Object) *py.Object +// +// Save several arrays into a single file in compressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// numpy.save : Save a single array to a binary file in NumPy format. +// numpy.savetxt : Save an array to a file as plain text. +// numpy.savez : Save several arrays into an uncompressed ``.npz`` file format +// numpy.load : Load the files created by savez_compressed. +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is compressed with +// ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable +// in ``.npy`` format. For a description of the ``.npy`` format, see +// :py:mod:`numpy.lib.format`. +// +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Examples +// -------- +// >>> test_array = np.random.rand(3, 2) +// >>> test_vector = np.random.rand(4) +// >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) +// >>> loaded = np.load('/tmp/123.npz') +// >>> print(np.array_equal(test_array, loaded['a'])) +// True +// >>> print(np.array_equal(test_vector, loaded['b'])) +// True +// +// +// +//go:linkname SavezCompressed py.savez_compressed +func SavezCompressed(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// where(condition, [x, y], /) +// +// Return elements chosen from `x` or `y` depending on `condition`. +// +// .. note:: +// When only `condition` is provided, this function is a shorthand for +// ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be +// preferred, as it behaves correctly for subclasses. The rest of this +// documentation covers only the case where all three arguments are +// provided. +// +// Parameters +// ---------- +// condition : array_like, bool +// Where True, yield `x`, otherwise yield `y`. +// x, y : array_like +// Values from which to choose. `x`, `y` and `condition` need to be +// broadcastable to some shape. +// +// Returns +// ------- +// out : ndarray +// An array with elements from `x` where `condition` is True, and elements +// from `y` elsewhere. +// +// See Also +// -------- +// choose +// nonzero : The function that is called when x and y are omitted +// +// Notes +// ----- +// If all the arrays are 1-D, `where` is equivalent to:: +// +// [xv if c else yv +// for c, xv, yv in zip(condition, x, y)] +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.where(a < 5, a, 10*a) +// array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) +// +// This can be used on multidimensional arrays too: +// +// >>> np.where([[True, False], [True, True]], +// ... [[1, 2], [3, 4]], +// ... [[9, 8], [7, 6]]) +// array([[1, 8], +// [3, 4]]) +// +// The shapes of x, y, and the condition are broadcast together: +// +// >>> x, y = np.ogrid[:3, :4] +// >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast +// array([[10, 0, 0, 0], +// [10, 11, 1, 1], +// [10, 11, 12, 2]]) +// +// >>> a = np.array([[0, 1, 2], +// ... [0, 2, 4], +// ... [0, 3, 6]]) +// >>> np.where(a < 4, a, -1) # -1 is broadcast +// array([[ 0, 1, 2], +// [ 0, 2, -1], +// [ 0, 3, -1]]) +// +// +//go:linkname Where py.where +func Where(condition *py.Object, x *py.Object, y *py.Object) *py.Object +// fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// This is the NumPy implementation of the C library function fmod, the +// remainder has the same sign as the dividend `x1`. It is equivalent to +// the Matlab(TM) ``rem`` function and should not be confused with the +// Python modulus operator ``x1 % x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend. +// x2 : array_like +// Divisor. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The remainder of the division of `x1` by `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Equivalent to the Python ``%`` operator. +// divide +// +// Notes +// ----- +// The result of the modulo operation for negative dividend and divisors +// is bound by conventions. For `fmod`, the sign of result is the sign of +// the dividend, while for `remainder` the sign of the result is the sign +// of the divisor. The `fmod` function is equivalent to the Matlab(TM) +// ``rem`` function. +// +// Examples +// -------- +// >>> np.fmod([-3, -2, -1, 1, 2, 3], 2) +// array([-1, 0, -1, 1, 0, 1]) +// >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) +// array([1, 0, 1, 1, 0, 1]) +// +// >>> np.fmod([5, 3], [2, 2.]) +// array([ 1., 1.]) +// >>> a = np.arange(-3, 3).reshape(3, 2) +// >>> a +// array([[-3, -2], +// [-1, 0], +// [ 1, 2]]) +// >>> np.fmod(a, [2,2]) +// array([[-1, 0], +// [-1, 0], +// [ 1, 0]]) +// +//go:linkname Fmod py.fmod +func Fmod(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for finiteness (not infinity and not Not a Number). +// +// The result is returned as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray, bool +// True where ``x`` is not positive infinity, negative infinity, +// or NaN; false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isnan +// +// Notes +// ----- +// Not a Number, positive infinity and negative infinity are considered +// to be non-finite. +// +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// Also that positive infinity is not equivalent to negative infinity. But +// infinity is equivalent to positive infinity. Errors result if the +// second argument is also supplied when `x` is a scalar input, or if +// first and second arguments have different shapes. +// +// Examples +// -------- +// >>> np.isfinite(1) +// True +// >>> np.isfinite(0) +// True +// >>> np.isfinite(np.nan) +// False +// >>> np.isfinite(np.inf) +// False +// >>> np.isfinite(np.NINF) +// False +// >>> np.isfinite([np.log(-1.),1.,np.log(0)]) +// array([False, True, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isfinite(x, y) +// array([0, 1, 0]) +// >>> y +// array([0, 1, 0]) +// +//go:linkname Isfinite py.isfinite +func Isfinite(x *py.Object, out *py.Object) *py.Object +// minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then that +// element is returned. If both elements are NaNs then the first is +// returned. The latter distinction is important for complex NaNs, which +// are defined as at least one of the real or imaginary parts being a NaN. +// The net effect is that NaNs are propagated. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// fmax, amax, nanmax +// +// Notes +// ----- +// The minimum is equivalent to ``np.where(x1 <= x2, x1, x2)`` when +// neither x1 nor x2 are NaNs, but it is faster and does proper +// broadcasting. +// +// Examples +// -------- +// >>> np.minimum([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([nan, nan, nan]) +// >>> np.minimum(-np.Inf, 1) +// -inf +// +//go:linkname Minimum py.minimum +func Minimum(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// ravel_multi_index(multi_index, dims, mode='raise', order='C') +// +// Converts a tuple of index arrays into an array of flat +// indices, applying boundary modes to the multi-index. +// +// Parameters +// ---------- +// multi_index : tuple of array_like +// A tuple of integer arrays, one array for each dimension. +// dims : tuple of ints +// The shape of array into which the indices from ``multi_index`` apply. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices are handled. Can specify +// either one mode or a tuple of modes, one mode per index. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// In 'clip' mode, a negative index which would normally +// wrap will clip to 0 instead. +// order : {'C', 'F'}, optional +// Determines whether the multi-index should be viewed as +// indexing in row-major (C-style) or column-major +// (Fortran-style) order. +// +// Returns +// ------- +// raveled_indices : ndarray +// An array of indices into the flattened version of an array +// of dimensions ``dims``. +// +// See Also +// -------- +// unravel_index +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// Examples +// -------- +// >>> arr = np.array([[3,6,6],[4,5,1]]) +// >>> np.ravel_multi_index(arr, (7,6)) +// array([22, 41, 37]) +// >>> np.ravel_multi_index(arr, (7,6), order='F') +// array([31, 41, 13]) +// >>> np.ravel_multi_index(arr, (4,6), mode='clip') +// array([22, 23, 19]) +// >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap')) +// array([12, 13, 13]) +// +// >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9)) +// 1621 +// +// +//go:linkname RavelMultiIndex py.ravel_multi_index +func RavelMultiIndex(multiIndex *py.Object, dims *py.Object, mode *py.Object, order *py.Object) *py.Object +// +// Compute the weighted average along the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Array containing data to be averaged. If `a` is not an array, a +// conversion is attempted. +// axis : None or int or tuple of ints, optional +// Axis or axes along which to average `a`. The default, +// axis=None, will average over all of the elements of the input array. +// If axis is negative it counts from the last to the first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, averaging is performed on all of the axes +// specified in the tuple instead of a single axis or all the axes as +// before. +// weights : array_like, optional +// An array of weights associated with the values in `a`. Each value in +// `a` contributes to the average according to its associated weight. +// The weights array can either be 1-D (in which case its length must be +// the size of `a` along the given axis) or of the same shape as `a`. +// If `weights=None`, then all data in `a` are assumed to have a +// weight equal to one. The 1-D calculation is:: +// +// avg = sum(a * weights) / sum(weights) +// +// The only constraint on `weights` is that `sum(weights)` must not be 0. +// returned : bool, optional +// Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) +// is returned, otherwise only the average is returned. +// If `weights=None`, `sum_of_weights` is equivalent to the number of +// elements over which the average is taken. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// *Note:* `keepdims` will not work with instances of `numpy.matrix` +// or other classes whose methods do not support `keepdims`. +// +// .. versionadded:: 1.23.0 +// +// Returns +// ------- +// retval, [sum_of_weights] : array_type or double +// Return the average along the specified axis. When `returned` is `True`, +// return a tuple with the average as the first element and the sum +// of the weights as the second element. `sum_of_weights` is of the +// same type as `retval`. The result dtype follows a genereal pattern. +// If `weights` is None, the result dtype will be that of `a` , or ``float64`` +// if `a` is integral. Otherwise, if `weights` is not None and `a` is non- +// integral, the result type will be the type of lowest precision capable of +// representing values of both `a` and `weights`. If `a` happens to be +// integral, the previous rules still applies but the result dtype will +// at least be ``float64``. +// +// Raises +// ------ +// ZeroDivisionError +// When all weights along axis are zero. See `numpy.ma.average` for a +// version robust to this type of error. +// TypeError +// When the length of 1D `weights` is not the same as the shape of `a` +// along axis. +// +// See Also +// -------- +// mean +// +// ma.average : average for masked arrays -- useful if your data contains +// "missing" values +// numpy.result_type : Returns the type that results from applying the +// numpy type promotion rules to the arguments. +// +// Examples +// -------- +// >>> data = np.arange(1, 5) +// >>> data +// array([1, 2, 3, 4]) +// >>> np.average(data) +// 2.5 +// >>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1)) +// 4.0 +// +// >>> data = np.arange(6).reshape((3, 2)) +// >>> data +// array([[0, 1], +// [2, 3], +// [4, 5]]) +// >>> np.average(data, axis=1, weights=[1./4, 3./4]) +// array([0.75, 2.75, 4.75]) +// >>> np.average(data, weights=[1./4, 3./4]) +// Traceback (most recent call last): +// ... +// TypeError: Axis must be specified when shapes of a and weights differ. +// +// >>> a = np.ones(5, dtype=np.float128) +// >>> w = np.ones(5, dtype=np.complex64) +// >>> avg = np.average(a, weights=w) +// >>> print(avg.dtype) +// complex256 +// +// With ``keepdims=True``, the following result has shape (3, 1). +// +// >>> np.average(data, axis=1, keepdims=True) +// array([[0.5], +// [2.5], +// [4.5]]) +// +// +//go:linkname Average py.average +func Average(a *py.Object, axis *py.Object, weights *py.Object, returned *py.Object) *py.Object +// array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, +// like=None) +// +// Create an array. +// +// Parameters +// ---------- +// object : array_like +// An array, any object exposing the array interface, an object whose +// ``__array__`` method returns an array, or any (nested) sequence. +// If object is a scalar, a 0-dimensional array containing object is +// returned. +// dtype : data-type, optional +// The desired data-type for the array. If not given, NumPy will try to use +// a default ``dtype`` that can represent the values (by applying promotion +// rules when necessary.) +// copy : bool, optional +// If true (default), then the object is copied. Otherwise, a copy will +// only be made if ``__array__`` returns a copy, if obj is a nested +// sequence, or if a copy is needed to satisfy any of the other +// requirements (``dtype``, ``order``, etc.). +// order : {'K', 'A', 'C', 'F'}, optional +// Specify the memory layout of the array. If object is not an array, the +// newly created array will be in C order (row major) unless 'F' is +// specified, in which case it will be in Fortran order (column major). +// If object is an array the following holds. +// +// ===== ========= =================================================== +// order no copy copy=True +// ===== ========= =================================================== +// 'K' unchanged F & C order preserved, otherwise most similar order +// 'A' unchanged F order if input is F and not C, otherwise C order +// 'C' C order C order +// 'F' F order F order +// ===== ========= =================================================== +// +// When ``copy=False`` and a copy is made for other reasons, the result is +// the same as if ``copy=True``, with some exceptions for 'A', see the +// Notes section. The default order is 'K'. +// subok : bool, optional +// If True, then sub-classes will be passed-through, otherwise +// the returned array will be forced to be a base-class array (default). +// ndmin : int, optional +// Specifies the minimum number of dimensions that the resulting +// array should have. Ones will be prepended to the shape as +// needed to meet this requirement. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// An array object satisfying the specified requirements. +// +// See Also +// -------- +// empty_like : Return an empty array with shape and type of input. +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// ones : Return a new array setting values to one. +// zeros : Return a new array setting values to zero. +// full : Return a new array of given shape filled with value. +// +// +// Notes +// ----- +// When order is 'A' and ``object`` is an array in neither 'C' nor 'F' order, +// and a copy is forced by a change in dtype, then the order of the result is +// not necessarily 'C' as expected. This is likely a bug. +// +// Examples +// -------- +// >>> np.array([1, 2, 3]) +// array([1, 2, 3]) +// +// Upcasting: +// +// >>> np.array([1, 2, 3.0]) +// array([ 1., 2., 3.]) +// +// More than one dimension: +// +// >>> np.array([[1, 2], [3, 4]]) +// array([[1, 2], +// [3, 4]]) +// +// Minimum dimensions 2: +// +// >>> np.array([1, 2, 3], ndmin=2) +// array([[1, 2, 3]]) +// +// Type provided: +// +// >>> np.array([1, 2, 3], dtype=complex) +// array([ 1.+0.j, 2.+0.j, 3.+0.j]) +// +// Data-type consisting of more than one element: +// +// >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] +// array([1, 3]) +// +// Creating an array from sub-classes: +// +// >>> np.array(np.mat('1 2; 3 4')) +// array([[1, 2], +// [3, 4]]) +// +// >>> np.array(np.mat('1 2; 3 4'), subok=True) +// matrix([[1, 2], +// [3, 4]]) +// +//go:linkname Array py.array +func Array(object *py.Object, dtype *py.Object) *py.Object +// fromstring(string, dtype=float, count=-1, *, sep, like=None) +// +// A new 1-D array initialized from text data in a string. +// +// Parameters +// ---------- +// string : str +// A string containing the data. +// dtype : data-type, optional +// The data type of the array; default: float. For binary input data, +// the data must be in exactly this format. Most builtin numeric types are +// supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int, optional +// Read this number of `dtype` elements from the data. If this is +// negative (the default), the count will be determined from the +// length of the data. +// sep : str, optional +// The string separating numbers in the data; extra whitespace between +// elements is also ignored. +// +// .. deprecated:: 1.14 +// Passing ``sep=''``, the default, is deprecated since it will +// trigger the deprecated binary mode of this function. This mode +// interprets `string` as binary bytes, rather than ASCII text with +// decimal numbers, an operation which is better spelt +// ``frombuffer(string, dtype, count)``. If `string` contains unicode +// text, the binary mode of `fromstring` will first encode it into +// bytes using utf-8, which will not produce sane results. +// +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// arr : ndarray +// The constructed array. +// +// Raises +// ------ +// ValueError +// If the string is not the correct size to satisfy the requested +// `dtype` and `count`. +// +// See Also +// -------- +// frombuffer, fromfile, fromiter +// +// Examples +// -------- +// >>> np.fromstring('1 2', dtype=int, sep=' ') +// array([1, 2]) +// >>> np.fromstring('1, 2', dtype=int, sep=',') +// array([1, 2]) +// +//go:linkname Fromstring py.fromstring +func Fromstring(string *py.Object, dtype *py.Object, count *py.Object) *py.Object +// +// Repeat each element of an array after themselves +// +// Parameters +// ---------- +// a : array_like +// Input array. +// repeats : int or array of ints +// The number of repetitions for each element. `repeats` is broadcasted +// to fit the shape of the given axis. +// axis : int, optional +// The axis along which to repeat values. By default, use the +// flattened input array, and return a flat output array. +// +// Returns +// ------- +// repeated_array : ndarray +// Output array which has the same shape as `a`, except along +// the given axis. +// +// See Also +// -------- +// tile : Tile an array. +// unique : Find the unique elements of an array. +// +// Examples +// -------- +// >>> np.repeat(3, 4) +// array([3, 3, 3, 3]) +// >>> x = np.array([[1,2],[3,4]]) +// >>> np.repeat(x, 2) +// array([1, 1, 2, 2, 3, 3, 4, 4]) +// >>> np.repeat(x, 3, axis=1) +// array([[1, 1, 1, 2, 2, 2], +// [3, 3, 3, 4, 4, 4]]) +// >>> np.repeat(x, [1, 2], axis=0) +// array([[1, 2], +// [3, 4], +// [3, 4]]) +// +// +// +//go:linkname Repeat py.repeat +func Repeat(a *py.Object, repeats *py.Object, axis *py.Object) *py.Object +// +// Return the sum along diagonals of the array. +// +// If `a` is 2-D, the sum along its diagonal with the given offset +// is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i. +// +// If `a` has more than two dimensions, then the axes specified by axis1 and +// axis2 are used to determine the 2-D sub-arrays whose traces are returned. +// The shape of the resulting array is the same as that of `a` with `axis1` +// and `axis2` removed. +// +// Parameters +// ---------- +// a : array_like +// Input array, from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be both positive +// and negative. Defaults to 0. +// axis1, axis2 : int, optional +// Axes to be used as the first and second axis of the 2-D sub-arrays +// from which the diagonals should be taken. Defaults are the first two +// axes of `a`. +// dtype : dtype, optional +// Determines the data-type of the returned array and of the accumulator +// where the elements are summed. If dtype has the value None and `a` is +// of integer type of precision less than the default integer +// precision, then the default integer precision is used. Otherwise, +// the precision is the same as that of `a`. +// out : ndarray, optional +// Array into which the output is placed. Its type is preserved and +// it must be of the right shape to hold the output. +// +// Returns +// ------- +// sum_along_diagonals : ndarray +// If `a` is 2-D, the sum along the diagonal is returned. If `a` has +// larger dimensions, then an array of sums along diagonals is returned. +// +// See Also +// -------- +// diag, diagonal, diagflat +// +// Examples +// -------- +// >>> np.trace(np.eye(3)) +// 3.0 +// >>> a = np.arange(8).reshape((2,2,2)) +// >>> np.trace(a) +// array([6, 8]) +// +// >>> a = np.arange(24).reshape((2,2,2,3)) +// >>> np.trace(a).shape +// (2, 3) +// +// +// +//go:linkname Trace py.trace +func Trace(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object, dtype *py.Object, out *py.Object) *py.Object +// log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the base 10 logarithm of the input array, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The logarithm to the base 10 of `x`, element-wise. NaNs are +// returned where x is negative. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.log10 +// +// Notes +// ----- +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `10**z = x`. The convention is to return the +// `z` whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log10` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log10` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. +// `log10` handles the floating-point negative zero as an infinitesimal +// negative number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 67. +// https://personal.math.ubc.ca/~cbm/aands/page_67.htm +// .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm +// +// Examples +// -------- +// >>> np.log10([1e-15, -3.]) +// array([-15., nan]) +// +//go:linkname Log10 py.log10 +func Log10(x *py.Object, out *py.Object) *py.Object +// +// Modified Bessel function of the first kind, order 0. +// +// Usually denoted :math:`I_0`. +// +// Parameters +// ---------- +// x : array_like of float +// Argument of the Bessel function. +// +// Returns +// ------- +// out : ndarray, shape = x.shape, dtype = float +// The modified Bessel function evaluated at each of the elements of `x`. +// +// See Also +// -------- +// scipy.special.i0, scipy.special.iv, scipy.special.ive +// +// Notes +// ----- +// The scipy implementation is recommended over this function: it is a +// proper ufunc written in C, and more than an order of magnitude faster. +// +// We use the algorithm published by Clenshaw [1]_ and referenced by +// Abramowitz and Stegun [2]_, for which the function domain is +// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev +// polynomial expansions are employed in each interval. Relative error on +// the domain [0,30] using IEEE arithmetic is documented [3]_ as having a +// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). +// +// References +// ---------- +// .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions", in +// *National Physical Laboratory Mathematical Tables*, vol. 5, London: +// Her Majesty's Stationery Office, 1962. +// .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical +// Functions*, 10th printing, New York: Dover, 1964, pp. 379. +// https://personal.math.ubc.ca/~cbm/aands/page_379.htm +// .. [3] https://metacpan.org/pod/distribution/Math-Cephes/lib/Math/Cephes.pod#i0:-Modified-Bessel-function-of-order-zero +// +// Examples +// -------- +// >>> np.i0(0.) +// array(1.0) +// >>> np.i0([0, 1, 2, 3]) +// array([1. , 1.26606588, 2.2795853 , 4.88079259]) +// +// +// +//go:linkname I0 py.i0 +func I0(x *py.Object) *py.Object +// +// Round to nearest integer towards zero. +// +// Round an array of floats element-wise to nearest integer towards zero. +// The rounded values are returned as floats. +// +// Parameters +// ---------- +// x : array_like +// An array of floats to be rounded +// out : ndarray, optional +// A location into which the result is stored. If provided, it must have +// a shape that the input broadcasts to. If not provided or None, a +// freshly-allocated array is returned. +// +// Returns +// ------- +// out : ndarray of floats +// A float array with the same dimensions as the input. +// If second argument is not supplied then a float array is returned +// with the rounded values. +// +// If a second argument is supplied the result is stored there. +// The return value `out` is then a reference to that array. +// +// See Also +// -------- +// rint, trunc, floor, ceil +// around : Round to given number of decimals +// +// Examples +// -------- +// >>> np.fix(3.14) +// 3.0 +// >>> np.fix(3) +// 3.0 +// >>> np.fix([2.1, 2.9, -2.1, -2.9]) +// array([ 2., 2., -2., -2.]) +// +// +// +//go:linkname Fix py.fix +func Fix(x *py.Object, out *py.Object) *py.Object +// +// Find the coefficients of a polynomial with the given sequence of roots. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Returns the coefficients of the polynomial whose leading coefficient +// is one for the given sequence of zeros (multiple roots must be included +// in the sequence as many times as their multiplicity; see Examples). +// A square matrix (or array, which will be treated as a matrix) can also +// be given, in which case the coefficients of the characteristic polynomial +// of the matrix are returned. +// +// Parameters +// ---------- +// seq_of_zeros : array_like, shape (N,) or (N, N) +// A sequence of polynomial roots, or a square array or matrix object. +// +// Returns +// ------- +// c : ndarray +// 1D array of polynomial coefficients from highest to lowest degree: +// +// ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` +// where c[0] always equals 1. +// +// Raises +// ------ +// ValueError +// If input is the wrong shape (the input must be a 1-D or square +// 2-D array). +// +// See Also +// -------- +// polyval : Compute polynomial values. +// roots : Return the roots of a polynomial. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// Specifying the roots of a polynomial still leaves one degree of +// freedom, typically represented by an undetermined leading +// coefficient. [1]_ In the case of this function, that coefficient - +// the first one in the returned array - is always taken as one. (If +// for some reason you have one other point, the only automatic way +// presently to leverage that information is to use ``polyfit``.) +// +// The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` +// matrix **A** is given by +// +// :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, +// +// where **I** is the `n`-by-`n` identity matrix. [2]_ +// +// References +// ---------- +// .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, +// Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. +// +// .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," +// Academic Press, pg. 182, 1980. +// +// Examples +// -------- +// Given a sequence of a polynomial's zeros: +// +// >>> np.poly((0, 0, 0)) # Multiple root example +// array([1., 0., 0., 0.]) +// +// The line above represents z**3 + 0*z**2 + 0*z + 0. +// +// >>> np.poly((-1./2, 0, 1./2)) +// array([ 1. , 0. , -0.25, 0. ]) +// +// The line above represents z**3 - z/4 +// +// >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) +// array([ 1. , -0.77086955, 0.08618131, 0. ]) # random +// +// Given a square array object: +// +// >>> P = np.array([[0, 1./3], [-1./2, 0]]) +// >>> np.poly(P) +// array([1. , 0. , 0.16666667]) +// +// Note how in all cases the leading coefficient is always 1. +// +// +// +//go:linkname Poly py.poly +func Poly(seqOfZeros *py.Object) *py.Object +// +// Return indices that are non-zero in the flattened version of a. +// +// This is equivalent to ``np.nonzero(np.ravel(a))[0]``. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// +// Returns +// ------- +// res : ndarray +// Output array, containing the indices of the elements of ``a.ravel()`` +// that are non-zero. +// +// See Also +// -------- +// nonzero : Return the indices of the non-zero elements of the input array. +// ravel : Return a 1-D array containing the elements of the input array. +// +// Examples +// -------- +// >>> x = np.arange(-2, 3) +// >>> x +// array([-2, -1, 0, 1, 2]) +// >>> np.flatnonzero(x) +// array([0, 1, 3, 4]) +// +// Use the indices of the non-zero elements as an index array to extract +// these elements: +// +// >>> x.ravel()[np.flatnonzero(x)] +// array([-2, -1, 1, 2]) +// +// +// +//go:linkname Flatnonzero py.flatnonzero +func Flatnonzero(a *py.Object) *py.Object +// +// Return the product of array elements over a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// axis : None or int or tuple of ints, optional +// Axis or axes along which a product is performed. The default, +// axis=None, will calculate the product of all the elements in the +// input array. If axis is negative it counts from the last to the +// first axis. +// +// .. versionadded:: 1.7.0 +// +// If axis is a tuple of ints, a product is performed on all of the +// axes specified in the tuple instead of a single axis or all the +// axes as before. +// dtype : dtype, optional +// The type of the returned array, as well as of the accumulator in +// which the elements are multiplied. The dtype of `a` is used by +// default unless `a` has an integer dtype of less precision than the +// default platform integer. In that case, if `a` is signed then the +// platform integer is used while if `a` is unsigned then an unsigned +// integer of the same precision as the platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in the +// result as dimensions with size one. With this option, the result +// will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `prod` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// initial : scalar, optional +// The starting value for this product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.15.0 +// +// where : array_like of bool, optional +// Elements to include in the product. See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// product_along_axis : ndarray, see `dtype` parameter above. +// An array shaped as `a` but with the specified axis removed. +// Returns a reference to `out` if specified. +// +// See Also +// -------- +// ndarray.prod : equivalent method +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. That means that, on a 32-bit platform: +// +// >>> x = np.array([536870910, 536870910, 536870910, 536870910]) +// >>> np.prod(x) +// 16 # may vary +// +// The product of an empty array is the neutral element 1: +// +// >>> np.prod([]) +// 1.0 +// +// Examples +// -------- +// By default, calculate the product of all elements: +// +// >>> np.prod([1.,2.]) +// 2.0 +// +// Even when the input array is two-dimensional: +// +// >>> a = np.array([[1., 2.], [3., 4.]]) +// >>> np.prod(a) +// 24.0 +// +// But we can also specify the axis over which to multiply: +// +// >>> np.prod(a, axis=1) +// array([ 2., 12.]) +// >>> np.prod(a, axis=0) +// array([3., 8.]) +// +// Or select specific elements to include: +// +// >>> np.prod([1., np.nan, 3.], where=[True, False, True]) +// 3.0 +// +// If the type of `x` is unsigned, then the output type is +// the unsigned platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.uint8) +// >>> np.prod(x).dtype == np.uint +// True +// +// If `x` is of a signed integer type, then the output type +// is the default platform integer: +// +// >>> x = np.array([1, 2, 3], dtype=np.int8) +// >>> np.prod(x).dtype == int +// True +// +// You can also start the product with a value other than one: +// +// >>> np.prod([1, 2], initial=5) +// 10 +// +// +//go:linkname Prod py.prod +func Prod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, keepdims *py.Object, initial *py.Object, where *py.Object) *py.Object +// +// Check whether some values are true. +// +// Refer to `any` for full documentation. +// +// .. deprecated:: 1.25.0 +// ``sometrue`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `any` instead. +// +// See Also +// -------- +// any : equivalent function; see for details. +// +// +//go:linkname Sometrue py.sometrue +func Sometrue(__llgo_va_list ...interface{}) *py.Object +// +// Return the Bartlett window. +// +// The Bartlett window is very similar to a triangular window, except +// that the end points are at zero. It is often used in signal +// processing for tapering a signal, without generating too much +// ripple in the frequency domain. +// +// Parameters +// ---------- +// M : int +// Number of points in the output window. If zero or less, an +// empty array is returned. +// +// Returns +// ------- +// out : array +// The triangular window, with the maximum value normalized to one +// (the value one appears only if the number of samples is odd), with +// the first and last samples equal to zero. +// +// See Also +// -------- +// blackman, hamming, hanning, kaiser +// +// Notes +// ----- +// The Bartlett window is defined as +// +// .. math:: w(n) = \frac{2}{M-1} \left( +// \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| +// \right) +// +// Most references to the Bartlett window come from the signal processing +// literature, where it is used as one of many windowing functions for +// smoothing values. Note that convolution with this window produces linear +// interpolation. It is also known as an apodization (which means "removing +// the foot", i.e. smoothing discontinuities at the beginning and end of the +// sampled signal) or tapering function. The Fourier transform of the +// Bartlett window is the product of two sinc functions. Note the excellent +// discussion in Kanasewich [2]_. +// +// References +// ---------- +// .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra", +// Biometrika 37, 1-16, 1950. +// .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", +// The University of Alberta Press, 1975, pp. 109-110. +// .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal +// Processing", Prentice-Hall, 1999, pp. 468-471. +// .. [4] Wikipedia, "Window function", +// https://en.wikipedia.org/wiki/Window_function +// .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, +// "Numerical Recipes", Cambridge University Press, 1986, page 429. +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> np.bartlett(12) +// array([ 0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273, # may vary +// 0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636, +// 0.18181818, 0. ]) +// +// Plot the window and its frequency response (requires SciPy and matplotlib): +// +// >>> from numpy.fft import fft, fftshift +// >>> window = np.bartlett(51) +// >>> plt.plot(window) +// [] +// >>> plt.title("Bartlett window") +// Text(0.5, 1.0, 'Bartlett window') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("Sample") +// Text(0.5, 0, 'Sample') +// >>> plt.show() +// +// >>> plt.figure() +//
+// >>> A = fft(window, 2048) / 25.5 +// >>> mag = np.abs(fftshift(A)) +// >>> freq = np.linspace(-0.5, 0.5, len(A)) +// >>> with np.errstate(divide='ignore', invalid='ignore'): +// ... response = 20 * np.log10(mag) +// ... +// >>> response = np.clip(response, -100, 100) +// >>> plt.plot(freq, response) +// [] +// >>> plt.title("Frequency response of Bartlett window") +// Text(0.5, 1.0, 'Frequency response of Bartlett window') +// >>> plt.ylabel("Magnitude [dB]") +// Text(0, 0.5, 'Magnitude [dB]') +// >>> plt.xlabel("Normalized frequency [cycles per sample]") +// Text(0.5, 0, 'Normalized frequency [cycles per sample]') +// >>> _ = plt.axis('tight') +// >>> plt.show() +// +// +// +//go:linkname Bartlett py.bartlett +func Bartlett(M *py.Object) *py.Object +// +// Add documentation to an existing object, typically one defined in C +// +// The purpose is to allow easier editing of the docstrings without requiring +// a re-compile. This exists primarily for internal use within numpy itself. +// +// Parameters +// ---------- +// place : str +// The absolute name of the module to import from +// obj : str +// The name of the object to add documentation to, typically a class or +// function name +// doc : {str, Tuple[str, str], List[Tuple[str, str]]} +// If a string, the documentation to apply to `obj` +// +// If a tuple, then the first element is interpreted as an attribute of +// `obj` and the second as the docstring to apply - ``(method, docstring)`` +// +// If a list, then each element of the list should be a tuple of length +// two - ``[(method1, docstring1), (method2, docstring2), ...]`` +// warn_on_python : bool +// If True, the default, emit `UserWarning` if this is used to attach +// documentation to a pure-python object. +// +// Notes +// ----- +// This routine never raises an error if the docstring can't be written, but +// will raise an error if the object being documented does not exist. +// +// This routine cannot modify read-only docstrings, as appear +// in new-style classes or built-in functions. Because this +// routine never raises an error the caller must check manually +// that the docstrings were changed. +// +// Since this function grabs the ``char *`` from a c-level str object and puts +// it into the ``tp_doc`` slot of the type of `obj`, it violates a number of +// C-API best-practices, by: +// +// - modifying a `PyTypeObject` after calling `PyType_Ready` +// - calling `Py_INCREF` on the str and losing the reference, so the str +// will never be released +// +// If possible it should be avoided. +// +// +//go:linkname AddNewdoc py.add_newdoc +func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *py.Object) *py.Object +// +// Show libraries and system information on which NumPy was built +// and is being used +// +// Parameters +// ---------- +// mode : {`'stdout'`, `'dicts'`}, optional. +// Indicates how to display the config information. +// `'stdout'` prints to console, `'dicts'` returns a dictionary +// of the configuration. +// +// Returns +// ------- +// out : {`dict`, `None`} +// If mode is `'dicts'`, a dict is returned, else None +// +// See Also +// -------- +// get_include : Returns the directory containing NumPy C +// header files. +// +// Notes +// ----- +// 1. The `'stdout'` mode will give more readable +// output if ``pyyaml`` is installed +// +// +// +//go:linkname ShowConfig py.show_config +func ShowConfig(mode *py.Object) *py.Object +// +// result_type(*arrays_and_dtypes) +// +// Returns the type that results from applying the NumPy +// type promotion rules to the arguments. +// +// Type promotion in NumPy works similarly to the rules in languages +// like C++, with some slight differences. When both scalars and +// arrays are used, the array's type takes precedence and the actual value +// of the scalar is taken into account. +// +// For example, calculating 3*a, where a is an array of 32-bit floats, +// intuitively should result in a 32-bit float output. If the 3 is a +// 32-bit integer, the NumPy rules indicate it can't convert losslessly +// into a 32-bit float, so a 64-bit float should be the result type. +// By examining the value of the constant, '3', we see that it fits in +// an 8-bit integer, which can be cast losslessly into the 32-bit float. +// +// Parameters +// ---------- +// arrays_and_dtypes : list of arrays and dtypes +// The operands of some operation whose result type is needed. +// +// Returns +// ------- +// out : dtype +// The result type. +// +// See also +// -------- +// dtype, promote_types, min_scalar_type, can_cast +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The specific algorithm used is as follows. +// +// Categories are determined by first checking which of boolean, +// integer (int/uint), or floating point (float/complex) the maximum +// kind of all the arrays and the scalars are. +// +// If there are only scalars or the maximum category of the scalars +// is higher than the maximum category of the arrays, +// the data types are combined with :func:`promote_types` +// to produce the return value. +// +// Otherwise, `min_scalar_type` is called on each scalar, and +// the resulting data types are all combined with :func:`promote_types` +// to produce the return value. +// +// The set of int values is not a subset of the uint values for types +// with the same number of bits, something not reflected in +// :func:`min_scalar_type`, but handled as a special case in `result_type`. +// +// Examples +// -------- +// >>> np.result_type(3, np.arange(7, dtype='i1')) +// dtype('int8') +// +// >>> np.result_type('i4', 'c8') +// dtype('complex128') +// +// >>> np.result_type(3.0, -2) +// dtype('float64') +// +// +// +//go:linkname ResultType py.result_type +func ResultType(__llgo_va_list ...interface{}) *py.Object +// less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truth value of (x1 <= x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less_equal([4, 2, 1], [2, 2, 2]) +// array([False, True, True]) +// +// The ``<=`` operator can be used as a shorthand for ``np.less_equal`` on +// ndarrays. +// +// >>> a = np.array([4, 2, 1]) +// >>> b = np.array([2, 2, 2]) +// >>> a <= b +// array([False, True, True]) +// +//go:linkname LessEqual py.less_equal +func LessEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname TrueDivide py.true_divide +func TrueDivide(__llgo_va_list ...interface{}) *py.Object +// +// einsum(subscripts, *operands, out=None, dtype=None, order='K', +// casting='safe', optimize=False) +// +// Evaluates the Einstein summation convention on the operands. +// +// Using the Einstein summation convention, many common multi-dimensional, +// linear algebraic array operations can be represented in a simple fashion. +// In *implicit* mode `einsum` computes these values. +// +// In *explicit* mode, `einsum` provides further flexibility to compute +// other array operations that might not be considered classical Einstein +// summation operations, by disabling, or forcing summation over specified +// subscript labels. +// +// See the notes and examples for clarification. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation as comma separated list of +// subscript labels. An implicit (classical Einstein summation) +// calculation is performed unless the explicit indicator '->' is +// included as well as subscript labels of the precise output form. +// operands : list of array_like +// These are the arrays for the operation. +// out : ndarray, optional +// If provided, the calculation is done into this array. +// dtype : {data-type, None}, optional +// If provided, forces the calculation to use the data type specified. +// Note that you may have to also give a more liberal `casting` +// parameter to allow the conversions. Default is None. +// order : {'C', 'F', 'A', 'K'}, optional +// Controls the memory layout of the output. 'C' means it should +// be C contiguous. 'F' means it should be Fortran contiguous, +// 'A' means it should be 'F' if the inputs are all 'F', 'C' otherwise. +// 'K' means it should be as close to the layout as the inputs as +// is possible, including arbitrarily permuted axes. +// Default is 'K'. +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Setting this to +// 'unsafe' is not recommended, as it can adversely affect accumulations. +// +// * 'no' means the data types should not be cast at all. +// * 'equiv' means only byte-order changes are allowed. +// * 'safe' means only casts which can preserve values are allowed. +// * 'same_kind' means only safe casts or casts within a kind, +// like float64 to float32, are allowed. +// * 'unsafe' means any data conversions may be done. +// +// Default is 'safe'. +// optimize : {False, True, 'greedy', 'optimal'}, optional +// Controls if intermediate optimization should occur. No optimization +// will occur if False and True will default to the 'greedy' algorithm. +// Also accepts an explicit contraction list from the ``np.einsum_path`` +// function. See ``np.einsum_path`` for more details. Defaults to False. +// +// Returns +// ------- +// output : ndarray +// The calculation based on the Einstein summation convention. +// +// See Also +// -------- +// einsum_path, dot, inner, outer, tensordot, linalg.multi_dot +// einops : +// similar verbose interface is provided by +// `einops `_ package to cover +// additional operations: transpose, reshape/flatten, repeat/tile, +// squeeze/unsqueeze and reductions. +// opt_einsum : +// `opt_einsum `_ +// optimizes contraction order for einsum-like expressions +// in backend-agnostic manner. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// The Einstein summation convention can be used to compute +// many multi-dimensional, linear algebraic array operations. `einsum` +// provides a succinct way of representing these. +// +// A non-exhaustive list of these operations, +// which can be computed by `einsum`, is shown below along with examples: +// +// * Trace of an array, :py:func:`numpy.trace`. +// * Return a diagonal, :py:func:`numpy.diag`. +// * Array axis summations, :py:func:`numpy.sum`. +// * Transpositions and permutations, :py:func:`numpy.transpose`. +// * Matrix multiplication and dot product, :py:func:`numpy.matmul` :py:func:`numpy.dot`. +// * Vector inner and outer products, :py:func:`numpy.inner` :py:func:`numpy.outer`. +// * Broadcasting, element-wise and scalar multiplication, :py:func:`numpy.multiply`. +// * Tensor contractions, :py:func:`numpy.tensordot`. +// * Chained array operations, in efficient calculation order, :py:func:`numpy.einsum_path`. +// +// The subscripts string is a comma-separated list of subscript labels, +// where each label refers to a dimension of the corresponding operand. +// Whenever a label is repeated it is summed, so ``np.einsum('i,i', a, b)`` +// is equivalent to :py:func:`np.inner(a,b) `. If a label +// appears only once, it is not summed, so ``np.einsum('i', a)`` produces a +// view of ``a`` with no changes. A further example ``np.einsum('ij,jk', a, b)`` +// describes traditional matrix multiplication and is equivalent to +// :py:func:`np.matmul(a,b) `. Repeated subscript labels in one +// operand take the diagonal. For example, ``np.einsum('ii', a)`` is equivalent +// to :py:func:`np.trace(a) `. +// +// In *implicit mode*, the chosen subscripts are important +// since the axes of the output are reordered alphabetically. This +// means that ``np.einsum('ij', a)`` doesn't affect a 2D array, while +// ``np.einsum('ji', a)`` takes its transpose. Additionally, +// ``np.einsum('ij,jk', a, b)`` returns a matrix multiplication, while, +// ``np.einsum('ij,jh', a, b)`` returns the transpose of the +// multiplication since subscript 'h' precedes subscript 'i'. +// +// In *explicit mode* the output can be directly controlled by +// specifying output subscript labels. This requires the +// identifier '->' as well as the list of output subscript labels. +// This feature increases the flexibility of the function since +// summing can be disabled or forced when required. The call +// ``np.einsum('i->', a)`` is like :py:func:`np.sum(a, axis=-1) `, +// and ``np.einsum('ii->i', a)`` is like :py:func:`np.diag(a) `. +// The difference is that `einsum` does not allow broadcasting by default. +// Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the +// order of the output subscript labels and therefore returns matrix +// multiplication, unlike the example above in implicit mode. +// +// To enable and control broadcasting, use an ellipsis. Default +// NumPy-style broadcasting is done by adding an ellipsis +// to the left of each term, like ``np.einsum('...ii->...i', a)``. +// To take the trace along the first and last axes, +// you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix +// product with the left-most indices instead of rightmost, one can do +// ``np.einsum('ij...,jk...->ik...', a, b)``. +// +// When there is only one operand, no axes are summed, and no output +// parameter is provided, a view into the operand is returned instead +// of a new array. Thus, taking the diagonal as ``np.einsum('ii->i', a)`` +// produces a view (changed in version 1.10.0). +// +// `einsum` also provides an alternative way to provide the subscripts +// and operands as ``einsum(op0, sublist0, op1, sublist1, ..., [sublistout])``. +// If the output shape is not provided in this format `einsum` will be +// calculated in implicit mode, otherwise it will be performed explicitly. +// The examples below have corresponding `einsum` calls with the two +// parameter methods. +// +// .. versionadded:: 1.10.0 +// +// Views returned from einsum are now writeable whenever the input array +// is writeable. For example, ``np.einsum('ijk...->kji...', a)`` will now +// have the same effect as :py:func:`np.swapaxes(a, 0, 2) ` +// and ``np.einsum('ii->i', a)`` will return a writeable view of the diagonal +// of a 2D array. +// +// .. versionadded:: 1.12.0 +// +// Added the ``optimize`` argument which will optimize the contraction order +// of an einsum expression. For a contraction with three or more operands this +// can greatly increase the computational efficiency at the cost of a larger +// memory footprint during computation. +// +// Typically a 'greedy' algorithm is applied which empirical tests have shown +// returns the optimal path in the majority of cases. In some cases 'optimal' +// will return the superlative path through a more expensive, exhaustive search. +// For iterative calculations it may be advisable to calculate the optimal path +// once and reuse that path by supplying it as an argument. An example is given +// below. +// +// See :py:func:`numpy.einsum_path` for more details. +// +// Examples +// -------- +// >>> a = np.arange(25).reshape(5,5) +// >>> b = np.arange(5) +// >>> c = np.arange(6).reshape(2,3) +// +// Trace of a matrix: +// +// >>> np.einsum('ii', a) +// 60 +// >>> np.einsum(a, [0,0]) +// 60 +// >>> np.trace(a) +// 60 +// +// Extract the diagonal (requires explicit form): +// +// >>> np.einsum('ii->i', a) +// array([ 0, 6, 12, 18, 24]) +// >>> np.einsum(a, [0,0], [0]) +// array([ 0, 6, 12, 18, 24]) +// >>> np.diag(a) +// array([ 0, 6, 12, 18, 24]) +// +// Sum over an axis (requires explicit form): +// +// >>> np.einsum('ij->i', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [0,1], [0]) +// array([ 10, 35, 60, 85, 110]) +// >>> np.sum(a, axis=1) +// array([ 10, 35, 60, 85, 110]) +// +// For higher dimensional arrays summing a single axis can be done with ellipsis: +// +// >>> np.einsum('...j->...', a) +// array([ 10, 35, 60, 85, 110]) +// >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) +// array([ 10, 35, 60, 85, 110]) +// +// Compute a matrix transpose, or reorder any number of axes: +// +// >>> np.einsum('ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum('ij->ji', c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.einsum(c, [1,0]) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// >>> np.transpose(c) +// array([[0, 3], +// [1, 4], +// [2, 5]]) +// +// Vector inner products: +// +// >>> np.einsum('i,i', b, b) +// 30 +// >>> np.einsum(b, [0], b, [0]) +// 30 +// >>> np.inner(b,b) +// 30 +// +// Matrix vector multiplication: +// +// >>> np.einsum('ij,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum(a, [0,1], b, [1]) +// array([ 30, 80, 130, 180, 230]) +// >>> np.dot(a, b) +// array([ 30, 80, 130, 180, 230]) +// >>> np.einsum('...j,j', a, b) +// array([ 30, 80, 130, 180, 230]) +// +// Broadcasting and scalar multiplication: +// +// >>> np.einsum('..., ...', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(',ij', 3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.einsum(3, [Ellipsis], c, [Ellipsis]) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// >>> np.multiply(3, c) +// array([[ 0, 3, 6], +// [ 9, 12, 15]]) +// +// Vector outer product: +// +// >>> np.einsum('i,j', np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.einsum(np.arange(2)+1, [0], b, [1]) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// >>> np.outer(np.arange(2)+1, b) +// array([[0, 1, 2, 3, 4], +// [0, 2, 4, 6, 8]]) +// +// Tensor contraction: +// +// >>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> np.einsum('ijk,jil->kl', a, b) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.einsum(a, [0,1,2], b, [1,0,3], [2,3]) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> np.tensordot(a,b, axes=([1,0],[0,1])) +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// +// Writeable returned arrays (since version 1.10.0): +// +// >>> a = np.zeros((3, 3)) +// >>> np.einsum('ii->i', a)[:] = 1 +// >>> a +// array([[1., 0., 0.], +// [0., 1., 0.], +// [0., 0., 1.]]) +// +// Example of ellipsis use: +// +// >>> a = np.arange(6).reshape((3,2)) +// >>> b = np.arange(12).reshape((4,3)) +// >>> np.einsum('ki,jk->ij', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('ki,...k->i...', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// >>> np.einsum('k...,jk', a, b) +// array([[10, 28, 46, 64], +// [13, 40, 67, 94]]) +// +// Chained array operations. For more complicated contractions, speed ups +// might be achieved by repeatedly computing a 'greedy' path or pre-computing the +// 'optimal' path and repeatedly applying it, using an +// `einsum_path` insertion (since version 1.12.0). Performance improvements can be +// particularly significant with larger arrays: +// +// >>> a = np.ones(64).reshape(2,4,8) +// +// Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a) +// +// Sub-optimal `einsum` (due to repeated path calculation time): ~330ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal') +// +// Greedy `einsum` (faster optimal path approximation): ~160ms +// +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='greedy') +// +// Optimal `einsum` (best usage pattern in some use cases): ~110ms +// +// >>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize='optimal')[0] +// >>> for iteration in range(500): +// ... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) +// +// +// +//go:linkname Einsum py.einsum +func Einsum(__llgo_va_list ...interface{}) *py.Object +// +// Stack 1-D arrays as columns into a 2-D array. +// +// Take a sequence of 1-D arrays and stack them as columns +// to make a single 2-D array. 2-D arrays are stacked as-is, +// just like with `hstack`. 1-D arrays are turned into 2-D columns +// first. +// +// Parameters +// ---------- +// tup : sequence of 1-D or 2-D arrays. +// Arrays to stack. All of them must have the same first dimension. +// +// Returns +// ------- +// stacked : 2-D array +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// stack, hstack, vstack, concatenate +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((2,3,4)) +// >>> np.column_stack((a,b)) +// array([[1, 2], +// [2, 3], +// [3, 4]]) +// +// +// +//go:linkname ColumnStack py.column_stack +func ColumnStack(tup *py.Object) *py.Object +// +// Load data from a text file, with missing values handled as specified. +// +// Each line past the first `skip_header` lines is split at the `delimiter` +// character, and characters following the `comments` character are discarded. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : dtype, optional +// Data type of the resulting array. +// If None, the dtypes will be determined by the contents of each +// column, individually. +// comments : str, optional +// The character used to indicate the start of a comment. +// All the characters occurring on a line after a comment are discarded. +// delimiter : str, int, or sequence, optional +// The string used to separate values. By default, any consecutive +// whitespaces act as delimiter. An integer or sequence of integers +// can also be provided as width(s) of each field. +// skiprows : int, optional +// `skiprows` was removed in numpy 1.10. Please use `skip_header` instead. +// skip_header : int, optional +// The number of lines to skip at the beginning of the file. +// skip_footer : int, optional +// The number of lines to skip at the end of the file. +// converters : variable, optional +// The set of functions that convert the data of a column to a value. +// The converters can also be used to provide a default value +// for missing data: ``converters = {3: lambda s: float(s or 0)}``. +// missing : variable, optional +// `missing` was removed in numpy 1.10. Please use `missing_values` +// instead. +// missing_values : variable, optional +// The set of strings corresponding to missing data. +// filling_values : variable, optional +// The set of values to be used as default when the data are missing. +// usecols : sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns. +// names : {None, True, str, sequence}, optional +// If `names` is True, the field names are read from the first line after +// the first `skip_header` lines. This line can optionally be preceded +// by a comment delimiter. If `names` is a sequence or a single-string of +// comma-separated names, the names will be used to define the field names +// in a structured dtype. If `names` is None, the names of the dtype +// fields will be used, if any. +// excludelist : sequence, optional +// A list of names to exclude. This list is appended to the default list +// ['return','file','print']. Excluded names are appended with an +// underscore: for example, `file` would become `file_`. +// deletechars : str, optional +// A string combining invalid characters that must be deleted from the +// names. +// defaultfmt : str, optional +// A format used to define default field names, such as "f%i" or "f_%02i". +// autostrip : bool, optional +// Whether to automatically strip white spaces from the variables. +// replace_space : char, optional +// Character(s) used in replacement of white spaces in the variable +// names. By default, use a '_'. +// case_sensitive : {True, False, 'upper', 'lower'}, optional +// If True, field names are case sensitive. +// If False or 'upper', field names are converted to upper case. +// If 'lower', field names are converted to lower case. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = genfromtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// usemask : bool, optional +// If True, return a masked array. +// If False, return a regular array. +// loose : bool, optional +// If True, do not raise errors for invalid values. +// invalid_raise : bool, optional +// If True, an exception is raised if an inconsistency is detected in the +// number of columns. +// If False, a warning is emitted and the offending lines are skipped. +// max_rows : int, optional +// The maximum number of rows to read. Must not be used with skip_footer +// at the same time. If given, the value must be at least 1. Default is +// to read the entire file. +// +// .. versionadded:: 1.10.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply when `fname` is +// a file object. The special value 'bytes' enables backward compatibility +// workarounds that ensure that you receive byte arrays when possible +// and passes latin1 encoded strings to converters. Override this value to +// receive unicode arrays and pass strings as input to converters. If set +// to None the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// ndmin : int, optional +// Same parameter as `loadtxt` +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. If `usemask` is True, this is a +// masked array. +// +// See Also +// -------- +// numpy.loadtxt : equivalent function when no data is missing. +// +// Notes +// ----- +// * When spaces are used as delimiters, or when no delimiter has been given +// as input, there should not be any missing data between two fields. +// * When the variables are named (either by a flexible dtype or with `names`), +// there must not be any header in the file (else a ValueError +// exception is raised). +// * Individual values are not stripped of spaces by default. +// When using a custom converter, make sure the function does remove spaces. +// +// References +// ---------- +// .. [1] NumPy User Guide, section `I/O with NumPy +// `_. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> import numpy as np +// +// Comma delimited file with mixed dtype +// +// >>> s = StringIO(u"1,1.3,abcde") +// >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), +// ... ('mystring','S5')], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) # needed for StringIO example only +// >>> data = np.genfromtxt(s, dtype=None, +// ... names = ['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> _ = s.seek(0) +// >>> data = np.genfromtxt(s, dtype="i8,f8,S5", +// ... names=['myint','myfloat','mystring'], delimiter=",") +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('myint', '>> s = StringIO(u"11.3abcde") +// >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], +// ... delimiter=[1,3,5]) +// >>> data +// array((1, 1.3, b'abcde'), +// dtype=[('intvar', '>> f = StringIO(''' +// ... text,# of chars +// ... hello world,11 +// ... numpy,5''') +// >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') +// array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], +// dtype=[('f0', 'S12'), ('f1', 'S12')]) +// +// +// +//go:linkname Genfromtxt py.genfromtxt +func Genfromtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, skipHeader *py.Object, skipFooter *py.Object, converters *py.Object, missingValues *py.Object, fillingValues *py.Object, usecols *py.Object, names *py.Object, excludelist *py.Object, deletechars *py.Object, replaceSpace *py.Object, autostrip *py.Object, caseSensitive *py.Object, defaultfmt *py.Object, unpack *py.Object, usemask *py.Object, loose *py.Object, invalidRaise *py.Object, maxRows *py.Object, encoding *py.Object) *py.Object +// +// Take elements from an array along an axis. +// +// When axis is not None, this function does the same thing as "fancy" +// indexing (indexing arrays using arrays); however, it can be easier to use +// if you need elements along a given axis. A call such as +// ``np.take(arr, indices, axis=3)`` is equivalent to +// ``arr[:,:,:,indices,...]``. +// +// Explained without fancy indexing, this is equivalent to the following use +// of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of +// indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// Nj = indices.shape +// for ii in ndindex(Ni): +// for jj in ndindex(Nj): +// for kk in ndindex(Nk): +// out[ii + jj + kk] = a[ii + (indices[jj],) + kk] +// +// Parameters +// ---------- +// a : array_like (Ni..., M, Nk...) +// The source array. +// indices : array_like (Nj...) +// The indices of the values to extract. +// +// .. versionadded:: 1.8.0 +// +// Also allow scalars for indices. +// axis : int, optional +// The axis over which to select values. By default, the flattened +// input array is used. +// out : ndarray, optional (Ni..., Nj..., Nk...) +// If provided, the result will be placed in this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if `mode='raise'`; use other modes for better performance. +// mode : {'raise', 'wrap', 'clip'}, optional +// Specifies how out-of-bounds indices will behave. +// +// * 'raise' -- raise an error (default) +// * 'wrap' -- wrap around +// * 'clip' -- clip to the range +// +// 'clip' mode means that all indices that are too large are replaced +// by the index that addresses the last element along that axis. Note +// that this disables indexing with negative numbers. +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The returned array has the same type as `a`. +// +// See Also +// -------- +// compress : Take elements using a boolean mask +// ndarray.take : equivalent method +// take_along_axis : Take elements by matching the array and the index arrays +// +// Notes +// ----- +// +// By eliminating the inner loop in the description above, and using `s_` to +// build simple slice objects, `take` can be expressed in terms of applying +// fancy indexing to each 1-d slice:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nj): +// out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices] +// +// For this reason, it is equivalent to (but faster than) the following use +// of `apply_along_axis`:: +// +// out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a) +// +// Examples +// -------- +// >>> a = [4, 3, 5, 7, 6, 8] +// >>> indices = [0, 1, 4] +// >>> np.take(a, indices) +// array([4, 3, 6]) +// +// In this example if `a` is an ndarray, "fancy" indexing can be used. +// +// >>> a = np.array(a) +// >>> a[indices] +// array([4, 3, 6]) +// +// If `indices` is not one dimensional, the output also has these dimensions. +// +// >>> np.take(a, [[0, 1], [2, 3]]) +// array([[4, 3], +// [5, 7]]) +// +// +//go:linkname Take py.take +func Take(a *py.Object, indices *py.Object, axis *py.Object, out *py.Object, mode *py.Object) *py.Object +// log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Base-2 logarithm of `x`. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Base-2 logarithm of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// log, log10, log1p, emath.log2 +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Logarithm is a multivalued function: for each `x` there is an infinite +// number of `z` such that `2**z = x`. The convention is to return the `z` +// whose imaginary part lies in `(-pi, pi]`. +// +// For real-valued input data types, `log2` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `log2` is a complex analytical function that +// has a branch cut `[-inf, 0]` and is continuous from above on it. `log2` +// handles the floating-point negative zero as an infinitesimal negative +// number, conforming to the C99 standard. +// +// In the cases where the input has a negative real part and a very small +// negative complex part (approaching 0), the result is so close to `-pi` +// that it evaluates to exactly `-pi`. +// +// Examples +// -------- +// >>> x = np.array([0, 1, 2, 2**4]) +// >>> np.log2(x) +// array([-Inf, 0., 1., 4.]) +// +// >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) +// >>> np.log2(xi) +// array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) +// +//go:linkname Log2 py.log2 +func Log2(x *py.Object, out *py.Object) *py.Object +// rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Angle in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding angle in degrees. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : Convert angles from degrees to radians. +// unwrap : Remove large jumps in angle by wrapping. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// rad2deg(x) is ``180 * x / pi``. +// +// Examples +// -------- +// >>> np.rad2deg(np.pi/2) +// 90.0 +// +//go:linkname Rad2deg py.rad2deg +func Rad2deg(x *py.Object, out *py.Object) *py.Object +// +// Display a message on a device. +// +// Parameters +// ---------- +// mesg : str +// Message to display. +// device : object +// Device to write message. If None, defaults to ``sys.stdout`` which is +// very similar to ``print``. `device` needs to have ``write()`` and +// ``flush()`` methods. +// linefeed : bool, optional +// Option whether to print a line feed or not. Defaults to True. +// +// Raises +// ------ +// AttributeError +// If `device` does not have a ``write()`` or ``flush()`` method. +// +// Examples +// -------- +// Besides ``sys.stdout``, a file-like object can also be used as it has +// both required methods: +// +// >>> from io import StringIO +// >>> buf = StringIO() +// >>> np.disp(u'"Display" in a file', device=buf) +// >>> buf.getvalue() +// '"Display" in a file\n' +// +// +// +//go:linkname Disp py.disp +func Disp(mesg *py.Object, device *py.Object, linefeed *py.Object) *py.Object +// +// Load ASCII data stored in a comma-separated file. +// +// The returned array is a record array (if ``usemask=False``, see +// `recarray`) or a masked record array (if ``usemask=True``, +// see `ma.mrecords.MaskedRecords`). +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function to load ASCII data. +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromcsv py.recfromcsv +func Recfromcsv(fname *py.Object) *py.Object +// +// Return the cumulative sum of array elements over a given axis treating Not a +// Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are +// encountered and leading NaNs are replaced by zeros. +// +// Zeros are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative sum is computed. The default +// (None) is to compute the cumsum over the flattened array. +// dtype : dtype, optional +// Type of the returned array and of the accumulator in which the +// elements are summed. If `dtype` is not specified, it defaults +// to the dtype of `a`, unless `a` has an integer dtype with a +// precision less than that of the default platform integer. In +// that case, the default platform integer is used. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type will be cast if necessary. See :ref:`ufuncs-output-type` for +// more details. +// +// Returns +// ------- +// nancumsum : ndarray. +// A new array holding the result is returned unless `out` is +// specified, in which it is returned. The result has the same +// size as `a`, and the same shape as `a` if `axis` is not None +// or `a` is a 1-d array. +// +// See Also +// -------- +// numpy.cumsum : Cumulative sum across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumsum(1) +// array([1]) +// >>> np.nancumsum([1]) +// array([1]) +// >>> np.nancumsum([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumsum(a) +// array([1., 3., 6., 6.]) +// >>> np.nancumsum(a, axis=0) +// array([[1., 2.], +// [4., 2.]]) +// >>> np.nancumsum(a, axis=1) +// array([[1., 3.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumsum py.nancumsum +func Nancumsum(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// Return a contiguous flattened array. +// +// A 1-D array, containing the elements of the input, is returned. A copy is +// made only if needed. +// +// As of NumPy 1.10, the returned array will have the same type as the input +// array. (for example, a masked array will be returned for a masked array +// input) +// +// Parameters +// ---------- +// a : array_like +// Input array. The elements in `a` are read in the order specified by +// `order`, and packed as a 1-D array. +// order : {'C','F', 'A', 'K'}, optional +// +// The elements of `a` are read using this index order. 'C' means +// to index the elements in row-major, C-style order, +// with the last axis index changing fastest, back to the first +// axis index changing slowest. 'F' means to index the elements +// in column-major, Fortran-style order, with the +// first index changing fastest, and the last index changing +// slowest. Note that the 'C' and 'F' options take no account of +// the memory layout of the underlying array, and only refer to +// the order of axis indexing. 'A' means to read the elements in +// Fortran-like index order if `a` is Fortran *contiguous* in +// memory, C-like order otherwise. 'K' means to read the +// elements in the order they occur in memory, except for +// reversing the data when strides are negative. By default, 'C' +// index order is used. +// +// Returns +// ------- +// y : array_like +// y is a contiguous 1-D array of the same subtype as `a`, +// with shape ``(a.size,)``. +// Note that matrices are special cased for backward compatibility, +// if `a` is a matrix, then y is a 1-D ndarray. +// +// See Also +// -------- +// ndarray.flat : 1-D iterator over an array. +// ndarray.flatten : 1-D array copy of the elements of an array +// in row-major order. +// ndarray.reshape : Change the shape of an array without changing its data. +// +// Notes +// ----- +// In row-major, C-style order, in two dimensions, the row index +// varies the slowest, and the column index the quickest. This can +// be generalized to multiple dimensions, where row-major order +// implies that the index along the first axis varies slowest, and +// the index along the last quickest. The opposite holds for +// column-major, Fortran-style index ordering. +// +// When a view is desired in as many cases as possible, ``arr.reshape(-1)`` +// may be preferable. However, ``ravel`` supports ``K`` in the optional +// ``order`` argument while ``reshape`` does not. +// +// Examples +// -------- +// It is equivalent to ``reshape(-1, order=order)``. +// +// >>> x = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.ravel(x) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> x.reshape(-1) +// array([1, 2, 3, 4, 5, 6]) +// +// >>> np.ravel(x, order='F') +// array([1, 4, 2, 5, 3, 6]) +// +// When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: +// +// >>> np.ravel(x.T) +// array([1, 4, 2, 5, 3, 6]) +// >>> np.ravel(x.T, order='A') +// array([1, 2, 3, 4, 5, 6]) +// +// When ``order`` is 'K', it will preserve orderings that are neither 'C' +// nor 'F', but won't reverse axes: +// +// >>> a = np.arange(3)[::-1]; a +// array([2, 1, 0]) +// >>> a.ravel(order='C') +// array([2, 1, 0]) +// >>> a.ravel(order='K') +// array([2, 1, 0]) +// +// >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a +// array([[[ 0, 2, 4], +// [ 1, 3, 5]], +// [[ 6, 8, 10], +// [ 7, 9, 11]]]) +// >>> a.ravel(order='C') +// array([ 0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11]) +// >>> a.ravel(order='K') +// array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) +// +// +// +//go:linkname Ravel py.ravel +func Ravel(a *py.Object, order *py.Object) *py.Object +// equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 == x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// not_equal, greater_equal, less_equal, greater, less +// +// Examples +// -------- +// >>> np.equal([0, 1, 3], np.arange(3)) +// array([ True, True, False]) +// +// What is compared are values, not types. So an int (1) and an array of +// length one can evaluate as True: +// +// >>> np.equal(1, np.ones(1)) +// array([ True]) +// +// The ``==`` operator can be used as a shorthand for ``np.equal`` on +// ndarrays. +// +// >>> a = np.array([2, 4, 6]) +// >>> b = np.array([2, 4, 2]) +// >>> a == b +// array([ True, True, False]) +// +//go:linkname Equal py.equal +func Equal(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 XOR x2, element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical XOR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result of the logical XOR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_or, logical_not, bitwise_xor +// +// Examples +// -------- +// >>> np.logical_xor(True, False) +// True +// >>> np.logical_xor([True, True, False, False], [True, False, True, False]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_xor(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// Simple example showing support of broadcasting +// +// >>> np.logical_xor(0, np.eye(2)) +// array([[ True, False], +// [False, True]]) +// +//go:linkname LogicalXor py.logical_xor +func LogicalXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Remainder py.remainder +func Remainder(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in positional notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed, or if `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// fractional : boolean, optional +// If `True`, the cutoffs of `precision` and `min_digits` refer to the +// total number of digits after the decimal point, including leading +// zeros. +// If `False`, `precision` and `min_digits` refer to the total number of +// significant digits, before or after the decimal point, ignoring leading +// zeros. +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// pad_right : non-negative integer, optional +// Pad the right side of the string with whitespace until at least that +// many characters are to the right of the decimal point. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. Only has an effect if `unique=True` +// in which case additional digits past those necessary to uniquely +// identify the value may be printed, rounding the last additional digit. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_scientific +// +// Examples +// -------- +// >>> np.format_float_positional(np.float32(np.pi)) +// '3.1415927' +// >>> np.format_float_positional(np.float16(np.pi)) +// '3.14' +// >>> np.format_float_positional(np.float16(0.3)) +// '0.3' +// >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) +// '0.3000488281' +// +// +//go:linkname FormatFloatPositional py.format_float_positional +func FormatFloatPositional(x *py.Object, precision *py.Object, unique *py.Object, fractional *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, padRight *py.Object, minDigits *py.Object) *py.Object +// +// Return the character for the minimum-size type to which given types can +// be safely cast. +// +// The returned type character must represent the smallest size dtype such +// that an array of the returned type can handle the data from an array of +// all types in `typechars` (or if `typechars` is an array, then its +// dtype.char). +// +// Parameters +// ---------- +// typechars : list of str or array_like +// If a list of strings, each string should represent a dtype. +// If array_like, the character representation of the array dtype is used. +// typeset : str or list of str, optional +// The set of characters that the returned character is chosen from. +// The default set is 'GDFgdf'. +// default : str, optional +// The default character, this is returned if none of the characters in +// `typechars` matches a character in `typeset`. +// +// Returns +// ------- +// typechar : str +// The character representing the minimum-size type that was found. +// +// See Also +// -------- +// dtype, sctype2char, maximum_sctype +// +// Examples +// -------- +// >>> np.mintypecode(['d', 'f', 'S']) +// 'd' +// >>> x = np.array([1.1, 2-3.j]) +// >>> np.mintypecode(x) +// 'D' +// +// >>> np.mintypecode('abceh', default='G') +// 'G' +// +// +// +//go:linkname Mintypecode py.mintypecode +func Mintypecode(typechars *py.Object, typeset *py.Object, Default *py.Object) *py.Object +// +// Test whether each element of a 1-D array is also present in a second array. +// +// Returns a boolean array the same length as `ar1` that is True +// where an element of `ar1` is in `ar2` and False otherwise. +// +// We recommend using :func:`isin` instead of `in1d` for new code. +// +// Parameters +// ---------- +// ar1 : (M,) array_like +// Input array. +// ar2 : array_like +// The values against which to test each value of `ar1`. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted (that is, +// False where an element of `ar1` is in `ar2` and True otherwise). +// Default is False. ``np.in1d(a, b, invert=True)`` is equivalent +// to (but is faster than) ``np.invert(in1d(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// .. versionadded:: 1.8.0 +// +// Returns +// ------- +// in1d : (M,) ndarray, bool +// The values `ar1[in1d]` are in `ar2`. +// +// See Also +// -------- +// isin : Version of this function that preserves the +// shape of ar1. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// `in1d` can be considered as an element-wise function version of the +// python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly +// equivalent to ``np.array([item in b for item in a])``. +// However, this idea fails if `ar2` is a set, or similar (non-sequence) +// container: As ``ar2`` is converted to an array, in those cases +// ``asarray(ar2)`` is an object array rather than the expected array of +// contained values. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// >>> test = np.array([0, 1, 2, 5, 0]) +// >>> states = [0, 2] +// >>> mask = np.in1d(test, states) +// >>> mask +// array([ True, False, True, False, True]) +// >>> test[mask] +// array([0, 2, 0]) +// >>> mask = np.in1d(test, states, invert=True) +// >>> mask +// array([False, True, False, True, False]) +// >>> test[mask] +// array([1, 5]) +// +// +//go:linkname In1d py.in1d +func In1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// packbits(a, /, axis=None, bitorder='big') +// +// Packs the elements of a binary-valued array into bits in a uint8 array. +// +// The result is padded to full bytes by inserting zero bits at the end. +// +// Parameters +// ---------- +// a : array_like +// An array of integers or booleans whose elements should be packed to +// bits. +// axis : int, optional +// The dimension over which bit-packing is done. +// ``None`` implies packing the flattened array. +// bitorder : {'big', 'little'}, optional +// The order of the input bits. 'big' will mimic bin(val), +// ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will +// reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// packed : ndarray +// Array of type uint8 whose elements represent bits corresponding to the +// logical (0 or nonzero) value of the input elements. The shape of +// `packed` has the same number of dimensions as the input (unless `axis` +// is None, in which case the output is 1-D). +// +// See Also +// -------- +// unpackbits: Unpacks elements of a uint8 array into a binary-valued output +// array. +// +// Examples +// -------- +// >>> a = np.array([[[1,0,1], +// ... [0,1,0]], +// ... [[1,1,0], +// ... [0,0,1]]]) +// >>> b = np.packbits(a, axis=-1) +// >>> b +// array([[[160], +// [ 64]], +// [[192], +// [ 32]]], dtype=uint8) +// +// Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000, +// and 32 = 0010 0000. +// +// +// +//go:linkname Packbits py.packbits +func Packbits(a *py.Object, axis *py.Object, bitorder *py.Object) *py.Object +// asarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an array. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes lists, lists of tuples, tuples, tuples of tuples, tuples +// of lists and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'K'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array interpretation of `a`. No copy is performed if the input +// is already an ndarray with matching dtype and order. If `a` is a +// subclass of ndarray, a base class ndarray is returned. +// +// See Also +// -------- +// asanyarray : Similar function which passes through subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asarray(a) +// array([1, 2]) +// +// Existing arrays are not copied: +// +// >>> a = np.array([1, 2]) +// >>> np.asarray(a) is a +// True +// +// If `dtype` is set, array is copied only if dtype does not match: +// +// >>> a = np.array([1, 2], dtype=np.float32) +// >>> np.asarray(a, dtype=np.float32) is a +// True +// >>> np.asarray(a, dtype=np.float64) is a +// False +// +// Contrary to `asanyarray`, ndarray subclasses are not passed through: +// +// >>> issubclass(np.recarray, np.ndarray) +// True +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asarray(a) is a +// False +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asarray py.asarray +func Asarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname BitwiseNot py.bitwise_not +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object +// fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise maximum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// maxima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The maximum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmin : +// Element-wise minimum of two arrays, ignores NaNs. +// maximum : +// Element-wise maximum of two arrays, propagates NaNs. +// amax : +// The maximum value of an array along a given axis, propagates NaNs. +// nanmax : +// The maximum value of an array along a given axis, ignores NaNs. +// +// minimum, amin, nanmin +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmax is equivalent to ``np.where(x1 >= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmax([2, 3, 4], [1, 5, 2]) +// array([ 2., 5., 4.]) +// +// >>> np.fmax(np.eye(2), [0.5, 2]) +// array([[ 1. , 2. ], +// [ 0.5, 2. ]]) +// +// >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmax py.fmax +func Fmax(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the real part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The real component of the complex argument. If `val` is real, the type +// of `val` is used for the output. If `val` has complex elements, the +// returned type is float. +// +// See Also +// -------- +// real_if_close, imag, angle +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.real +// array([1., 3., 5.]) +// >>> a.real = 9 +// >>> a +// array([9.+2.j, 9.+4.j, 9.+6.j]) +// >>> a.real = np.array([9, 8, 7]) +// >>> a +// array([9.+2.j, 8.+4.j, 7.+6.j]) +// >>> np.real(1 + 1j) +// 1.0 +// +// +// +//go:linkname Real py.real +func Real(val *py.Object) *py.Object +// +// Apply a function repeatedly over multiple axes. +// +// `func` is called as `res = func(a, axis)`, where `axis` is the first +// element of `axes`. The result `res` of the function call must have +// either the same dimensions as `a` or one less dimension. If `res` +// has one less dimension than `a`, a dimension is inserted before +// `axis`. The call to `func` is then repeated for each axis in `axes`, +// with `res` as the first argument. +// +// Parameters +// ---------- +// func : function +// This function must take two arguments, `func(a, axis)`. +// a : array_like +// Input array. +// axes : array_like +// Axes over which `func` is applied; the elements must be integers. +// +// Returns +// ------- +// apply_over_axis : ndarray +// The output array. The number of dimensions is the same as `a`, +// but the shape can be different. This depends on whether `func` +// changes the shape of its output with respect to its input. +// +// See Also +// -------- +// apply_along_axis : +// Apply a function to 1-D slices of an array along the given axis. +// +// Notes +// ----- +// This function is equivalent to tuple axis arguments to reorderable ufuncs +// with keepdims=True. Tuple axis arguments to ufuncs have been available since +// version 1.7.0. +// +// Examples +// -------- +// >>> a = np.arange(24).reshape(2,3,4) +// >>> a +// array([[[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11]], +// [[12, 13, 14, 15], +// [16, 17, 18, 19], +// [20, 21, 22, 23]]]) +// +// Sum over axes 0 and 2. The result has same number of dimensions +// as the original array: +// +// >>> np.apply_over_axes(np.sum, a, [0,2]) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// Tuple axis arguments to ufuncs are equivalent: +// +// >>> np.sum(a, axis=(0,2), keepdims=True) +// array([[[ 60], +// [ 92], +// [124]]]) +// +// +// +//go:linkname ApplyOverAxes py.apply_over_axes +func ApplyOverAxes(Func *py.Object, a *py.Object, axes *py.Object) *py.Object +// +// Check if the array is Fortran contiguous but *not* C contiguous. +// +// This function is obsolete and, because of changes due to relaxed stride +// checking, its return value for the same array may differ for versions +// of NumPy >= 1.10.0 and previous versions. If you only want to check if an +// array is Fortran contiguous use ``a.flags.f_contiguous`` instead. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// +// Returns +// ------- +// isfortran : bool +// Returns True if the array is Fortran contiguous but *not* C contiguous. +// +// +// Examples +// -------- +// +// np.array allows to specify whether the array is written in C-contiguous +// order (last index varies the fastest), or FORTRAN-contiguous order in +// memory (first index varies the fastest). +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// +// >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') +// >>> b +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(b) +// True +// +// +// The transpose of a C-ordered array is a FORTRAN-ordered array. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') +// >>> a +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> np.isfortran(a) +// False +// >>> b = a.T +// >>> b +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// >>> np.isfortran(b) +// True +// +// C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. +// +// >>> np.isfortran(np.array([1, 2], order='F')) +// False +// +// +// +//go:linkname Isfortran py.isfortran +func Isfortran(a *py.Object) *py.Object +// +// Compute the outer product of two vectors. +// +// Given two vectors `a` and `b` of length ``M`` and ``N``, repsectively, +// the outer product [1]_ is:: +// +// [[a_0*b_0 a_0*b_1 ... a_0*b_{N-1} ] +// [a_1*b_0 . +// [ ... . +// [a_{M-1}*b_0 a_{M-1}*b_{N-1} ]] +// +// Parameters +// ---------- +// a : (M,) array_like +// First input vector. Input is flattened if +// not already 1-dimensional. +// b : (N,) array_like +// Second input vector. Input is flattened if +// not already 1-dimensional. +// out : (M, N) ndarray, optional +// A location where the result is stored +// +// .. versionadded:: 1.9.0 +// +// Returns +// ------- +// out : (M, N) ndarray +// ``out[i, j] = a[i] * b[j]`` +// +// See also +// -------- +// inner +// einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. +// ufunc.outer : A generalization to dimensions other than 1D and other +// operations. ``np.multiply.outer(a.ravel(), b.ravel())`` +// is the equivalent. +// tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` +// is the equivalent. +// +// References +// ---------- +// .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd +// ed., Baltimore, MD, Johns Hopkins University Press, 1996, +// pg. 8. +// +// Examples +// -------- +// Make a (*very* coarse) grid for computing a Mandelbrot set: +// +// >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) +// >>> rl +// array([[-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.], +// [-2., -1., 0., 1., 2.]]) +// >>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,))) +// >>> im +// array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j], +// [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j], +// [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], +// [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j], +// [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]]) +// >>> grid = rl + im +// >>> grid +// array([[-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j], +// [-2.+1.j, -1.+1.j, 0.+1.j, 1.+1.j, 2.+1.j], +// [-2.+0.j, -1.+0.j, 0.+0.j, 1.+0.j, 2.+0.j], +// [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], +// [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) +// +// An example using a "vector" of letters: +// +// >>> x = np.array(['a', 'b', 'c'], dtype=object) +// >>> np.outer(x, [1, 2, 3]) +// array([['a', 'aa', 'aaa'], +// ['b', 'bb', 'bbb'], +// ['c', 'cc', 'ccc']], dtype=object) +// +// +// +//go:linkname Outer py.outer +func Outer(__llgo_va_list ...interface{}) *py.Object +// ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the ceiling of the input, element-wise. +// +// The ceil of the scalar `x` is the smallest integer `i`, such that +// ``i >= x``. It is often denoted as :math:`\lceil x \rceil`. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The ceiling of each element in `x`, with `float` dtype. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// floor, trunc, rint, fix +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.ceil(a) +// array([-1., -1., -0., 1., 2., 2., 2.]) +// +//go:linkname Ceil py.ceil +func Ceil(x *py.Object, out *py.Object) *py.Object +// +// Return the angle of the complex argument. +// +// Parameters +// ---------- +// z : array_like +// A complex number or sequence of complex numbers. +// deg : bool, optional +// Return angle in degrees if True, radians if False (default). +// +// Returns +// ------- +// angle : ndarray or scalar +// The counterclockwise angle from the positive real axis on the complex +// plane in the range ``(-pi, pi]``, with dtype as numpy.float64. +// +// .. versionchanged:: 1.16.0 +// This function works on subclasses of ndarray like `ma.array`. +// +// See Also +// -------- +// arctan2 +// absolute +// +// Notes +// ----- +// Although the angle of the complex number 0 is undefined, ``numpy.angle(0)`` +// returns the value 0. +// +// Examples +// -------- +// >>> np.angle([1.0, 1.0j, 1+1j]) # in radians +// array([ 0. , 1.57079633, 0.78539816]) # may vary +// >>> np.angle(1+1j, deg=True) # in degrees +// 45.0 +// +// +// +//go:linkname Angle py.angle +func Angle(z *py.Object, deg *py.Object) *py.Object +// +// Load ASCII data from a file and return it in a record array. +// +// If ``usemask=False`` a standard `recarray` is returned, +// if ``usemask=True`` a MaskedRecords array is returned. +// +// Parameters +// ---------- +// fname, kwargs : For a description of input parameters, see `genfromtxt`. +// +// See Also +// -------- +// numpy.genfromtxt : generic function +// +// Notes +// ----- +// By default, `dtype` is None, which means that the data-type of the output +// array will be determined from the data. +// +// +// +//go:linkname Recfromtxt py.recfromtxt +func Recfromtxt(fname *py.Object) *py.Object +// +// Return a new array with the specified shape. +// +// If the new array is larger than the original array, then the new +// array is filled with repeated copies of `a`. Note that this behavior +// is different from a.resize(new_shape) which fills with zeros instead +// of repeated copies of `a`. +// +// Parameters +// ---------- +// a : array_like +// Array to be resized. +// +// new_shape : int or tuple of int +// Shape of resized array. +// +// Returns +// ------- +// reshaped_array : ndarray +// The new array is formed from the data in the old array, repeated +// if necessary to fill out the required number of elements. The +// data are repeated iterating over the array in C-order. +// +// See Also +// -------- +// numpy.reshape : Reshape an array without changing the total size. +// numpy.pad : Enlarge and pad an array. +// numpy.repeat : Repeat elements of an array. +// ndarray.resize : resize an array in-place. +// +// Notes +// ----- +// When the total size of the array does not change `~numpy.reshape` should +// be used. In most other cases either indexing (to reduce the size) +// or padding (to increase the size) may be a more appropriate solution. +// +// Warning: This functionality does **not** consider axes separately, +// i.e. it does not apply interpolation/extrapolation. +// It fills the return array with the required number of elements, iterating +// over `a` in C-order, disregarding axes (and cycling back from the start if +// the new shape is larger). This functionality is therefore not suitable to +// resize images, or data where each axis represents a separate and distinct +// entity. +// +// Examples +// -------- +// >>> a=np.array([[0,1],[2,3]]) +// >>> np.resize(a,(2,3)) +// array([[0, 1, 2], +// [3, 0, 1]]) +// >>> np.resize(a,(1,4)) +// array([[0, 1, 2, 3]]) +// >>> np.resize(a,(2,4)) +// array([[0, 1, 2, 3], +// [0, 1, 2, 3]]) +// +// +// +//go:linkname Resize py.resize +func Resize(a *py.Object, newShape *py.Object) *py.Object +// isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaT (not a time) and return result as a boolean array. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like +// Input array with datetime or timedelta data type. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaT, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isnan, isinf, isneginf, isposinf, isfinite +// +// Examples +// -------- +// >>> np.isnat(np.datetime64("NaT")) +// True +// >>> np.isnat(np.datetime64("2016-01-01")) +// False +// >>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]")) +// array([ True, False]) +// +//go:linkname Isnat py.isnat +func Isnat(x *py.Object, out *py.Object) *py.Object +// logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of x1 OR x2 element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Logical OR is applied to the elements of `x1` and `x2`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// Boolean result of the logical OR operation applied to the elements +// of `x1` and `x2`; the shape is determined by broadcasting. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and, logical_not, logical_xor +// bitwise_or +// +// Examples +// -------- +// >>> np.logical_or(True, False) +// True +// >>> np.logical_or([True, False], [False, False]) +// array([ True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_or(x < 1, x > 3) +// array([ True, False, False, False, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.logical_or`` on +// boolean ndarrays. +// +// >>> a = np.array([True, False]) +// >>> b = np.array([False, False]) +// >>> a | b +// array([ True, False]) +// +//go:linkname LogicalOr py.logical_or +func LogicalOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Trigonometric sine, element-wise. +// +// Parameters +// ---------- +// x : array_like +// Angle, in radians (:math:`2 \pi` rad equals 360 degrees). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : array_like +// The sine of each element of x. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// arcsin, sinh, cos +// +// Notes +// ----- +// The sine is one of the fundamental functions of trigonometry (the +// mathematical study of triangles). Consider a circle of radius 1 +// centered on the origin. A ray comes in from the :math:`+x` axis, makes +// an angle at the origin (measured counter-clockwise from that axis), and +// departs from the origin. The :math:`y` coordinate of the outgoing +// ray's intersection with the unit circle is the sine of that angle. It +// ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The +// function has zeroes where the angle is a multiple of :math:`\pi`. +// Sines of angles between :math:`\pi` and :math:`2\pi` are negative. +// The numerous properties of the sine and related functions are included +// in any standard trigonometry text. +// +// Examples +// -------- +// Print sine of one angle: +// +// >>> np.sin(np.pi/2.) +// 1.0 +// +// Print sines of an array of angles given in degrees: +// +// >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) +// array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) +// +// Plot the sine function: +// +// >>> import matplotlib.pylab as plt +// >>> x = np.linspace(-np.pi, np.pi, 201) +// >>> plt.plot(x, np.sin(x)) +// >>> plt.xlabel('Angle [rad]') +// >>> plt.ylabel('sin(x)') +// >>> plt.axis('tight') +// >>> plt.show() +// +//go:linkname Sin py.sin +func Sin(x *py.Object, out *py.Object) *py.Object +// +// Return the indices of the bins to which each value in input array belongs. +// +// ========= ============= ============================ +// `right` order of bins returned index `i` satisfies +// ========= ============= ============================ +// ``False`` increasing ``bins[i-1] <= x < bins[i]`` +// ``True`` increasing ``bins[i-1] < x <= bins[i]`` +// ``False`` decreasing ``bins[i-1] > x >= bins[i]`` +// ``True`` decreasing ``bins[i-1] >= x > bins[i]`` +// ========= ============= ============================ +// +// If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is +// returned as appropriate. +// +// Parameters +// ---------- +// x : array_like +// Input array to be binned. Prior to NumPy 1.10.0, this array had to +// be 1-dimensional, but can now have any shape. +// bins : array_like +// Array of bins. It has to be 1-dimensional and monotonic. +// right : bool, optional +// Indicating whether the intervals include the right or the left bin +// edge. Default behavior is (right==False) indicating that the interval +// does not include the right edge. The left bin end is open in this +// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for +// monotonically increasing bins. +// +// Returns +// ------- +// indices : ndarray of ints +// Output array of indices, of same shape as `x`. +// +// Raises +// ------ +// ValueError +// If `bins` is not monotonic. +// TypeError +// If the type of the input is complex. +// +// See Also +// -------- +// bincount, histogram, unique, searchsorted +// +// Notes +// ----- +// If values in `x` are such that they fall outside the bin range, +// attempting to index `bins` with the indices that `digitize` returns +// will result in an IndexError. +// +// .. versionadded:: 1.10.0 +// +// `np.digitize` is implemented in terms of `np.searchsorted`. This means +// that a binary search is used to bin the values, which scales much better +// for larger number of bins than the previous linear search. It also removes +// the requirement for the input array to be 1-dimensional. +// +// For monotonically _increasing_ `bins`, the following are equivalent:: +// +// np.digitize(x, bins, right=True) +// np.searchsorted(bins, x, side='left') +// +// Note that as the order of the arguments are reversed, the side must be too. +// The `searchsorted` call is marginally faster, as it does not do any +// monotonicity checks. Perhaps more importantly, it supports all dtypes. +// +// Examples +// -------- +// >>> x = np.array([0.2, 6.4, 3.0, 1.6]) +// >>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0]) +// >>> inds = np.digitize(x, bins) +// >>> inds +// array([1, 4, 3, 2]) +// >>> for n in range(x.size): +// ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]) +// ... +// 0.0 <= 0.2 < 1.0 +// 4.0 <= 6.4 < 10.0 +// 2.5 <= 3.0 < 4.0 +// 1.0 <= 1.6 < 2.5 +// +// >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.]) +// >>> bins = np.array([0, 5, 10, 15, 20]) +// >>> np.digitize(x,bins,right=True) +// array([1, 2, 3, 4, 4]) +// >>> np.digitize(x,bins,right=False) +// array([1, 3, 3, 4, 5]) +// +// +//go:linkname Digitize py.digitize +func Digitize(x *py.Object, bins *py.Object, right *py.Object) *py.Object +// +// Construct an array by repeating A the number of times given by reps. +// +// If `reps` has length ``d``, the result will have dimension of +// ``max(d, A.ndim)``. +// +// If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new +// axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, +// or shape (1, 1, 3) for 3-D replication. If this is not the desired +// behavior, promote `A` to d-dimensions manually before calling this +// function. +// +// If ``A.ndim > d``, `reps` is promoted to `A`.ndim by pre-pending 1's to it. +// Thus for an `A` of shape (2, 3, 4, 5), a `reps` of (2, 2) is treated as +// (1, 1, 2, 2). +// +// Note : Although tile may be used for broadcasting, it is strongly +// recommended to use numpy's broadcasting operations and functions. +// +// Parameters +// ---------- +// A : array_like +// The input array. +// reps : array_like +// The number of repetitions of `A` along each axis. +// +// Returns +// ------- +// c : ndarray +// The tiled output array. +// +// See Also +// -------- +// repeat : Repeat elements of an array. +// broadcast_to : Broadcast an array to a new shape +// +// Examples +// -------- +// >>> a = np.array([0, 1, 2]) +// >>> np.tile(a, 2) +// array([0, 1, 2, 0, 1, 2]) +// >>> np.tile(a, (2, 2)) +// array([[0, 1, 2, 0, 1, 2], +// [0, 1, 2, 0, 1, 2]]) +// >>> np.tile(a, (2, 1, 2)) +// array([[[0, 1, 2, 0, 1, 2]], +// [[0, 1, 2, 0, 1, 2]]]) +// +// >>> b = np.array([[1, 2], [3, 4]]) +// >>> np.tile(b, 2) +// array([[1, 2, 1, 2], +// [3, 4, 3, 4]]) +// >>> np.tile(b, (2, 1)) +// array([[1, 2], +// [3, 4], +// [1, 2], +// [3, 4]]) +// +// >>> c = np.array([1,2,3,4]) +// >>> np.tile(c,(4,1)) +// array([[1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4], +// [1, 2, 3, 4]]) +// +// +//go:linkname Tile py.tile +func Tile(A *py.Object, reps *py.Object) *py.Object +// +// Returns pointers to the end-points of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. It must conform to the Python-side of the array +// interface. +// +// Returns +// ------- +// (low, high) : tuple of 2 integers +// The first integer is the first byte of the array, the second +// integer is just past the last byte of the array. If `a` is not +// contiguous it will not use every byte between the (`low`, `high`) +// values. +// +// Examples +// -------- +// >>> I = np.eye(2, dtype='f'); I.dtype +// dtype('float32') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// >>> I = np.eye(2); I.dtype +// dtype('float64') +// >>> low, high = np.byte_bounds(I) +// >>> high - low == I.size*I.itemsize +// True +// +// +// +//go:linkname ByteBounds py.byte_bounds +func ByteBounds(a *py.Object) *py.Object +// +// Return a partitioned copy of an array. +// +// Creates a copy of the array with its elements rearranged in such a +// way that the value of the element in k-th position is in the position +// the value would be in a sorted array. In the partitioned array, all +// elements before the k-th element are less than or equal to that +// element, and all the elements after the k-th element are greater than +// or equal to that element. The ordering of the elements in the two +// partitions is undefined. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// kth : int or sequence of ints +// Element index to partition by. The k-th value of the element +// will be in its final sorted position and all smaller elements +// will be moved before it and all equal or greater elements behind +// it. The order of all elements in the partitions is undefined. If +// provided with a sequence of k-th it will partition all elements +// indexed by k-th of them into their sorted position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect'. +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string. Not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// partitioned_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.partition : Method to sort an array in-place. +// argpartition : Indirect partition. +// sort : Full sorting +// +// Notes +// ----- +// The various selection algorithms are characterized by their average +// speed, worst case performance, work space size, and whether they are +// stable. A stable sort keeps items with the same key in the same +// relative order. The available algorithms have the following +// properties: +// +// ================= ======= ============= ============ ======= +// kind speed worst case work space stable +// ================= ======= ============= ============ ======= +// 'introselect' 1 O(n) 0 no +// ================= ======= ============= ============ ======= +// +// All the partition algorithms make temporary copies of the data when +// partitioning along any but the last axis. Consequently, +// partitioning along the last axis is faster and uses less space than +// partitioning along any other axis. +// +// The sort order for complex numbers is lexicographic. If both the +// real and imaginary parts are non-nan then the order is determined by +// the real parts except when they are equal, in which case the order +// is determined by the imaginary parts. +// +// Examples +// -------- +// >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) +// >>> p = np.partition(a, 4) +// >>> p +// array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) +// +// ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal +// to ``p[4]``, and all elements in ``p[5:]`` are greater than or +// equal to ``p[4]``. The partition is:: +// +// [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] +// +// The next example shows the use of multiple values passed to `kth`. +// +// >>> p2 = np.partition(a, (4, 8)) +// >>> p2 +// array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) +// +// ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` +// are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` +// are greater than or equal to ``p2[4]`` and less than or equal to +// ``p2[8]``, and all elements in ``p2[9:]`` are greater than or +// equal to ``p2[8]``. The partition is:: +// +// [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] +// +// +//go:linkname Partition py.partition +func Partition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the complex conjugate, element-wise. +// +// The complex conjugate of a complex number is obtained by changing the +// sign of its imaginary part. +// +// Parameters +// ---------- +// x : array_like +// Input value. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The complex conjugate of `x`, with same dtype as `y`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// `conj` is an alias for `conjugate`: +// +// >>> np.conj is np.conjugate +// True +// +// Examples +// -------- +// >>> np.conjugate(1+2j) +// (1-2j) +// +// >>> x = np.eye(2) + 1j * np.eye(2) +// >>> np.conjugate(x) +// array([[ 1.-1.j, 0.-0.j], +// [ 0.-0.j, 1.-1.j]]) +// +//go:linkname Conj py.conj +func Conj(__llgo_va_list ...interface{}) *py.Object +// exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the exponential of all elements in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise exponential of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// expm1 : Calculate ``exp(x) - 1`` for all elements in the array. +// exp2 : Calculate ``2**x`` for all elements in the array. +// +// Notes +// ----- +// The irrational number ``e`` is also known as Euler's number. It is +// approximately 2.718281, and is the base of the natural logarithm, +// ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, +// then :math:`e^x = y`. For real input, ``exp(x)`` is always positive. +// +// For complex arguments, ``x = a + ib``, we can write +// :math:`e^x = e^a e^{ib}`. The first term, :math:`e^a`, is already +// known (it is the real argument, described above). The second term, +// :math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with +// magnitude 1 and a periodic phase. +// +// References +// ---------- +// .. [1] Wikipedia, "Exponential function", +// https://en.wikipedia.org/wiki/Exponential_function +// .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions +// with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, +// https://personal.math.ubc.ca/~cbm/aands/page_69.htm +// +// Examples +// -------- +// Plot the magnitude and phase of ``exp(x)`` in the complex plane: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) +// >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane +// >>> out = np.exp(xx) +// +// >>> plt.subplot(121) +// >>> plt.imshow(np.abs(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') +// >>> plt.title('Magnitude of exp(x)') +// +// >>> plt.subplot(122) +// >>> plt.imshow(np.angle(out), +// ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') +// >>> plt.title('Phase (angle) of exp(x)') +// >>> plt.show() +// +//go:linkname Exp py.exp +func Exp(x *py.Object, out *py.Object) *py.Object +// frompyfunc(func, /, nin, nout, *[, identity]) +// +// Takes an arbitrary Python function and returns a NumPy ufunc. +// +// Can be used, for example, to add broadcasting to a built-in Python +// function (see Examples section). +// +// Parameters +// ---------- +// func : Python function object +// An arbitrary Python function. +// nin : int +// The number of input arguments. +// nout : int +// The number of objects returned by `func`. +// identity : object, optional +// The value to use for the `~numpy.ufunc.identity` attribute of the resulting +// object. If specified, this is equivalent to setting the underlying +// C ``identity`` field to ``PyUFunc_IdentityValue``. +// If omitted, the identity is set to ``PyUFunc_None``. Note that this is +// _not_ equivalent to setting the identity to ``None``, which implies the +// operation is reorderable. +// +// Returns +// ------- +// out : ufunc +// Returns a NumPy universal function (``ufunc``) object. +// +// See Also +// -------- +// vectorize : Evaluates pyfunc over input arrays using broadcasting rules of numpy. +// +// Notes +// ----- +// The returned ufunc always returns PyObject arrays. +// +// Examples +// -------- +// Use frompyfunc to add broadcasting to the Python function ``oct``: +// +// >>> oct_array = np.frompyfunc(oct, 1, 1) +// >>> oct_array(np.array((10, 30, 100))) +// array(['0o12', '0o36', '0o144'], dtype=object) +// >>> np.array((oct(10), oct(30), oct(100))) # for comparison +// array(['0o12', '0o36', '0o144'], dtype='`. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// greater, less_equal, greater_equal, equal, not_equal +// +// Examples +// -------- +// >>> np.less([1, 2], [2, 2]) +// array([ True, False]) +// +// The ``<`` operator can be used as a shorthand for ``np.less`` on ndarrays. +// +// >>> a = np.array([1, 2]) +// >>> b = np.array([2, 2]) +// >>> a < b +// array([ True, False]) +// +//go:linkname Less py.less +func Less(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute tangent element-wise. +// +// Equivalent to ``np.sin(x)/np.cos(x)`` element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding tangent values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972. +// +// Examples +// -------- +// >>> from math import pi +// >>> np.tan(np.array([-pi,pi/2,pi])) +// array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) +// >>> +// >>> # Example of providing the optional output parameter illustrating +// >>> # that what is returned is a reference to said parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.cos([0.1], out1) +// >>> out2 is out1 +// True +// >>> +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Tan py.tan +func Tan(x *py.Object, out *py.Object) *py.Object +// +// Evaluate a piecewise-defined function. +// +// Given a set of conditions and corresponding functions, evaluate each +// function on the input data wherever its condition is true. +// +// Parameters +// ---------- +// x : ndarray or scalar +// The input domain. +// condlist : list of bool arrays or bool scalars +// Each boolean array corresponds to a function in `funclist`. Wherever +// `condlist[i]` is True, `funclist[i](x)` is used as the output value. +// +// Each boolean array in `condlist` selects a piece of `x`, +// and should therefore be of the same shape as `x`. +// +// The length of `condlist` must correspond to that of `funclist`. +// If one extra function is given, i.e. if +// ``len(funclist) == len(condlist) + 1``, then that extra function +// is the default value, used wherever all conditions are false. +// funclist : list of callables, f(x,*args,**kw), or scalars +// Each function is evaluated over `x` wherever its corresponding +// condition is True. It should take a 1d array as input and give an 1d +// array or a scalar value as output. If, instead of a callable, +// a scalar is provided then a constant function (``lambda x: scalar``) is +// assumed. +// args : tuple, optional +// Any further arguments given to `piecewise` are passed to the functions +// upon execution, i.e., if called ``piecewise(..., ..., 1, 'a')``, then +// each function is called as ``f(x, 1, 'a')``. +// kw : dict, optional +// Keyword arguments used in calling `piecewise` are passed to the +// functions upon execution, i.e., if called +// ``piecewise(..., ..., alpha=1)``, then each function is called as +// ``f(x, alpha=1)``. +// +// Returns +// ------- +// out : ndarray +// The output is the same shape and type as x and is found by +// calling the functions in `funclist` on the appropriate portions of `x`, +// as defined by the boolean arrays in `condlist`. Portions not covered +// by any condition have a default value of 0. +// +// +// See Also +// -------- +// choose, select, where +// +// Notes +// ----- +// This is similar to choose or select, except that functions are +// evaluated on elements of `x` that satisfy the corresponding condition from +// `condlist`. +// +// The result is:: +// +// |-- +// |funclist[0](x[condlist[0]]) +// out = |funclist[1](x[condlist[1]]) +// |... +// |funclist[n2](x[condlist[n2]]) +// |-- +// +// Examples +// -------- +// Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``. +// +// >>> x = np.linspace(-2.5, 2.5, 6) +// >>> np.piecewise(x, [x < 0, x >= 0], [-1, 1]) +// array([-1., -1., -1., 1., 1., 1.]) +// +// Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for +// ``x >= 0``. +// +// >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x]) +// array([2.5, 1.5, 0.5, 0.5, 1.5, 2.5]) +// +// Apply the same function to a scalar value. +// +// >>> y = -2 +// >>> np.piecewise(y, [y < 0, y >= 0], [lambda x: -x, lambda x: x]) +// array(2) +// +// +// +//go:linkname Piecewise py.piecewise +func Piecewise(x *py.Object, condlist *py.Object, funclist *py.Object, __llgo_va_list ...interface{}) *py.Object +// fromfile(file, dtype=float, count=-1, sep='', offset=0, *, like=None) +// +// Construct an array from data in a text or binary file. +// +// A highly efficient way of reading binary data with a known data-type, +// as well as parsing simply formatted text files. Data written using the +// `tofile` method can be read using this function. +// +// Parameters +// ---------- +// file : file or str or Path +// Open file object or filename. +// +// .. versionchanged:: 1.17.0 +// `pathlib.Path` objects are now accepted. +// +// dtype : data-type +// Data type of the returned array. +// For binary files, it is used to determine the size and byte-order +// of the items in the file. +// Most builtin numeric types are supported and extension types may be supported. +// +// .. versionadded:: 1.18.0 +// Complex dtypes. +// +// count : int +// Number of items to read. ``-1`` means all items (i.e., the complete +// file). +// sep : str +// Separator between items if file is a text file. +// Empty ("") separator means the file should be treated as binary. +// Spaces (" ") in the separator match zero or more whitespace characters. +// A separator consisting only of spaces must match at least one +// whitespace. +// offset : int +// The offset (in bytes) from the file's current position. Defaults to 0. +// Only permitted for binary files. +// +// .. versionadded:: 1.17.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// See also +// -------- +// load, save +// ndarray.tofile +// loadtxt : More flexible way of loading data from a text file. +// +// Notes +// ----- +// Do not rely on the combination of `tofile` and `fromfile` for +// data storage, as the binary files generated are not platform +// independent. In particular, no byte-order or data-type information is +// saved. Data can be stored in the platform independent ``.npy`` format +// using `save` and `load` instead. +// +// Examples +// -------- +// Construct an ndarray: +// +// >>> dt = np.dtype([('time', [('min', np.int64), ('sec', np.int64)]), +// ... ('temp', float)]) +// >>> x = np.zeros((1,), dtype=dt) +// >>> x['time']['min'] = 10; x['temp'] = 98.25 +// >>> x +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> import tempfile +// >>> fname = tempfile.mkstemp()[1] +// >>> x.tofile(fname) +// +// Read the raw data from disk: +// +// >>> np.fromfile(fname, dtype=dt) +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> np.save(fname, x) +// >>> np.load(fname + '.npy') +// array([((10, 0), 98.25)], +// dtype=[('time', [('min', '>> a = np.arange(60.).reshape(3,4,5) +// >>> b = np.arange(24.).reshape(4,3,2) +// >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) +// >>> c.shape +// (5, 2) +// >>> c +// array([[4400., 4730.], +// [4532., 4874.], +// [4664., 5018.], +// [4796., 5162.], +// [4928., 5306.]]) +// >>> # A slower but equivalent way of computing the same... +// >>> d = np.zeros((5,2)) +// >>> for i in range(5): +// ... for j in range(2): +// ... for k in range(3): +// ... for n in range(4): +// ... d[i,j] += a[k,n,i] * b[n,k,j] +// >>> c == d +// array([[ True, True], +// [ True, True], +// [ True, True], +// [ True, True], +// [ True, True]]) +// +// An extended example taking advantage of the overloading of + and \*: +// +// >>> a = np.array(range(1, 9)) +// >>> a.shape = (2, 2, 2) +// >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) +// >>> A.shape = (2, 2) +// >>> a; A +// array([[[1, 2], +// [3, 4]], +// [[5, 6], +// [7, 8]]]) +// array([['a', 'b'], +// ['c', 'd']], dtype=object) +// +// >>> np.tensordot(a, A) # third argument default is 2 for double-contraction +// array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, 1) +// array([[['acc', 'bdd'], +// ['aaacccc', 'bbbdddd']], +// [['aaaaacccccc', 'bbbbbdddddd'], +// ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) +// array([[[[['a', 'b'], +// ['c', 'd']], +// ... +// +// >>> np.tensordot(a, A, (0, 1)) +// array([[['abbbbb', 'cddddd'], +// ['aabbbbbb', 'ccdddddd']], +// [['aaabbbbbbb', 'cccddddddd'], +// ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, (2, 1)) +// array([[['abb', 'cdd'], +// ['aaabbbb', 'cccdddd']], +// [['aaaaabbbbbb', 'cccccdddddd'], +// ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object) +// +// >>> np.tensordot(a, A, ((0, 1), (0, 1))) +// array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object) +// +// >>> np.tensordot(a, A, ((2, 1), (1, 0))) +// array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object) +// +// +// +//go:linkname Tensordot py.tensordot +func Tensordot(a *py.Object, b *py.Object, axes *py.Object) *py.Object +// +// Perform an indirect partition along the given axis using the +// algorithm specified by the `kind` keyword. It returns an array of +// indices of the same shape as `a` that index data along the given +// axis in partitioned order. +// +// .. versionadded:: 1.8.0 +// +// Parameters +// ---------- +// a : array_like +// Array to sort. +// kth : int or sequence of ints +// Element index to partition by. The k-th element will be in its +// final sorted position and all smaller elements will be moved +// before it and all larger elements behind it. The order of all +// elements in the partitions is undefined. If provided with a +// sequence of k-th it will partition all of them into their sorted +// position at once. +// +// .. deprecated:: 1.22.0 +// Passing booleans as index is deprecated. +// axis : int or None, optional +// Axis along which to sort. The default is -1 (the last axis). If +// None, the flattened array is used. +// kind : {'introselect'}, optional +// Selection algorithm. Default is 'introselect' +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument +// specifies which fields to compare first, second, etc. A single +// field can be specified as a string, and not all fields need be +// specified, but unspecified fields will still be used, in the +// order in which they come up in the dtype, to break ties. +// +// Returns +// ------- +// index_array : ndarray, int +// Array of indices that partition `a` along the specified axis. +// If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. +// More generally, ``np.take_along_axis(a, index_array, axis=axis)`` +// always yields the partitioned `a`, irrespective of dimensionality. +// +// See Also +// -------- +// partition : Describes partition algorithms used. +// ndarray.partition : Inplace partition. +// argsort : Full indirect sort. +// take_along_axis : Apply ``index_array`` from argpartition +// to an array as if by calling partition. +// +// Notes +// ----- +// See `partition` for notes on the different selection algorithms. +// +// Examples +// -------- +// One dimensional array: +// +// >>> x = np.array([3, 4, 2, 1]) +// >>> x[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// >>> x[np.argpartition(x, (1, 3))] +// array([1, 2, 3, 4]) +// +// >>> x = [3, 4, 2, 1] +// >>> np.array(x)[np.argpartition(x, 3)] +// array([2, 1, 3, 4]) +// +// Multi-dimensional array: +// +// >>> x = np.array([[3, 4, 2], [1, 3, 1]]) +// >>> index_array = np.argpartition(x, kth=1, axis=-1) +// >>> np.take_along_axis(x, index_array, axis=-1) # same as np.partition(x, kth=1) +// array([[2, 3, 4], +// [1, 1, 3]]) +// +// +// +//go:linkname Argpartition py.argpartition +func Argpartition(a *py.Object, kth *py.Object, axis *py.Object, kind *py.Object, order *py.Object) *py.Object +// floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the largest integer smaller or equal to the division of the inputs. +// It is equivalent to the Python ``//`` operator and pairs with the +// Python ``%`` (`remainder`), function so that ``a = a % b + b * (a // b)`` +// up to roundoff. +// +// Parameters +// ---------- +// x1 : array_like +// Numerator. +// x2 : array_like +// Denominator. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// y = floor(`x1`/`x2`) +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// remainder : Remainder complementary to floor_divide. +// divmod : Simultaneous floor division and remainder. +// divide : Standard division. +// floor : Round a number to the nearest integer toward minus infinity. +// ceil : Round a number to the nearest integer toward infinity. +// +// Examples +// -------- +// >>> np.floor_divide(7,3) +// 2 +// >>> np.floor_divide([1., 2., 3., 4.], 2.5) +// array([ 0., 0., 1., 1.]) +// +// The ``//`` operator can be used as a shorthand for ``np.floor_divide`` +// on ndarrays. +// +// >>> x1 = np.array([1., 2., 3., 4.]) +// >>> x1 // 2.5 +// array([0., 0., 1., 1.]) +// +//go:linkname FloorDivide py.floor_divide +func FloorDivide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for NaN and return result as a boolean array. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or bool +// True where ``x`` is NaN, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isinf, isneginf, isposinf, isfinite, isnat +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). This means that Not a Number is not equivalent to infinity. +// +// Examples +// -------- +// >>> np.isnan(np.nan) +// True +// >>> np.isnan(np.inf) +// False +// >>> np.isnan([np.log(-1.),1.,np.log(0)]) +// array([ True, False, False]) +// +//go:linkname Isnan py.isnan +func Isnan(x *py.Object, out *py.Object) *py.Object +// logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Logarithm of the sum of exponentiations of the inputs. +// +// Calculates ``log(exp(x1) + exp(x2))``. This function is useful in +// statistics where the calculated probabilities of events may be so small +// as to exceed the range of normal floating point numbers. In such cases +// the logarithm of the calculated probability is stored. This function +// allows adding probabilities stored in such a fashion. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray +// Logarithm of ``exp(x1) + exp(x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2. +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> prob1 = np.log(1e-50) +// >>> prob2 = np.log(2.5e-50) +// >>> prob12 = np.logaddexp(prob1, prob2) +// >>> prob12 +// -113.87649168120691 +// >>> np.exp(prob12) +// 3.5000000000000057e-50 +// +//go:linkname Logaddexp py.logaddexp +func Logaddexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// add_docstring(obj, docstring) +// +// Add a docstring to a built-in obj if possible. +// If the obj already has a docstring raise a RuntimeError +// If this routine does not know how to add a docstring to the object +// raise a TypeError +// +//go:linkname AddDocstring py.add_docstring +func AddDocstring(obj *py.Object, docstring *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname RowStack py.row_stack +func RowStack(tup *py.Object) *py.Object +// from_dlpack(x, /) +// +// Create a NumPy array from an object implementing the ``__dlpack__`` +// protocol. Generally, the returned NumPy array is a read-only view +// of the input object. See [1]_ and [2]_ for more details. +// +// Parameters +// ---------- +// x : object +// A Python object that implements the ``__dlpack__`` and +// ``__dlpack_device__`` methods. +// +// Returns +// ------- +// out : ndarray +// +// References +// ---------- +// .. [1] Array API documentation, +// https://data-apis.org/array-api/latest/design_topics/data_interchange.html#syntax-for-data-interchange-with-dlpack +// +// .. [2] Python specification for DLPack, +// https://dmlc.github.io/dlpack/latest/python_spec.html +// +// Examples +// -------- +// >>> import torch +// >>> x = torch.arange(10) +// >>> # create a view of the torch tensor "x" in NumPy +// >>> y = np.from_dlpack(x) +// +//go:linkname FromDlpack py.from_dlpack +func FromDlpack(x *py.Object) *py.Object +// degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from radians to degrees. +// +// Parameters +// ---------- +// x : array_like +// Input array in radians. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray of floats +// The corresponding degree values; if `out` was supplied this is a +// reference to it. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// rad2deg : equivalent function +// +// Examples +// -------- +// Convert a radian array to degrees +// +// >>> rad = np.arange(12.)*np.pi/6 +// >>> np.degrees(rad) +// array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., +// 270., 300., 330.]) +// +// >>> out = np.zeros((rad.shape)) +// >>> r = np.degrees(rad, out) +// >>> np.all(r == out) +// True +// +//go:linkname Degrees py.degrees +func Degrees(x *py.Object, out *py.Object) *py.Object +// sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns an element-wise indication of the sign of a number. +// +// The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. nan +// is returned for nan inputs. +// +// For complex inputs, the `sign` function returns +// ``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``. +// +// complex(nan, 0) is returned for complex nan inputs. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The sign of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// There is more than one definition of sign in common use for complex +// numbers. The definition used here is equivalent to :math:`x/\sqrt{x*x}` +// which is different from a common alternative, :math:`x/|x|`. +// +// Examples +// -------- +// >>> np.sign([-5., 4.5]) +// array([-1., 1.]) +// >>> np.sign(0) +// 0 +// >>> np.sign(5-2j) +// (1+0j) +// +//go:linkname Sign py.sign +func Sign(x *py.Object, out *py.Object) *py.Object +// +// Get the current way of handling floating-point errors. +// +// Returns +// ------- +// res : dict +// A dictionary with keys "divide", "over", "under", and "invalid", +// whose values are from the strings "ignore", "print", "log", "warn", +// "raise", and "call". The keys represent possible floating-point +// exceptions, and the values define how these exceptions are handled. +// +// See Also +// -------- +// geterrcall, seterr, seterrcall +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterr() +// {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// >>> oldsettings = np.seterr(all='warn', over='raise') +// >>> np.geterr() +// {'divide': 'warn', 'over': 'raise', 'under': 'warn', 'invalid': 'warn'} +// >>> np.arange(3.) / np.arange(3.) +// array([nan, 1., 1.]) +// +// +// +//go:linkname Geterr py.geterr +func Geterr() *py.Object +// +// Append values to the end of an array. +// +// Parameters +// ---------- +// arr : array_like +// Values are appended to a copy of this array. +// values : array_like +// These values are appended to a copy of `arr`. It must be of the +// correct shape (the same shape as `arr`, excluding `axis`). If +// `axis` is not specified, `values` can be any shape and will be +// flattened before use. +// axis : int, optional +// The axis along which `values` are appended. If `axis` is not +// given, both `arr` and `values` are flattened before use. +// +// Returns +// ------- +// append : ndarray +// A copy of `arr` with `values` appended to `axis`. Note that +// `append` does not occur in-place: a new array is allocated and +// filled. If `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// insert : Insert elements into an array. +// delete : Delete elements from an array. +// +// Examples +// -------- +// >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) +// array([1, 2, 3, ..., 7, 8, 9]) +// +// When `axis` is specified, `values` must have the correct shape. +// +// >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) +// array([[1, 2, 3], +// [4, 5, 6], +// [7, 8, 9]]) +// >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) +// Traceback (most recent call last): +// ... +// ValueError: all the input arrays must have same number of dimensions, but +// the array at index 0 has 2 dimension(s) and the array at index 1 has 1 +// dimension(s) +// +// +// +//go:linkname Append py.append +func Append(arr *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// Return the directory that contains the NumPy \*.h header files. +// +// Extension modules that need to compile against NumPy should use this +// function to locate the appropriate include directory. +// +// Notes +// ----- +// When using ``distutils``, for example in ``setup.py``:: +// +// import numpy as np +// ... +// Extension('extension_name', ... +// include_dirs=[np.get_include()]) +// ... +// +// +// +//go:linkname GetInclude py.get_include +func GetInclude() *py.Object +// Save several arrays into a single file in uncompressed ``.npz`` format. +// +// Provide arrays as keyword arguments to store them under the +// corresponding name in the output file: ``savez(fn, x=x, y=y)``. +// +// If arrays are specified as positional arguments, i.e., ``savez(fn, +// x, y)``, their names will be `arr_0`, `arr_1`, etc. +// +// Parameters +// ---------- +// file : str or file +// Either the filename (string) or an open file (file-like object) +// where the data will be saved. If file is a string or a Path, the +// ``.npz`` extension will be appended to the filename if it is not +// already there. +// args : Arguments, optional +// Arrays to save to the file. Please use keyword arguments (see +// `kwds` below) to assign names to arrays. Arrays specified as +// args will be named "arr_0", "arr_1", and so on. +// kwds : Keyword arguments, optional +// Arrays to save to the file. Each array will be saved to the +// output file with its corresponding keyword name. +// +// Returns +// ------- +// None +// +// See Also +// -------- +// save : Save a single array to a binary file in NumPy format. +// savetxt : Save an array to a file as plain text. +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// The ``.npz`` file format is a zipped archive of files named after the +// variables they contain. The archive is not compressed and each file +// in the archive contains one variable in ``.npy`` format. For a +// description of the ``.npy`` format, see :py:mod:`numpy.lib.format`. +// +// When opening the saved ``.npz`` file with `load` a `NpzFile` object is +// returned. This is a dictionary-like object which can be queried for +// its list of arrays (with the ``.files`` attribute), and for the arrays +// themselves. +// +// Keys passed in `kwds` are used as filenames inside the ZIP archive. +// Therefore, keys should be valid filenames; e.g., avoid keys that begin with +// ``/`` or contain ``.``. +// +// When naming variables with keyword arguments, it is not possible to name a +// variable ``file``, as this would cause the ``file`` argument to be defined +// twice in the call to ``savez``. +// +// Examples +// -------- +// >>> from tempfile import TemporaryFile +// >>> outfile = TemporaryFile() +// >>> x = np.arange(10) +// >>> y = np.sin(x) +// +// Using `savez` with \*args, the arrays are saved with default names. +// +// >>> np.savez(outfile, x, y) +// >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file +// >>> npzfile = np.load(outfile) +// >>> npzfile.files +// ['arr_0', 'arr_1'] +// >>> npzfile['arr_0'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// Using `savez` with \**kwds, the arrays are saved with the keyword names. +// +// >>> outfile = TemporaryFile() +// >>> np.savez(outfile, x=x, y=y) +// >>> _ = outfile.seek(0) +// >>> npzfile = np.load(outfile) +// >>> sorted(npzfile.files) +// ['x', 'y'] +// >>> npzfile['x'] +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// +// +//go:linkname Savez py.savez +func Savez(file *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Construct an array from a text file, using regular expression parsing. +// +// The returned array is always a structured array, and is constructed from +// all matches of the regular expression in the file. Groups in the regular +// expression are converted to fields of the structured array. +// +// Parameters +// ---------- +// file : path or file +// Filename or file object to read. +// +// .. versionchanged:: 1.22.0 +// Now accepts `os.PathLike` implementations. +// regexp : str or regexp +// Regular expression used to parse the file. +// Groups in the regular expression correspond to fields in the dtype. +// dtype : dtype or list of dtypes +// Dtype for the structured array; must be a structured datatype. +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// output : ndarray +// The output array, containing the part of the content of `file` that +// was matched by `regexp`. `output` is always a structured array. +// +// Raises +// ------ +// TypeError +// When `dtype` is not a valid dtype for a structured array. +// +// See Also +// -------- +// fromstring, loadtxt +// +// Notes +// ----- +// Dtypes for structured arrays can be specified in several forms, but all +// forms specify at least the data type and field name. For details see +// `basics.rec`. +// +// Examples +// -------- +// >>> from io import StringIO +// >>> text = StringIO("1312 foo\n1534 bar\n444 qux") +// +// >>> regexp = r"(\d+)\s+(...)" # match [digits, whitespace, anything] +// >>> output = np.fromregex(text, regexp, +// ... [('num', np.int64), ('key', 'S3')]) +// >>> output +// array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')], +// dtype=[('num', '>> output['num'] +// array([1312, 1534, 444]) +// +// +// +//go:linkname Fromregex py.fromregex +func Fromregex(__llgo_va_list ...interface{}) *py.Object +// +// Range of values (maximum - minimum) along an axis. +// +// The name of the function comes from the acronym for 'peak to peak'. +// +// .. warning:: +// `ptp` preserves the data type of the array. This means the +// return value for an input of signed integers with n bits +// (e.g. `np.int8`, `np.int16`, etc) is also a signed integer +// with n bits. In that case, peak-to-peak values greater than +// ``2**(n-1)-1`` will be returned as negative values. An example +// with a work-around is shown below. +// +// Parameters +// ---------- +// a : array_like +// Input values. +// axis : None or int or tuple of ints, optional +// Axis along which to find the peaks. By default, flatten the +// array. `axis` may be negative, in +// which case it counts from the last to the first axis. +// +// .. versionadded:: 1.15.0 +// +// If this is a tuple of ints, a reduction is performed on multiple +// axes, instead of a single axis or all the axes as before. +// out : array_like +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type of the output values will be cast if necessary. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `ptp` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// Returns +// ------- +// ptp : ndarray or scalar +// The range of a given array - `scalar` if array is one-dimensional +// or a new array holding the result along the given axis +// +// Examples +// -------- +// >>> x = np.array([[4, 9, 2, 10], +// ... [6, 9, 7, 12]]) +// +// >>> np.ptp(x, axis=1) +// array([8, 6]) +// +// >>> np.ptp(x, axis=0) +// array([2, 0, 5, 2]) +// +// >>> np.ptp(x) +// 10 +// +// This example shows that a negative value can be returned when +// the input is an array of signed integers. +// +// >>> y = np.array([[1, 127], +// ... [0, 127], +// ... [-1, 127], +// ... [-2, 127]], dtype=np.int8) +// >>> np.ptp(y, axis=1) +// array([ 126, 127, -128, -127], dtype=int8) +// +// A work-around is to use the `view()` method to view the result as +// unsigned integers with the same bit width: +// +// >>> np.ptp(y, axis=1).view(np.uint8) +// array([126, 127, 128, 129], dtype=uint8) +// +// +// +//go:linkname Ptp py.ptp +func Ptp(a *py.Object, axis *py.Object, out *py.Object, keepdims *py.Object) *py.Object +// trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the truncated value of the input, element-wise. +// +// The truncated value of the scalar `x` is the nearest integer `i` which +// is closer to zero than `x` is. In short, the fractional part of the +// signed number `x` is discarded. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The truncated value of each element in `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// ceil, floor, rint, fix +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// Examples +// -------- +// >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) +// >>> np.trunc(a) +// array([-1., -1., -0., 0., 1., 1., 2.]) +// +//go:linkname Trunc py.trunc +func Trunc(x *py.Object, out *py.Object) *py.Object +// +// Return the string representation of a scalar dtype. +// +// Parameters +// ---------- +// sctype : scalar dtype or object +// If a scalar dtype, the corresponding string character is +// returned. If an object, `sctype2char` tries to infer its scalar type +// and then return the corresponding string character. +// +// Returns +// ------- +// typechar : str +// The string character corresponding to the scalar type. +// +// Raises +// ------ +// ValueError +// If `sctype` is an object for which the type can not be inferred. +// +// See Also +// -------- +// obj2sctype, issctype, issubsctype, mintypecode +// +// Examples +// -------- +// >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: +// ... print(np.sctype2char(sctype)) +// l # may vary +// d +// D +// S +// O +// +// >>> x = np.array([1., 2-1.j]) +// >>> np.sctype2char(x) +// 'D' +// >>> np.sctype2char(list) +// 'O' +// +// +// +//go:linkname Sctype2char py.sctype2char +func Sctype2char(sctype *py.Object) *py.Object +// +// Return numbers spaced evenly on a log scale (a geometric progression). +// +// This is similar to `logspace`, but with endpoints specified directly. +// Each output sample is a constant multiple of the previous. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The final value of the sequence, unless `endpoint` is False. +// In that case, ``num + 1`` values are spaced over the +// interval in log-space, of which all but the last (a sequence of +// length `num`) are returned. +// num : integer, optional +// Number of samples to generate. Default is 50. +// endpoint : boolean, optional +// If true, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// dtype : dtype +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// `num` samples, equally spaced on a log scale. +// +// See Also +// -------- +// logspace : Similar to geomspace, but with endpoints specified using log +// and base. +// linspace : Similar to geomspace, but with arithmetic instead of geometric +// progression. +// arange : Similar to linspace, with the step size specified instead of the +// number of samples. +// :ref:`how-to-partition` +// +// Notes +// ----- +// If the inputs or dtype are complex, the output will follow a logarithmic +// spiral in the complex plane. (There are an infinite number of spirals +// passing through two points; the output will follow the shortest such path.) +// +// Examples +// -------- +// >>> np.geomspace(1, 1000, num=4) +// array([ 1., 10., 100., 1000.]) +// >>> np.geomspace(1, 1000, num=3, endpoint=False) +// array([ 1., 10., 100.]) +// >>> np.geomspace(1, 1000, num=4, endpoint=False) +// array([ 1. , 5.62341325, 31.6227766 , 177.827941 ]) +// >>> np.geomspace(1, 256, num=9) +// array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) +// +// Note that the above may not produce exact integers: +// +// >>> np.geomspace(1, 256, num=9, dtype=int) +// array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) +// >>> np.around(np.geomspace(1, 256, num=9)).astype(int) +// array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) +// +// Negative, decreasing, and complex inputs are allowed: +// +// >>> np.geomspace(1000, 1, num=4) +// array([1000., 100., 10., 1.]) +// >>> np.geomspace(-1000, -1, num=4) +// array([-1000., -100., -10., -1.]) +// >>> np.geomspace(1j, 1000j, num=4) # Straight line +// array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j]) +// >>> np.geomspace(-1+0j, 1+0j, num=5) # Circle +// array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j, +// 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, +// 1.00000000e+00+0.00000000e+00j]) +// +// Graphical illustration of `endpoint` parameter: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 10 +// >>> y = np.zeros(N) +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o') +// [] +// >>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o') +// [] +// >>> plt.axis([0.5, 2000, 0, 3]) +// [0.5, 2000, 0, 3] +// >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') +// >>> plt.show() +// +// +// +//go:linkname Geomspace py.geomspace +func Geomspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Stack arrays in sequence vertically (row wise). +// +// This is equivalent to concatenation along the first axis after 1-D arrays +// of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by +// `vsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// ``np.row_stack`` is an alias for `vstack`. They are the same function. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the first axis. +// 1-D arrays must have the same length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays, will be at least 2-D. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// hstack : Stack arrays in sequence horizontally (column wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// vsplit : Split an array into multiple sub-arrays vertically (row-wise). +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3]) +// >>> b = np.array([4, 5, 6]) +// >>> np.vstack((a,b)) +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// >>> a = np.array([[1], [2], [3]]) +// >>> b = np.array([[4], [5], [6]]) +// >>> np.vstack((a,b)) +// array([[1], +// [2], +// [3], +// [4], +// [5], +// [6]]) +// +// +// +//go:linkname Vstack py.vstack +func Vstack(tup *py.Object) *py.Object +// +// Returns a bool array, where True if input element is real. +// +// If element has complex type with zero complex part, the return value +// for that element is True. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray, bool +// Boolean array of same shape as `x`. +// +// Notes +// ----- +// `isreal` may behave unexpectedly for string or object arrays (see examples) +// +// See Also +// -------- +// iscomplex +// isrealobj : Return True if x is not a complex type. +// +// Examples +// -------- +// >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) +// >>> np.isreal(a) +// array([False, True, True, True, True, False]) +// +// The function does not work on string arrays. +// +// >>> a = np.array([2j, "a"], dtype="U") +// >>> np.isreal(a) # Warns about non-elementwise comparison +// False +// +// Returns True for all elements in input array of ``dtype=object`` even if +// any of the elements is complex. +// +// >>> a = np.array([1, "2", 3+4j], dtype=object) +// >>> np.isreal(a) +// array([ True, True, True]) +// +// isreal should not be used with object arrays +// +// >>> a = np.array([1+2j, 2+1j], dtype=object) +// >>> np.isreal(a) +// array([ True, True]) +// +// +// +//go:linkname Isreal py.isreal +func Isreal(x *py.Object) *py.Object +// add_ufunc_docstring(ufunc, new_docstring) +// +// Replace the docstring for a ufunc with new_docstring. +// This method will only work if the current docstring for +// the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) +// +// Parameters +// ---------- +// ufunc : numpy.ufunc +// A ufunc whose current doc is NULL. +// new_docstring : string +// The new docstring for the ufunc. +// +// Notes +// ----- +// This method allocates memory for new_docstring on +// the heap. Technically this creates a mempory leak, since this +// memory will not be reclaimed until the end of the program +// even if the ufunc itself is removed. However this will only +// be a problem if the user is repeatedly creating ufuncs with +// no documentation, adding documentation via add_newdoc_ufunc, +// and then throwing away the ufunc. +// +//go:linkname AddNewdocUfunc py.add_newdoc_ufunc +func AddNewdocUfunc(__llgo_va_list ...interface{}) *py.Object +// +// Build a matrix object from a string, nested sequence, or array. +// +// Parameters +// ---------- +// obj : str or array_like +// Input data. If a string, variables in the current scope may be +// referenced by name. +// ldict : dict, optional +// A dictionary that replaces local operands in current frame. +// Ignored if `obj` is not a string or `gdict` is None. +// gdict : dict, optional +// A dictionary that replaces global operands in current frame. +// Ignored if `obj` is not a string. +// +// Returns +// ------- +// out : matrix +// Returns a matrix object, which is a specialized 2-D array. +// +// See Also +// -------- +// block : +// A generalization of this function for N-d arrays, that returns normal +// ndarrays. +// +// Examples +// -------- +// >>> A = np.mat('1 1; 1 1') +// >>> B = np.mat('2 2; 2 2') +// >>> C = np.mat('3 4; 5 6') +// >>> D = np.mat('7 8; 9 0') +// +// All the following expressions construct the same block matrix: +// +// >>> np.bmat([[A, B], [C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// >>> np.bmat('A,B; C,D') +// matrix([[1, 1, 2, 2], +// [1, 1, 2, 2], +// [3, 4, 7, 8], +// [5, 6, 9, 0]]) +// +// +// +//go:linkname Bmat py.bmat +func Bmat(obj *py.Object, ldict *py.Object, gdict *py.Object) *py.Object +// frombuffer(buffer, dtype=float, count=-1, offset=0, *, like=None) +// +// Interpret a buffer as a 1-dimensional array. +// +// Parameters +// ---------- +// buffer : buffer_like +// An object that exposes the buffer interface. +// dtype : data-type, optional +// Data-type of the returned array; default: float. +// count : int, optional +// Number of items to read. ``-1`` means all data in the buffer. +// offset : int, optional +// Start reading the buffer from this offset (in bytes); default: 0. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// +// See also +// -------- +// ndarray.tobytes +// Inverse of this operation, construct Python bytes from the raw data +// bytes in the array. +// +// Notes +// ----- +// If the buffer has data that is not in machine byte-order, this should +// be specified as part of the data-type, e.g.:: +// +// >>> dt = np.dtype(int) +// >>> dt = dt.newbyteorder('>') +// >>> np.frombuffer(buf, dtype=dt) # doctest: +SKIP +// +// The data of the resulting array will not be byteswapped, but will be +// interpreted correctly. +// +// This function creates a view into the original object. This should be safe +// in general, but it may make sense to copy the result when the original +// object is mutable or untrusted. +// +// Examples +// -------- +// >>> s = b'hello world' +// >>> np.frombuffer(s, dtype='S1', count=5, offset=6) +// array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1') +// +// >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) +// array([1, 2], dtype=uint8) +// >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) +// array([1, 2, 3], dtype=uint8) +// +//go:linkname Frombuffer py.frombuffer +func Frombuffer(buffer *py.Object, dtype *py.Object, count *py.Object, offset *py.Object) *py.Object +// +// Return the cumulative product of elements along a given axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// cumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case a reference to out is returned. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// Arithmetic is modular when using integer types, and no error is +// raised on overflow. +// +// Examples +// -------- +// >>> a = np.array([1,2,3]) +// >>> np.cumprod(a) # intermediate results 1, 1*2 +// ... # total product 1*2*3 = 6 +// array([1, 2, 6]) +// >>> a = np.array([[1, 2, 3], [4, 5, 6]]) +// >>> np.cumprod(a, dtype=float) # specify type of output +// array([ 1., 2., 6., 24., 120., 720.]) +// +// The cumulative product for each column (i.e., over the rows) of `a`: +// +// >>> np.cumprod(a, axis=0) +// array([[ 1, 2, 3], +// [ 4, 10, 18]]) +// +// The cumulative product for each row (i.e. over the columns) of `a`: +// +// >>> np.cumprod(a,axis=1) +// array([[ 1, 2, 6], +// [ 4, 20, 120]]) +// +// +// +//go:linkname Cumprod py.cumprod +func Cumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// +// Return the cross product of two (arrays of) vectors. +// +// The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular +// to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors +// are defined by the last axis of `a` and `b` by default, and these axes +// can have dimensions 2 or 3. Where the dimension of either `a` or `b` is +// 2, the third component of the input vector is assumed to be zero and the +// cross product calculated accordingly. In cases where both input vectors +// have dimension 2, the z-component of the cross product is returned. +// +// Parameters +// ---------- +// a : array_like +// Components of the first vector(s). +// b : array_like +// Components of the second vector(s). +// axisa : int, optional +// Axis of `a` that defines the vector(s). By default, the last axis. +// axisb : int, optional +// Axis of `b` that defines the vector(s). By default, the last axis. +// axisc : int, optional +// Axis of `c` containing the cross product vector(s). Ignored if +// both input vectors have dimension 2, as the return is scalar. +// By default, the last axis. +// axis : int, optional +// If defined, the axis of `a`, `b` and `c` that defines the vector(s) +// and cross product(s). Overrides `axisa`, `axisb` and `axisc`. +// +// Returns +// ------- +// c : ndarray +// Vector cross product(s). +// +// Raises +// ------ +// ValueError +// When the dimension of the vector(s) in `a` and/or `b` does not +// equal 2 or 3. +// +// See Also +// -------- +// inner : Inner product +// outer : Outer product. +// ix_ : Construct index arrays. +// +// Notes +// ----- +// .. versionadded:: 1.9.0 +// +// Supports full broadcasting of the inputs. +// +// Examples +// -------- +// Vector cross-product. +// +// >>> x = [1, 2, 3] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([-3, 6, -3]) +// +// One vector with dimension 2. +// +// >>> x = [1, 2] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Equivalently: +// +// >>> x = [1, 2, 0] +// >>> y = [4, 5, 6] +// >>> np.cross(x, y) +// array([12, -6, -3]) +// +// Both vectors with dimension 2. +// +// >>> x = [1,2] +// >>> y = [4,5] +// >>> np.cross(x, y) +// array(-3) +// +// Multiple vector cross-products. Note that the direction of the cross +// product vector is defined by the *right-hand rule*. +// +// >>> x = np.array([[1,2,3], [4,5,6]]) +// >>> y = np.array([[4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[-3, 6, -3], +// [ 3, -6, 3]]) +// +// The orientation of `c` can be changed using the `axisc` keyword. +// +// >>> np.cross(x, y, axisc=0) +// array([[-3, 3], +// [ 6, -6], +// [-3, 3]]) +// +// Change the vector definition of `x` and `y` using `axisa` and `axisb`. +// +// >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) +// >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) +// >>> np.cross(x, y) +// array([[ -6, 12, -6], +// [ 0, 0, 0], +// [ 6, -12, 6]]) +// >>> np.cross(x, y, axisa=0, axisb=0) +// array([[-24, 48, -24], +// [-30, 60, -30], +// [-36, 72, -36]]) +// +// +// +//go:linkname Cross py.cross +func Cross(a *py.Object, b *py.Object, axisa *py.Object, axisb *py.Object, axisc *py.Object, axis *py.Object) *py.Object +//go:linkname Arccosh py.arccosh +func Arccosh(__llgo_va_list ...interface{}) *py.Object +// bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise OR of two arrays element-wise. +// +// Computes the bit-wise OR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``|``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_or +// bitwise_and +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 has the binary representation ``00001101``. Likewise, +// 16 is represented by ``00010000``. The bit-wise OR of 13 and 16 is +// then ``00011101``, or 29: +// +// >>> np.bitwise_or(13, 16) +// 29 +// >>> np.binary_repr(29) +// '11101' +// +// >>> np.bitwise_or(32, 2) +// 34 +// >>> np.bitwise_or([33, 4], 1) +// array([33, 5]) +// >>> np.bitwise_or([33, 4], [1, 2]) +// array([33, 6]) +// +// >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4])) +// array([ 6, 5, 255]) +// >>> np.array([2, 5, 255]) | np.array([4, 4, 4]) +// array([ 6, 5, 255]) +// >>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32), +// ... np.array([4, 4, 4, 2147483647], dtype=np.int32)) +// array([ 6, 5, 255, 2147483647]) +// >>> np.bitwise_or([True, True], [False, True]) +// array([ True, True]) +// +// The ``|`` operator can be used as a shorthand for ``np.bitwise_or`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([4, 4, 4]) +// >>> x1 | x2 +// array([ 6, 5, 255]) +// +//go:linkname BitwiseOr py.bitwise_or +func BitwiseOr(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Change the sign of x1 to that of x2, element-wise. +// +// If `x2` is a scalar, its sign will be copied to all elements of `x1`. +// +// Parameters +// ---------- +// x1 : array_like +// Values to change the sign of. +// x2 : array_like +// The sign of `x2` is copied to `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The values of `x1` with the sign of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> np.copysign(1.3, -1) +// -1.3 +// >>> 1/np.copysign(0, 1) +// inf +// >>> 1/np.copysign(0, -1) +// -inf +// +// >>> np.copysign([-1, 0, 1], -1.1) +// array([-1., -0., -1.]) +// >>> np.copysign([-1, 0, 1], np.arange(3)-1) +// array([-1., 0., 1.]) +// +//go:linkname Copysign py.copysign +func Copysign(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the next floating-point value after x1 towards x2, element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Values to find the next representable value of. +// x2 : array_like +// The direction where to look for the next representable value of `x1`. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The next representable values of `x1` in the direction of `x2`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Examples +// -------- +// >>> eps = np.finfo(np.float64).eps +// >>> np.nextafter(1, 2) == eps + 1 +// True +// >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] +// array([ True, True]) +// +//go:linkname Nextafter py.nextafter +func Nextafter(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return Pearson product-moment correlation coefficients. +// +// Please refer to the documentation for `cov` for more detail. The +// relationship between the correlation coefficient matrix, `R`, and the +// covariance matrix, `C`, is +// +// .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} C_{jj} } } +// +// The values of `R` are between -1 and 1, inclusive. +// +// Parameters +// ---------- +// x : array_like +// A 1-D or 2-D array containing multiple variables and observations. +// Each row of `x` represents a variable, and each column a single +// observation of all those variables. Also see `rowvar` below. +// y : array_like, optional +// An additional set of variables and observations. `y` has the same +// shape as `x`. +// rowvar : bool, optional +// If `rowvar` is True (default), then each row represents a +// variable, with observations in the columns. Otherwise, the relationship +// is transposed: each column represents a variable, while the rows +// contain observations. +// bias : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// ddof : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.10.0 +// dtype : data-type, optional +// Data-type of the result. By default, the return data-type will have +// at least `numpy.float64` precision. +// +// .. versionadded:: 1.20 +// +// Returns +// ------- +// R : ndarray +// The correlation coefficient matrix of the variables. +// +// See Also +// -------- +// cov : Covariance matrix +// +// Notes +// ----- +// Due to floating point rounding the resulting array may not be Hermitian, +// the diagonal elements may not be 1, and the elements may not satisfy the +// inequality abs(a) <= 1. The real and imaginary parts are clipped to the +// interval [-1, 1] in an attempt to improve on that situation but is not +// much help in the complex case. +// +// This function accepts but discards arguments `bias` and `ddof`. This is +// for backwards compatibility with previous versions of this function. These +// arguments had no effect on the return values of the function and can be +// safely ignored in this and previous versions of numpy. +// +// Examples +// -------- +// In this example we generate two random arrays, ``xarr`` and ``yarr``, and +// compute the row-wise and column-wise Pearson correlation coefficients, +// ``R``. Since ``rowvar`` is true by default, we first find the row-wise +// Pearson correlation coefficients between the variables of ``xarr``. +// +// >>> import numpy as np +// >>> rng = np.random.default_rng(seed=42) +// >>> xarr = rng.random((3, 3)) +// >>> xarr +// array([[0.77395605, 0.43887844, 0.85859792], +// [0.69736803, 0.09417735, 0.97562235], +// [0.7611397 , 0.78606431, 0.12811363]]) +// >>> R1 = np.corrcoef(xarr) +// >>> R1 +// array([[ 1. , 0.99256089, -0.68080986], +// [ 0.99256089, 1. , -0.76492172], +// [-0.68080986, -0.76492172, 1. ]]) +// +// If we add another set of variables and observations ``yarr``, we can +// compute the row-wise Pearson correlation coefficients between the +// variables in ``xarr`` and ``yarr``. +// +// >>> yarr = rng.random((3, 3)) +// >>> yarr +// array([[0.45038594, 0.37079802, 0.92676499], +// [0.64386512, 0.82276161, 0.4434142 ], +// [0.22723872, 0.55458479, 0.06381726]]) +// >>> R2 = np.corrcoef(xarr, yarr) +// >>> R2 +// array([[ 1. , 0.99256089, -0.68080986, 0.75008178, -0.934284 , +// -0.99004057], +// [ 0.99256089, 1. , -0.76492172, 0.82502011, -0.97074098, +// -0.99981569], +// [-0.68080986, -0.76492172, 1. , -0.99507202, 0.89721355, +// 0.77714685], +// [ 0.75008178, 0.82502011, -0.99507202, 1. , -0.93657855, +// -0.83571711], +// [-0.934284 , -0.97074098, 0.89721355, -0.93657855, 1. , +// 0.97517215], +// [-0.99004057, -0.99981569, 0.77714685, -0.83571711, 0.97517215, +// 1. ]]) +// +// Finally if we use the option ``rowvar=False``, the columns are now +// being treated as the variables and we will find the column-wise Pearson +// correlation coefficients between variables in ``xarr`` and ``yarr``. +// +// >>> R3 = np.corrcoef(xarr, yarr, rowvar=False) +// >>> R3 +// array([[ 1. , 0.77598074, -0.47458546, -0.75078643, -0.9665554 , +// 0.22423734], +// [ 0.77598074, 1. , -0.92346708, -0.99923895, -0.58826587, +// -0.44069024], +// [-0.47458546, -0.92346708, 1. , 0.93773029, 0.23297648, +// 0.75137473], +// [-0.75078643, -0.99923895, 0.93773029, 1. , 0.55627469, +// 0.47536961], +// [-0.9665554 , -0.58826587, 0.23297648, 0.55627469, 1. , +// -0.46666491], +// [ 0.22423734, -0.44069024, 0.75137473, 0.47536961, -0.46666491, +// 1. ]]) +// +// +// +//go:linkname Corrcoef py.corrcoef +func Corrcoef(x *py.Object, y *py.Object, rowvar *py.Object, bias *py.Object, ddof *py.Object) *py.Object +// +// Return the indices to access (n, n) arrays, given a masking function. +// +// Assume `mask_func` is a function that, for a square array a of size +// ``(n, n)`` with a possible offset argument `k`, when called as +// ``mask_func(a, k)`` returns a new array with zeros in certain locations +// (functions like `triu` or `tril` do precisely this). Then this function +// returns the indices where the non-zero values would be located. +// +// Parameters +// ---------- +// n : int +// The returned indices will be valid to access arrays of shape (n, n). +// mask_func : callable +// A function whose call signature is similar to that of `triu`, `tril`. +// That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. +// `k` is an optional argument to the function. +// k : scalar +// An optional argument which is passed through to `mask_func`. Functions +// like `triu`, `tril` take a second argument that is interpreted as an +// offset. +// +// Returns +// ------- +// indices : tuple of arrays. +// The `n` arrays of indices corresponding to the locations where +// ``mask_func(np.ones((n, n)), k)`` is True. +// +// See Also +// -------- +// triu, tril, triu_indices, tril_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// These are the indices that would allow you to access the upper triangular +// part of any 3x3 array: +// +// >>> iu = np.mask_indices(3, np.triu) +// +// For example, if `a` is a 3x3 array: +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> a[iu] +// array([0, 1, 2, 4, 5, 8]) +// +// An offset can be passed also to the masking function. This gets us the +// indices starting on the first diagonal right of the main one: +// +// >>> iu1 = np.mask_indices(3, np.triu, 1) +// +// with which we now extract only three elements: +// +// >>> a[iu1] +// array([1, 2, 5]) +// +// +// +//go:linkname MaskIndices py.mask_indices +func MaskIndices(n *py.Object, maskFunc *py.Object, k *py.Object) *py.Object +// +// lexsort(keys, axis=-1) +// +// Perform an indirect stable sort using a sequence of keys. +// +// Given multiple sorting keys, which can be interpreted as columns in a +// spreadsheet, lexsort returns an array of integer indices that describes +// the sort order by multiple columns. The last key in the sequence is used +// for the primary sort order, the second-to-last key for the secondary sort +// order, and so on. The keys argument must be a sequence of objects that +// can be converted to arrays of the same shape. If a 2D array is provided +// for the keys argument, its rows are interpreted as the sorting keys and +// sorting is according to the last row, second last row etc. +// +// Parameters +// ---------- +// keys : (k, N) array or tuple containing k (N,)-shaped sequences +// The `k` different "columns" to be sorted. The last column (or row if +// `keys` is a 2D array) is the primary sort key. +// axis : int, optional +// Axis to be indirectly sorted. By default, sort over the last axis. +// +// Returns +// ------- +// indices : (N,) ndarray of ints +// Array of indices that sort the keys along the specified axis. +// +// See Also +// -------- +// argsort : Indirect sort. +// ndarray.sort : In-place sort. +// sort : Return a sorted copy of an array. +// +// Examples +// -------- +// Sort names: first by surname, then by name. +// +// >>> surnames = ('Hertz', 'Galilei', 'Hertz') +// >>> first_names = ('Heinrich', 'Galileo', 'Gustav') +// >>> ind = np.lexsort((first_names, surnames)) +// >>> ind +// array([1, 2, 0]) +// +// >>> [surnames[i] + ", " + first_names[i] for i in ind] +// ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] +// +// Sort two columns of numbers: +// +// >>> a = [1,5,1,4,3,4,4] # First column +// >>> b = [9,4,0,4,0,2,1] # Second column +// >>> ind = np.lexsort((b,a)) # Sort by a, then by b +// >>> ind +// array([2, 0, 4, 6, 5, 3, 1]) +// +// >>> [(a[i],b[i]) for i in ind] +// [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] +// +// Note that sorting is first according to the elements of ``a``. +// Secondary sorting is according to the elements of ``b``. +// +// A normal ``argsort`` would have yielded: +// +// >>> [(a[i],b[i]) for i in np.argsort(a)] +// [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] +// +// Structured arrays are sorted lexically by ``argsort``: +// +// >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], +// ... dtype=np.dtype([('x', int), ('y', int)])) +// +// >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) +// array([2, 0, 4, 6, 5, 3, 1]) +// +// +// +//go:linkname Lexsort py.lexsort +func Lexsort(keys *py.Object, axis *py.Object) *py.Object +// +// Return an array representing the indices of a grid. +// +// Compute an array where the subarrays contain index values 0, 1, ... +// varying only along the corresponding axis. +// +// Parameters +// ---------- +// dimensions : sequence of ints +// The shape of the grid. +// dtype : dtype, optional +// Data type of the result. +// sparse : boolean, optional +// Return a sparse representation of the grid instead of a dense +// representation. Default is False. +// +// .. versionadded:: 1.17 +// +// Returns +// ------- +// grid : one ndarray or tuple of ndarrays +// If sparse is False: +// Returns one array of grid indices, +// ``grid.shape = (len(dimensions),) + tuple(dimensions)``. +// If sparse is True: +// Returns a tuple of arrays, with +// ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with +// dimensions[i] in the ith place +// +// See Also +// -------- +// mgrid, ogrid, meshgrid +// +// Notes +// ----- +// The output shape in the dense case is obtained by prepending the number +// of dimensions in front of the tuple of dimensions, i.e. if `dimensions` +// is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is +// ``(N, r0, ..., rN-1)``. +// +// The subarrays ``grid[k]`` contains the N-D array of indices along the +// ``k-th`` axis. Explicitly:: +// +// grid[k, i0, i1, ..., iN-1] = ik +// +// Examples +// -------- +// >>> grid = np.indices((2, 3)) +// >>> grid.shape +// (2, 2, 3) +// >>> grid[0] # row indices +// array([[0, 0, 0], +// [1, 1, 1]]) +// >>> grid[1] # column indices +// array([[0, 1, 2], +// [0, 1, 2]]) +// +// The indices can be used as an index into an array. +// +// >>> x = np.arange(20).reshape(5, 4) +// >>> row, col = np.indices((2, 3)) +// >>> x[row, col] +// array([[0, 1, 2], +// [4, 5, 6]]) +// +// Note that it would be more straightforward in the above example to +// extract the required elements directly with ``x[:2, :3]``. +// +// If sparse is set to true, the grid will be returned in a sparse +// representation. +// +// >>> i, j = np.indices((2, 3), sparse=True) +// >>> i.shape +// (2, 1) +// >>> j.shape +// (1, 3) +// >>> i # row indices +// array([[0], +// [1]]) +// >>> j # column indices +// array([[0, 1, 2]]) +// +// +// +//go:linkname Indices py.indices +func Indices(dimensions *py.Object, dtype *py.Object, sparse *py.Object) *py.Object +// +// Compute the standard deviation along the specified axis. +// +// Returns the standard deviation, a measure of the spread of a distribution, +// of the array elements. The standard deviation is computed for the +// flattened array by default, otherwise over the specified axis. +// +// Parameters +// ---------- +// a : array_like +// Calculate the standard deviation of these values. +// axis : None or int or tuple of ints, optional +// Axis or axes along which the standard deviation is computed. The +// default is to compute the standard deviation of the flattened array. +// +// .. versionadded:: 1.7.0 +// +// If this is a tuple of ints, a standard deviation is performed over +// multiple axes, instead of a single axis or all the axes as before. +// dtype : dtype, optional +// Type to use in computing the standard deviation. For arrays of +// integer type the default is float64, for arrays of float types it is +// the same as the array type. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output but the type (of the calculated +// values) will be cast if necessary. +// ddof : int, optional +// Means Delta Degrees of Freedom. The divisor used in calculations +// is ``N - ddof``, where ``N`` represents the number of elements. +// By default `ddof` is zero. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the input array. +// +// If the default value is passed, then `keepdims` will not be +// passed through to the `std` method of sub-classes of +// `ndarray`, however any non-default value will be. If the +// sub-class' method does not implement `keepdims` any +// exceptions will be raised. +// +// where : array_like of bool, optional +// Elements to include in the standard deviation. +// See `~numpy.ufunc.reduce` for details. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// standard_deviation : ndarray, see dtype parameter above. +// If `out` is None, return a new array containing the standard deviation, +// otherwise return a reference to the output array. +// +// See Also +// -------- +// var, mean, nanmean, nanstd, nanvar +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// The standard deviation is the square root of the average of the squared +// deviations from the mean, i.e., ``std = sqrt(mean(x))``, where +// ``x = abs(a - a.mean())**2``. +// +// The average squared deviation is typically calculated as ``x.sum() / N``, +// where ``N = len(x)``. If, however, `ddof` is specified, the divisor +// ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` +// provides an unbiased estimator of the variance of the infinite population. +// ``ddof=0`` provides a maximum likelihood estimate of the variance for +// normally distributed variables. The standard deviation computed in this +// function is the square root of the estimated variance, so even with +// ``ddof=1``, it will not be an unbiased estimate of the standard deviation +// per se. +// +// Note that, for complex numbers, `std` takes the absolute +// value before squaring, so that the result is always real and nonnegative. +// +// For floating-point input, the *std* is computed using the same +// precision the input has. Depending on the input data, this can cause +// the results to be inaccurate, especially for float32 (see example below). +// Specifying a higher-accuracy accumulator using the `dtype` keyword can +// alleviate this issue. +// +// Examples +// -------- +// >>> a = np.array([[1, 2], [3, 4]]) +// >>> np.std(a) +// 1.1180339887498949 # may vary +// >>> np.std(a, axis=0) +// array([1., 1.]) +// >>> np.std(a, axis=1) +// array([0.5, 0.5]) +// +// In single precision, std() can be inaccurate: +// +// >>> a = np.zeros((2, 512*512), dtype=np.float32) +// >>> a[0, :] = 1.0 +// >>> a[1, :] = 0.1 +// >>> np.std(a) +// 0.45000005 +// +// Computing the standard deviation in float64 is more accurate: +// +// >>> np.std(a, dtype=np.float64) +// 0.44999999925494177 # may vary +// +// Specifying a where argument: +// +// >>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]]) +// >>> np.std(a) +// 2.614064523559687 # may vary +// >>> np.std(a, where=[[True], [True], [False]]) +// 2.0 +// +// +// +//go:linkname Std py.std +func Std(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object, ddof *py.Object, keepdims *py.Object) *py.Object +//go:linkname Absolute py.absolute +func Absolute(__llgo_va_list ...interface{}) *py.Object +//go:linkname Add py.add +func Add(__llgo_va_list ...interface{}) *py.Object +// geterrobj() +// +// Return the current object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `geterrobj` is used internally by the other +// functions that get and set error handling behavior (`geterr`, `seterr`, +// `geterrcall`, `seterrcall`). +// +// Returns +// ------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// seterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrobj() # first get the defaults +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> old_bufsize = np.setbufsize(20000) +// >>> old_err = np.seterr(divide='raise') +// >>> old_handler = np.seterrcall(err_handler) +// >>> np.geterrobj() +// [8192, 521, ] +// +// >>> old_err = np.seterr(all='ignore') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '0' +// >>> old_err = np.seterr(divide='warn', over='log', under='call', +// ... invalid='print') +// >>> np.base_repr(np.geterrobj()[1], 8) +// '4351' +// +//go:linkname Geterrobj py.geterrobj +func Geterrobj() *py.Object +// +// Get help information for an array, function, class, or module. +// +// Parameters +// ---------- +// object : object or str, optional +// Input object or name to get information about. If `object` is +// an `ndarray` instance, information about the array is printed. +// If `object` is a numpy object, its docstring is given. If it is +// a string, available modules are searched for matching objects. +// If None, information about `info` itself is returned. +// maxwidth : int, optional +// Printing width. +// output : file like object, optional +// File like object that the output is written to, default is +// ``None``, in which case ``sys.stdout`` will be used. +// The object has to be opened in 'w' or 'a' mode. +// toplevel : str, optional +// Start search at this level. +// +// See Also +// -------- +// source, lookfor +// +// Notes +// ----- +// When used interactively with an object, ``np.info(obj)`` is equivalent +// to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython +// prompt. +// +// Examples +// -------- +// >>> np.info(np.polyval) # doctest: +SKIP +// polyval(p, x) +// Evaluate the polynomial p at x. +// ... +// +// When using a string for `object` it is possible to get multiple results. +// +// >>> np.info('fft') # doctest: +SKIP +// *** Found in numpy *** +// Core FFT routines +// ... +// *** Found in numpy.fft *** +// fft(a, n=None, axis=-1) +// ... +// *** Repeat reference found in numpy.fft.fftpack *** +// *** Total of 3 references found. *** +// +// When the argument is an array, information about the array is printed. +// +// >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) +// >>> np.info(a) +// class: ndarray +// shape: (2, 3) +// strides: (24, 8) +// itemsize: 8 +// aligned: True +// contiguous: True +// fortran: False +// data pointer: 0x562b6e0d2860 # may vary +// byteorder: little +// byteswap: False +// type: complex64 +// +// +// +//go:linkname Info py.info +func Info(object *py.Object, maxwidth *py.Object, output *py.Object, toplevel *py.Object) *py.Object +// fromiter(iter, dtype, count=-1, *, like=None) +// +// Create a new 1-dimensional array from an iterable object. +// +// Parameters +// ---------- +// iter : iterable object +// An iterable object providing data for the array. +// dtype : data-type +// The data-type of the returned array. +// +// .. versionchanged:: 1.23 +// Object and subarray dtypes are now supported (note that the final +// result is not 1-D for a subarray dtype). +// +// count : int, optional +// The number of items to read from *iterable*. The default is -1, +// which means all data is read. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The output array. +// +// Notes +// ----- +// Specify `count` to improve performance. It allows ``fromiter`` to +// pre-allocate the output array, instead of resizing it on demand. +// +// Examples +// -------- +// >>> iterable = (x*x for x in range(5)) +// >>> np.fromiter(iterable, float) +// array([ 0., 1., 4., 9., 16.]) +// +// A carefully constructed subarray dtype will lead to higher dimensional +// results: +// +// >>> iterable = ((x+1, x+2) for x in range(5)) +// >>> np.fromiter(iterable, dtype=np.dtype((int, 2))) +// array([[1, 2], +// [2, 3], +// [3, 4], +// [4, 5], +// [5, 6]]) +// +//go:linkname Fromiter py.fromiter +func Fromiter(iter *py.Object, dtype *py.Object, count *py.Object) *py.Object +// Context manager for setting print options. +// +// Set print options for the scope of the `with` block, and restore the old +// options at the end. See `set_printoptions` for the full description of +// available options. +// +// Examples +// -------- +// +// >>> from numpy.testing import assert_equal +// >>> with np.printoptions(precision=2): +// ... np.array([2.0]) / 3 +// array([0.67]) +// +// The `as`-clause of the `with`-statement gives the current print options: +// +// >>> with np.printoptions(precision=2) as opts: +// ... assert_equal(opts, np.get_printoptions()) +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// +// +//go:linkname Printoptions py.printoptions +func Printoptions(__llgo_va_list ...interface{}) *py.Object +// +// Return an ndarray of the provided type that satisfies requirements. +// +// This function is useful to be sure that an array with the correct flags +// is returned for passing to compiled code (perhaps through ctypes). +// +// Parameters +// ---------- +// a : array_like +// The object to be converted to a type-and-requirement-satisfying array. +// dtype : data-type +// The required data-type. If None preserve the current dtype. If your +// application requires the data to be in native byteorder, include +// a byteorder specification as a part of the dtype specification. +// requirements : str or sequence of str +// The requirements list can be any of the following +// +// * 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array +// * 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array +// * 'ALIGNED' ('A') - ensure a data-type aligned array +// * 'WRITEABLE' ('W') - ensure a writable array +// * 'OWNDATA' ('O') - ensure an array that owns its own data +// * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Array with specified requirements and type if given. +// +// See Also +// -------- +// asarray : Convert input to an ndarray. +// asanyarray : Convert to an ndarray, but pass through ndarray subclasses. +// ascontiguousarray : Convert input to a contiguous array. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// ndarray.flags : Information about the memory layout of the array. +// +// Notes +// ----- +// The returned array will be guaranteed to have the listed requirements +// by making a copy if needed. +// +// Examples +// -------- +// >>> x = np.arange(6).reshape(2,3) +// >>> x.flags +// C_CONTIGUOUS : True +// F_CONTIGUOUS : False +// OWNDATA : False +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) +// >>> y.flags +// C_CONTIGUOUS : False +// F_CONTIGUOUS : True +// OWNDATA : True +// WRITEABLE : True +// ALIGNED : True +// WRITEBACKIFCOPY : False +// +// +// +//go:linkname Require py.require +func Require(a *py.Object, dtype *py.Object, requirements *py.Object) *py.Object +// +// Take values from the input array by matching 1d index and data slices. +// +// This iterates over matching 1d slices oriented along the specified axis in +// the index and data arrays, and uses the former to look up values in the +// latter. These slices can be different lengths. +// +// Functions returning an index along an axis, like `argsort` and +// `argpartition`, produce suitable indices for this function. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// arr : ndarray (Ni..., M, Nk...) +// Source array +// indices : ndarray (Ni..., J, Nk...) +// Indices to take along each 1d slice of `arr`. This must match the +// dimension of arr, but dimensions Ni and Nj only need to broadcast +// against `arr`. +// axis : int +// The axis to take 1d slices along. If axis is None, the input array is +// treated as if it had first been flattened to 1d, for consistency with +// `sort` and `argsort`. +// +// Returns +// ------- +// out: ndarray (Ni..., J, Nk...) +// The indexed result. +// +// Notes +// ----- +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices:: +// +// Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:] +// J = indices.shape[axis] # Need not equal M +// out = np.empty(Ni + (J,) + Nk) +// +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// a_1d = a [ii + s_[:,] + kk] +// indices_1d = indices[ii + s_[:,] + kk] +// out_1d = out [ii + s_[:,] + kk] +// for j in range(J): +// out_1d[j] = a_1d[indices_1d[j]] +// +// Equivalently, eliminating the inner loop, the last two lines would be:: +// +// out_1d[:] = a_1d[indices_1d] +// +// See Also +// -------- +// take : Take along an axis, using the same indices for every 1d slice +// put_along_axis : +// Put values into the destination array by matching 1d index and data slices +// +// Examples +// -------- +// +// For this sample array +// +// >>> a = np.array([[10, 30, 20], [60, 40, 50]]) +// +// We can sort either by using sort directly, or argsort and this function +// +// >>> np.sort(a, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// >>> ai = np.argsort(a, axis=1) +// >>> ai +// array([[0, 2, 1], +// [1, 2, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 20, 30], +// [40, 50, 60]]) +// +// The same works for max and min, if you maintain the trivial dimension +// with ``keepdims``: +// +// >>> np.max(a, axis=1, keepdims=True) +// array([[30], +// [60]]) +// >>> ai = np.argmax(a, axis=1, keepdims=True) +// >>> ai +// array([[1], +// [0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[30], +// [60]]) +// +// If we want to get the max and min at the same time, we can stack the +// indices first +// +// >>> ai_min = np.argmin(a, axis=1, keepdims=True) +// >>> ai_max = np.argmax(a, axis=1, keepdims=True) +// >>> ai = np.concatenate([ai_min, ai_max], axis=1) +// >>> ai +// array([[0, 1], +// [1, 0]]) +// >>> np.take_along_axis(a, ai, axis=1) +// array([[10, 30], +// [40, 60]]) +// +// +//go:linkname TakeAlongAxis py.take_along_axis +func TakeAlongAxis(arr *py.Object, indices *py.Object, axis *py.Object) *py.Object +// asanyarray(a, dtype=None, order=None, *, like=None) +// +// Convert the input to an ndarray, but pass ndarray subclasses through. +// +// Parameters +// ---------- +// a : array_like +// Input data, in any form that can be converted to an array. This +// includes scalars, lists, lists of tuples, tuples, tuples of tuples, +// tuples of lists, and ndarrays. +// dtype : data-type, optional +// By default, the data-type is inferred from the input data. +// order : {'C', 'F', 'A', 'K'}, optional +// Memory layout. 'A' and 'K' depend on the order of input array a. +// 'C' row-major (C-style), +// 'F' column-major (Fortran-style) memory representation. +// 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise +// 'K' (keep) preserve input order +// Defaults to 'C'. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray or an ndarray subclass +// Array interpretation of `a`. If `a` is an ndarray or a subclass +// of ndarray, it is returned as-is and no copy is performed. +// +// See Also +// -------- +// asarray : Similar function which always returns ndarrays. +// ascontiguousarray : Convert input to a contiguous array. +// asfarray : Convert input to a floating point ndarray. +// asfortranarray : Convert input to an ndarray with column-major +// memory order. +// asarray_chkfinite : Similar function which checks input for NaNs and +// Infs. +// fromiter : Create an array from an iterator. +// fromfunction : Construct an array by executing a function on grid +// positions. +// +// Examples +// -------- +// Convert a list into an array: +// +// >>> a = [1, 2] +// >>> np.asanyarray(a) +// array([1, 2]) +// +// Instances of `ndarray` subclasses are passed through as-is: +// +// >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) +// >>> np.asanyarray(a) is a +// True +// +//go:linkname Asanyarray py.asanyarray +func Asanyarray(a *py.Object, dtype *py.Object, order *py.Object) *py.Object +// +// empty_like(prototype, dtype=None, order='K', subok=True, shape=None) +// +// Return a new array with the same shape and type as a given array. +// +// Parameters +// ---------- +// prototype : array_like +// The shape and data-type of `prototype` define these same attributes +// of the returned array. +// dtype : data-type, optional +// Overrides the data type of the result. +// +// .. versionadded:: 1.6.0 +// order : {'C', 'F', 'A', or 'K'}, optional +// Overrides the memory layout of the result. 'C' means C-order, +// 'F' means F-order, 'A' means 'F' if `prototype` is Fortran +// contiguous, 'C' otherwise. 'K' means match the layout of `prototype` +// as closely as possible. +// +// .. versionadded:: 1.6.0 +// subok : bool, optional. +// If True, then the newly created array will use the sub-class +// type of `prototype`, otherwise it will be a base-class array. Defaults +// to True. +// shape : int or sequence of ints, optional. +// Overrides the shape of the result. If order='K' and the number of +// dimensions is unchanged, will try to keep order, otherwise, +// order='C' is implied. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// out : ndarray +// Array of uninitialized (arbitrary) data with the same +// shape and type as `prototype`. +// +// See Also +// -------- +// ones_like : Return an array of ones with shape and type of input. +// zeros_like : Return an array of zeros with shape and type of input. +// full_like : Return a new array with shape of input filled with value. +// empty : Return a new uninitialized array. +// +// Notes +// ----- +// This function does *not* initialize the returned array; to do that use +// `zeros_like` or `ones_like` instead. It may be marginally faster than +// the functions that do set the array values. +// +// Examples +// -------- +// >>> a = ([1,2,3], [4,5,6]) # a is array-like +// >>> np.empty_like(a) +// array([[-1073741821, -1073741821, 3], # uninitialized +// [ 0, 0, -1073741821]]) +// >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) +// >>> np.empty_like(a) +// array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized +// [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) +// +// +// +//go:linkname EmptyLike py.empty_like +func EmptyLike(prototype *py.Object, dtype *py.Object, order *py.Object, subok *py.Object, shape *py.Object) *py.Object +// +// Returns the indices of the maximum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmax, argmin +// amax : The maximum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmax to an array as if by calling max. +// +// Notes +// ----- +// In case of multiple occurrences of the maximum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmax(a) +// 5 +// >>> np.argmax(a, axis=0) +// array([1, 1, 1]) +// >>> np.argmax(a, axis=1) +// array([2, 2]) +// +// Indexes of the maximal elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) +// >>> ind +// (1, 2) +// >>> a[ind] +// 15 +// +// >>> b = np.arange(6) +// >>> b[1] = 5 +// >>> b +// array([0, 5, 2, 3, 4, 5]) +// >>> np.argmax(b) # Only the first occurrence is returned. +// 1 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmax(x, axis=-1) +// >>> # Same as np.amax(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[4], +// [3]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([4, 3]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmax(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmax py.argmax +func Argmax(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Return the cumulative product over the given axis. +// +// .. deprecated:: 1.25.0 +// ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be +// removed in NumPy 2.0. Please use `cumprod` instead. +// +// See Also +// -------- +// cumprod : equivalent function; see for details. +// +// +//go:linkname Cumproduct py.cumproduct +func Cumproduct(__llgo_va_list ...interface{}) *py.Object +// +// Interchange two axes of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis1 : int +// First axis. +// axis2 : int +// Second axis. +// +// Returns +// ------- +// a_swapped : ndarray +// For NumPy >= 1.10.0, if `a` is an ndarray, then a view of `a` is +// returned; otherwise a new array is created. For earlier NumPy +// versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// Examples +// -------- +// >>> x = np.array([[1,2,3]]) +// >>> np.swapaxes(x,0,1) +// array([[1], +// [2], +// [3]]) +// +// >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) +// >>> x +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// +// >>> np.swapaxes(x,0,2) +// array([[[0, 4], +// [2, 6]], +// [[1, 5], +// [3, 7]]]) +// +// +// +//go:linkname Swapaxes py.swapaxes +func Swapaxes(a *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute bit-wise inversion, or bit-wise NOT, element-wise. +// +// Computes the bit-wise NOT of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``~``. +// +// For signed integer inputs, the two's complement is returned. In a +// two's-complement system negative numbers are represented by the two's +// complement of the absolute value. This is the most common method of +// representing signed integers on computers [1]_. A N-bit +// two's-complement system can represent every integer in the range +// :math:`-2^{N-1}` to :math:`+2^{N-1}-1`. +// +// Parameters +// ---------- +// x : array_like +// Only integer and boolean types are handled. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// bitwise_and, bitwise_or, bitwise_xor +// logical_not +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Notes +// ----- +// `bitwise_not` is an alias for `invert`: +// +// >>> np.bitwise_not is np.invert +// True +// +// References +// ---------- +// .. [1] Wikipedia, "Two's complement", +// https://en.wikipedia.org/wiki/Two's_complement +// +// Examples +// -------- +// We've seen that 13 is represented by ``00001101``. +// The invert or bit-wise NOT of 13 is then: +// +// >>> x = np.invert(np.array(13, dtype=np.uint8)) +// >>> x +// 242 +// >>> np.binary_repr(x, width=8) +// '11110010' +// +// The result depends on the bit-width: +// +// >>> x = np.invert(np.array(13, dtype=np.uint16)) +// >>> x +// 65522 +// >>> np.binary_repr(x, width=16) +// '1111111111110010' +// +// When using signed integer types the result is the two's complement of +// the result for the unsigned type: +// +// >>> np.invert(np.array([13], dtype=np.int8)) +// array([-14], dtype=int8) +// >>> np.binary_repr(-14, width=8) +// '11110010' +// +// Booleans are accepted as well: +// +// >>> np.invert(np.array([True, False])) +// array([False, True]) +// +// The ``~`` operator can be used as a shorthand for ``np.invert`` on +// ndarrays. +// +// >>> x1 = np.array([True, False]) +// >>> ~x1 +// array([False, True]) +// +//go:linkname Invert py.invert +func Invert(x *py.Object, out *py.Object) *py.Object +// radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Convert angles from degrees to radians. +// +// Parameters +// ---------- +// x : array_like +// Input array in degrees. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding radian values. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// deg2rad : equivalent function +// +// Examples +// -------- +// Convert a degree array to radians +// +// >>> deg = np.arange(12.) * 30. +// >>> np.radians(deg) +// array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , +// 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, +// 5.23598776, 5.75958653]) +// +// >>> out = np.zeros((deg.shape)) +// >>> ret = np.radians(deg, out) +// >>> ret is out +// True +// +//go:linkname Radians py.radians +func Radians(x *py.Object, out *py.Object) *py.Object +// fastCopyAndTranspose(a) +// +// .. deprecated:: 1.24 +// +// fastCopyAndTranspose is deprecated and will be removed. Use the copy and +// transpose methods instead, e.g. ``arr.T.copy()`` +// +//go:linkname FastCopyAndTranspose py.fastCopyAndTranspose +func FastCopyAndTranspose(a *py.Object) *py.Object +// +// Evenly round to the given number of decimals. +// +// Parameters +// ---------- +// a : array_like +// Input data. +// decimals : int, optional +// Number of decimal places to round to (default: 0). If +// decimals is negative, it specifies the number of positions to +// the left of the decimal point. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape as the expected output, but the type of the output +// values will be cast if necessary. See :ref:`ufuncs-output-type` for more +// details. +// +// Returns +// ------- +// rounded_array : ndarray +// An array of the same type as `a`, containing the rounded values. +// Unless `out` was specified, a new array is created. A reference to +// the result is returned. +// +// The real and imaginary parts of complex numbers are rounded +// separately. The result of rounding a float is a float. +// +// See Also +// -------- +// ndarray.round : equivalent method +// around : an alias for this function +// ceil, fix, floor, rint, trunc +// +// +// Notes +// ----- +// For values exactly halfway between rounded decimal values, NumPy +// rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, +// -0.5 and 0.5 round to 0.0, etc. +// +// ``np.round`` uses a fast but sometimes inexact algorithm to round +// floating-point datatypes. For positive `decimals` it is equivalent to +// ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has +// error due to the inexact representation of decimal fractions in the IEEE +// floating point standard [1]_ and errors introduced when scaling by powers +// of ten. For instance, note the extra "1" in the following: +// +// >>> np.round(56294995342131.5, 3) +// 56294995342131.51 +// +// If your goal is to print such values with a fixed number of decimals, it is +// preferable to use numpy's float printing routines to limit the number of +// printed decimals: +// +// >>> np.format_float_positional(56294995342131.5, precision=3) +// '56294995342131.5' +// +// The float printing routines use an accurate but much more computationally +// demanding algorithm to compute the number of digits after the decimal +// point. +// +// Alternatively, Python's builtin `round` function uses a more accurate +// but slower algorithm for 64-bit floating point values: +// +// >>> round(56294995342131.5, 3) +// 56294995342131.5 +// >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 +// (16.06, 16.05) +// +// +// References +// ---------- +// .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, +// https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF +// +// Examples +// -------- +// >>> np.round([0.37, 1.64]) +// array([0., 2.]) +// >>> np.round([0.37, 1.64], decimals=1) +// array([0.4, 1.6]) +// >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value +// array([0., 2., 2., 4., 4.]) +// >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned +// array([ 1, 2, 3, 11]) +// >>> np.round([1,2,3,11], decimals=-1) +// array([ 0, 0, 0, 10]) +// +// +// +//go:linkname Round py.round +func Round(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise AND of two arrays element-wise. +// +// Computes the bit-wise AND of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``&``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_and +// bitwise_or +// bitwise_xor +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise AND of 13 and 17 is +// therefore ``000000001``, or 1: +// +// >>> np.bitwise_and(13, 17) +// 1 +// +// >>> np.bitwise_and(14, 13) +// 12 +// >>> np.binary_repr(12) +// '1100' +// >>> np.bitwise_and([14,3], 13) +// array([12, 1]) +// +// >>> np.bitwise_and([11,7], [4,25]) +// array([0, 1]) +// >>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16])) +// array([ 2, 4, 16]) +// >>> np.bitwise_and([True, True], [False, True]) +// array([False, True]) +// +// The ``&`` operator can be used as a shorthand for ``np.bitwise_and`` on +// ndarrays. +// +// >>> x1 = np.array([2, 5, 255]) +// >>> x2 = np.array([3, 14, 16]) +// >>> x1 & x2 +// array([ 2, 4, 16]) +// +//go:linkname BitwiseAnd py.bitwise_and +func BitwiseAnd(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the string representation of an array. +// +// Parameters +// ---------- +// arr : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// +// Returns +// ------- +// string : str +// The string representation of an array. +// +// See Also +// -------- +// array_str, array2string, set_printoptions +// +// Examples +// -------- +// >>> np.array_repr(np.array([1,2])) +// 'array([1, 2])' +// >>> np.array_repr(np.ma.array([0.])) +// 'MaskedArray([0.])' +// >>> np.array_repr(np.array([], np.int32)) +// 'array([], dtype=int32)' +// +// >>> x = np.array([1e-6, 4e-7, 2, 3]) +// >>> np.array_repr(x, precision=6, suppress_small=True) +// 'array([0.000001, 0. , 2. , 3. ])' +// +// +// +//go:linkname ArrayRepr py.array_repr +func ArrayRepr(arr *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object) *py.Object +// +// Return a string representation of an array. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// max_line_width : int, optional +// Inserts newlines if text is longer than `max_line_width`. +// Defaults to ``numpy.get_printoptions()['linewidth']``. +// precision : int or None, optional +// Floating point precision. +// Defaults to ``numpy.get_printoptions()['precision']``. +// suppress_small : bool, optional +// Represent numbers "very close" to zero as zero; default is False. +// Very close is defined by precision: if the precision is 8, e.g., +// numbers smaller (in absolute value) than 5e-9 are represented as +// zero. +// Defaults to ``numpy.get_printoptions()['suppress']``. +// separator : str, optional +// Inserted between elements. +// prefix : str, optional +// suffix : str, optional +// The length of the prefix and suffix strings are used to respectively +// align and wrap the output. An array is typically printed as:: +// +// prefix + array2string(a) + suffix +// +// The output is left-padded by the length of the prefix string, and +// wrapping is forced at the column ``max_line_width - len(suffix)``. +// It should be noted that the content of prefix and suffix strings are +// not included in the output. +// style : _NoValue, optional +// Has no effect, do not use. +// +// .. deprecated:: 1.14.0 +// formatter : dict of callables, optional +// If not None, the keys should indicate the type(s) that the respective +// formatting function applies to. Callables should return a string. +// Types that are not specified (by their corresponding keys) are handled +// by the default formatters. Individual types for which a formatter +// can be set are: +// +// - 'bool' +// - 'int' +// - 'timedelta' : a `numpy.timedelta64` +// - 'datetime' : a `numpy.datetime64` +// - 'float' +// - 'longfloat' : 128-bit floats +// - 'complexfloat' +// - 'longcomplexfloat' : composed of two 128-bit floats +// - 'void' : type `numpy.void` +// - 'numpystr' : types `numpy.bytes_` and `numpy.str_` +// +// Other keys that can be used to set a group of types at once are: +// +// - 'all' : sets all types +// - 'int_kind' : sets 'int' +// - 'float_kind' : sets 'float' and 'longfloat' +// - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' +// - 'str_kind' : sets 'numpystr' +// threshold : int, optional +// Total number of array elements which trigger summarization +// rather than full repr. +// Defaults to ``numpy.get_printoptions()['threshold']``. +// edgeitems : int, optional +// Number of array items in summary at beginning and end of +// each dimension. +// Defaults to ``numpy.get_printoptions()['edgeitems']``. +// sign : string, either '-', '+', or ' ', optional +// Controls printing of the sign of floating-point types. If '+', always +// print the sign of positive values. If ' ', always prints a space +// (whitespace character) in the sign position of positive values. If +// '-', omit the sign character of positive values. +// Defaults to ``numpy.get_printoptions()['sign']``. +// floatmode : str, optional +// Controls the interpretation of the `precision` option for +// floating-point types. +// Defaults to ``numpy.get_printoptions()['floatmode']``. +// Can take the following values: +// +// - 'fixed': Always print exactly `precision` fractional digits, +// even if this would print more or fewer digits than +// necessary to specify the value uniquely. +// - 'unique': Print the minimum number of fractional digits necessary +// to represent each value uniquely. Different elements may +// have a different number of digits. The value of the +// `precision` option is ignored. +// - 'maxprec': Print at most `precision` fractional digits, but if +// an element can be uniquely represented with fewer digits +// only print it with that many. +// - 'maxprec_equal': Print at most `precision` fractional digits, +// but if every element in the array can be uniquely +// represented with an equal number of fewer digits, use that +// many digits for all elements. +// legacy : string or `False`, optional +// If set to the string `'1.13'` enables 1.13 legacy printing mode. This +// approximates numpy 1.13 print output by including a space in the sign +// position of floats and different behavior for 0d arrays. If set to +// `False`, disables legacy mode. Unrecognized strings will be ignored +// with a warning for forward compatibility. +// +// .. versionadded:: 1.14.0 +// +// Returns +// ------- +// array_str : str +// String representation of the array. +// +// Raises +// ------ +// TypeError +// if a callable in `formatter` does not return a string. +// +// See Also +// -------- +// array_str, array_repr, set_printoptions, get_printoptions +// +// Notes +// ----- +// If a formatter is specified for a certain type, the `precision` keyword is +// ignored for that type. +// +// This is a very flexible function; `array_repr` and `array_str` are using +// `array2string` internally so keywords with the same name should work +// identically in all three functions. +// +// Examples +// -------- +// >>> x = np.array([1e-16,1,2,3]) +// >>> np.array2string(x, precision=2, separator=',', +// ... suppress_small=True) +// '[0.,1.,2.,3.]' +// +// >>> x = np.arange(3.) +// >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x}) +// '[0.00 1.00 2.00]' +// +// >>> x = np.arange(3) +// >>> np.array2string(x, formatter={'int':lambda x: hex(x)}) +// '[0x0 0x1 0x2]' +// +// +// +//go:linkname Array2string py.array2string +func Array2string(a *py.Object, maxLineWidth *py.Object, precision *py.Object, suppressSmall *py.Object, separator *py.Object, prefix *py.Object, style *py.Object, formatter *py.Object, threshold *py.Object, edgeitems *py.Object, sign *py.Object, floatmode *py.Object, suffix *py.Object) *py.Object +// +// Return the current callback function used on floating-point errors. +// +// When the error handling for a floating-point error (one of "divide", +// "over", "under", or "invalid") is set to 'call' or 'log', the function +// that is called or the log instance that is written to is returned by +// `geterrcall`. This function or log instance has been set with +// `seterrcall`. +// +// Returns +// ------- +// errobj : callable, log instance or None +// The current error handler. If no handler was set through `seterrcall`, +// ``None`` is returned. +// +// See Also +// -------- +// seterrcall, seterr, geterr +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> np.geterrcall() # we did not yet set a handler, returns None +// +// >>> oldsettings = np.seterr(all='call') +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// >>> oldhandler = np.seterrcall(err_handler) +// >>> np.array([1, 2, 3]) / 0.0 +// Floating point error (divide by zero), with flag 1 +// array([inf, inf, inf]) +// +// >>> cur_handler = np.geterrcall() +// >>> cur_handler is err_handler +// True +// +// +// +//go:linkname Geterrcall py.geterrcall +func Geterrcall() *py.Object +// +// Insert values along the given axis before the given indices. +// +// Parameters +// ---------- +// arr : array_like +// Input array. +// obj : int, slice or sequence of ints +// Object that defines the index or indices before which `values` is +// inserted. +// +// .. versionadded:: 1.8.0 +// +// Support for multiple insertions when `obj` is a single scalar or a +// sequence with one element (similar to calling insert multiple +// times). +// values : array_like +// Values to insert into `arr`. If the type of `values` is different +// from that of `arr`, `values` is converted to the type of `arr`. +// `values` should be shaped so that ``arr[...,obj,...] = values`` +// is legal. +// axis : int, optional +// Axis along which to insert `values`. If `axis` is None then `arr` +// is flattened first. +// +// Returns +// ------- +// out : ndarray +// A copy of `arr` with `values` inserted. Note that `insert` +// does not occur in-place: a new array is returned. If +// `axis` is None, `out` is a flattened array. +// +// See Also +// -------- +// append : Append elements at the end of an array. +// concatenate : Join a sequence of arrays along an existing axis. +// delete : Delete elements from an array. +// +// Notes +// ----- +// Note that for higher dimensional inserts ``obj=0`` behaves very different +// from ``obj=[0]`` just like ``arr[:,0,:] = values`` is different from +// ``arr[:,[0],:] = values``. +// +// Examples +// -------- +// >>> a = np.array([[1, 1], [2, 2], [3, 3]]) +// >>> a +// array([[1, 1], +// [2, 2], +// [3, 3]]) +// >>> np.insert(a, 1, 5) +// array([1, 5, 1, ..., 2, 3, 3]) +// >>> np.insert(a, 1, 5, axis=1) +// array([[1, 5, 1], +// [2, 5, 2], +// [3, 5, 3]]) +// +// Difference between sequence and scalars: +// +// >>> np.insert(a, [1], [[1],[2],[3]], axis=1) +// array([[1, 1, 1], +// [2, 2, 2], +// [3, 3, 3]]) +// >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), +// ... np.insert(a, [1], [[1],[2],[3]], axis=1)) +// True +// +// >>> b = a.flatten() +// >>> b +// array([1, 1, 2, 2, 3, 3]) +// >>> np.insert(b, [2, 2], [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, slice(2, 4), [5, 6]) +// array([1, 1, 5, ..., 2, 3, 3]) +// +// >>> np.insert(b, [2, 2], [7.13, False]) # type casting +// array([1, 1, 7, ..., 2, 3, 3]) +// +// >>> x = np.arange(8).reshape(2, 4) +// >>> idx = (1, 3) +// >>> np.insert(x, idx, 999, axis=1) +// array([[ 0, 999, 1, 2, 999, 3], +// [ 4, 999, 5, 6, 999, 7]]) +// +// +// +//go:linkname Insert py.insert +func Insert(arr *py.Object, obj *py.Object, values *py.Object, axis *py.Object) *py.Object +// +// An array with ones at and below the given diagonal and zeros elsewhere. +// +// Parameters +// ---------- +// N : int +// Number of rows in the array. +// M : int, optional +// Number of columns in the array. +// By default, `M` is taken equal to `N`. +// k : int, optional +// The sub-diagonal at and below which the array is filled. +// `k` = 0 is the main diagonal, while `k` < 0 is below it, +// and `k` > 0 is above. The default is 0. +// dtype : dtype, optional +// Data type of the returned array. The default is float. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// tri : ndarray of shape (N, M) +// Array with its lower triangle filled with ones and zero elsewhere; +// in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. +// +// Examples +// -------- +// >>> np.tri(3, 5, 2, dtype=int) +// array([[1, 1, 1, 0, 0], +// [1, 1, 1, 1, 0], +// [1, 1, 1, 1, 1]]) +// +// >>> np.tri(3, 5, -1) +// array([[0., 0., 0., 0., 0.], +// [1., 0., 0., 0., 0.], +// [1., 1., 0., 0., 0.]]) +// +// +// +//go:linkname Tri py.tri +func Tri(N *py.Object, M *py.Object, k *py.Object, dtype *py.Object) *py.Object +// heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the Heaviside step function. +// +// The Heaviside step function is defined as:: +// +// 0 if x1 < 0 +// heaviside(x1, x2) = x2 if x1 == 0 +// 1 if x1 > 0 +// +// where `x2` is often taken to be 0.5, but 0 and 1 are also sometimes used. +// +// Parameters +// ---------- +// x1 : array_like +// Input values. +// x2 : array_like +// The value of the function when x1 is 0. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// The output array, element-wise Heaviside step function of `x1`. +// This is a scalar if both `x1` and `x2` are scalars. +// +// Notes +// ----- +// .. versionadded:: 1.13.0 +// +// References +// ---------- +// .. Wikipedia, "Heaviside step function", +// https://en.wikipedia.org/wiki/Heaviside_step_function +// +// Examples +// -------- +// >>> np.heaviside([-1.5, 0, 2.0], 0.5) +// array([ 0. , 0.5, 1. ]) +// >>> np.heaviside([-1.5, 0, 2.0], 1) +// array([ 0., 1., 1.]) +// +//go:linkname Heaviside py.heaviside +func Heaviside(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// +// Return the current print options. +// +// Returns +// ------- +// print_opts : dict +// Dictionary of current print options with keys +// +// - precision : int +// - threshold : int +// - edgeitems : int +// - linewidth : int +// - suppress : bool +// - nanstr : str +// - infstr : str +// - formatter : dict of callables +// - sign : str +// +// For a full description of these options, see `set_printoptions`. +// +// See Also +// -------- +// set_printoptions, printoptions, set_string_function +// +// +// +//go:linkname GetPrintoptions py.get_printoptions +func GetPrintoptions() *py.Object +// +// Compute the q-th quantile of the data along the specified axis. +// +// .. versionadded:: 1.15.0 +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Probability or sequence of probabilities for the quantiles to compute. +// Values must be between 0 and 1 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the quantiles are computed. The default is +// to compute the quantile(s) along a flattened version of the array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// quantile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// quantile : scalar or ndarray +// If `q` is a single probability and `axis=None`, then the result +// is a scalar. If multiple probabilies levels are given, first axis of +// the result corresponds to the quantiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// percentile : equivalent to quantile, but with q in the range [0, 100]. +// median : equivalent to ``quantile(..., 0.5)`` +// nanquantile +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th quantile of ``V`` is +// the value ``q`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// quantile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=0.5``, the +// same as the minimum if ``q=0.0`` and the same as the maximum if +// ``q=1.0``. +// +// The optional `method` parameter specifies the method to use when the +// desired quantile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the quantile in the sorted sample: +// +// .. math:: +// i + g = q * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method gives continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method gives continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method gives continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.quantile(a, 0.5) +// 3.5 +// >>> np.quantile(a, 0.5, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.quantile(a, 0.5, axis=1) +// array([7., 2.]) +// >>> np.quantile(a, 0.5, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.quantile(a, 0.5, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.quantile(a, 0.5, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// >>> b = a.copy() +// >>> np.quantile(b, 0.5, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// See also `numpy.percentile` for a visualization of most methods. +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Quantile py.quantile +func Quantile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Protected string evaluation. +// +// Evaluate a string containing a Python literal expression without +// allowing the execution of arbitrary non-literal code. +// +// .. warning:: +// +// This function is identical to :py:meth:`ast.literal_eval` and +// has the same security implications. It may not always be safe +// to evaluate large input strings. +// +// Parameters +// ---------- +// source : str +// The string to evaluate. +// +// Returns +// ------- +// obj : object +// The result of evaluating `source`. +// +// Raises +// ------ +// SyntaxError +// If the code has invalid Python syntax, or if it contains +// non-literal code. +// +// Examples +// -------- +// >>> np.safe_eval('1') +// 1 +// >>> np.safe_eval('[1, 2, 3]') +// [1, 2, 3] +// >>> np.safe_eval('{"foo": ("bar", 10.0)}') +// {'foo': ('bar', 10.0)} +// +// >>> np.safe_eval('import os') +// Traceback (most recent call last): +// ... +// SyntaxError: invalid syntax +// +// >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') +// Traceback (most recent call last): +// ... +// ValueError: malformed node or string: <_ast.Call object at 0x...> +// +// +// +//go:linkname SafeEval py.safe_eval +func SafeEval(source *py.Object) *py.Object +// +// Find the set difference of two arrays. +// +// Return the unique values in `ar1` that are not in `ar2`. +// +// Parameters +// ---------- +// ar1 : array_like +// Input array. +// ar2 : array_like +// Input comparison array. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setdiff1d : ndarray +// 1D array of values in `ar1` that are not in `ar2`. The result +// is sorted when `assume_unique=False`, but otherwise only sorted +// if the input is sorted. +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4, 1]) +// >>> b = np.array([3, 4, 5, 6]) +// >>> np.setdiff1d(a, b) +// array([1, 2]) +// +// +// +//go:linkname Setdiff1d py.setdiff1d +func Setdiff1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// +// Calculates ``element in test_elements``, broadcasting over `element` only. +// Returns a boolean array of the same shape as `element` that is True +// where an element of `element` is in `test_elements` and False otherwise. +// +// Parameters +// ---------- +// element : array_like +// Input array. +// test_elements : array_like +// The values against which to test each value of `element`. +// This argument is flattened if it is an array or array_like. +// See notes for behavior with non-array-like parameters. +// assume_unique : bool, optional +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// invert : bool, optional +// If True, the values in the returned array are inverted, as if +// calculating `element not in test_elements`. Default is False. +// ``np.isin(a, b, invert=True)`` is equivalent to (but faster +// than) ``np.invert(np.isin(a, b))``. +// kind : {None, 'sort', 'table'}, optional +// The algorithm to use. This will not affect the final result, +// but will affect the speed and memory use. The default, None, +// will select automatically based on memory considerations. +// +// * If 'sort', will use a mergesort-based approach. This will have +// a memory usage of roughly 6 times the sum of the sizes of +// `ar1` and `ar2`, not accounting for size of dtypes. +// * If 'table', will use a lookup table approach similar +// to a counting sort. This is only available for boolean and +// integer arrays. This will have a memory usage of the +// size of `ar1` plus the max-min value of `ar2`. `assume_unique` +// has no effect when the 'table' option is used. +// * If None, will automatically choose 'table' if +// the required memory allocation is less than or equal to +// 6 times the sum of the sizes of `ar1` and `ar2`, +// otherwise will use 'sort'. This is done to not use +// a large amount of memory by default, even though +// 'table' may be faster in most cases. If 'table' is chosen, +// `assume_unique` will have no effect. +// +// +// Returns +// ------- +// isin : ndarray, bool +// Has the same shape as `element`. The values `element[isin]` +// are in `test_elements`. +// +// See Also +// -------- +// in1d : Flattened version of this function. +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Notes +// ----- +// +// `isin` is an element-wise function version of the python keyword `in`. +// ``isin(a, b)`` is roughly equivalent to +// ``np.array([item in b for item in a])`` if `a` and `b` are 1-D sequences. +// +// `element` and `test_elements` are converted to arrays if they are not +// already. If `test_elements` is a set (or other non-sequence collection) +// it will be converted to an object array with one element, rather than an +// array of the values contained in `test_elements`. This is a consequence +// of the `array` constructor's way of handling non-sequence collections. +// Converting the set to a list usually gives the desired behavior. +// +// Using ``kind='table'`` tends to be faster than `kind='sort'` if the +// following relationship is true: +// ``log10(len(ar2)) > (log10(max(ar2)-min(ar2)) - 2.27) / 0.927``, +// but may use greater memory. The default value for `kind` will +// be automatically selected based only on memory usage, so one may +// manually set ``kind='table'`` if memory constraints can be relaxed. +// +// .. versionadded:: 1.13.0 +// +// Examples +// -------- +// >>> element = 2*np.arange(4).reshape((2, 2)) +// >>> element +// array([[0, 2], +// [4, 6]]) +// >>> test_elements = [1, 2, 4, 8] +// >>> mask = np.isin(element, test_elements) +// >>> mask +// array([[False, True], +// [ True, False]]) +// >>> element[mask] +// array([2, 4]) +// +// The indices of the matched values can be obtained with `nonzero`: +// +// >>> np.nonzero(mask) +// (array([0, 1]), array([1, 0])) +// +// The test can also be inverted: +// +// >>> mask = np.isin(element, test_elements, invert=True) +// >>> mask +// array([[ True, False], +// [False, True]]) +// >>> element[mask] +// array([0, 6]) +// +// Because of how `array` handles sets, the following does not +// work as expected: +// +// >>> test_set = {1, 2, 4, 8} +// >>> np.isin(element, test_set) +// array([[False, False], +// [False, False]]) +// +// Casting the set to a list gives the expected result: +// +// >>> np.isin(element, list(test_set)) +// array([[False, True], +// [ True, False]]) +// +// +//go:linkname Isin py.isin +func Isin(element *py.Object, testElements *py.Object, assumeUnique *py.Object, invert *py.Object) *py.Object +// +// Save an array to a text file. +// +// Parameters +// ---------- +// fname : filename or file handle +// If the filename ends in ``.gz``, the file is automatically saved in +// compressed gzip format. `loadtxt` understands gzipped files +// transparently. +// X : 1D or 2D array_like +// Data to be saved to a text file. +// fmt : str or sequence of strs, optional +// A single format (%10.5f), a sequence of formats, or a +// multi-format string, e.g. 'Iteration %d -- %10.5f', in which +// case `delimiter` is ignored. For complex `X`, the legal options +// for `fmt` are: +// +// * a single specifier, `fmt='%.4e'`, resulting in numbers formatted +// like `' (%s+%sj)' % (fmt, fmt)` +// * a full string specifying every real and imaginary part, e.g. +// `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns +// * a list of specifiers, one per column - in this case, the real +// and imaginary part must have separate specifiers, +// e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns +// delimiter : str, optional +// String or character separating columns. +// newline : str, optional +// String or character separating lines. +// +// .. versionadded:: 1.5.0 +// header : str, optional +// String that will be written at the beginning of the file. +// +// .. versionadded:: 1.7.0 +// footer : str, optional +// String that will be written at the end of the file. +// +// .. versionadded:: 1.7.0 +// comments : str, optional +// String that will be prepended to the ``header`` and ``footer`` strings, +// to mark them as comments. Default: '# ', as expected by e.g. +// ``numpy.loadtxt``. +// +// .. versionadded:: 1.7.0 +// encoding : {None, str}, optional +// Encoding used to encode the outputfile. Does not apply to output +// streams. If the encoding is something other than 'bytes' or 'latin1' +// you will not be able to load the file in NumPy versions < 1.14. Default +// is 'latin1'. +// +// .. versionadded:: 1.14.0 +// +// +// See Also +// -------- +// save : Save an array to a binary file in NumPy ``.npy`` format +// savez : Save several arrays into an uncompressed ``.npz`` archive +// savez_compressed : Save several arrays into a compressed ``.npz`` archive +// +// Notes +// ----- +// Further explanation of the `fmt` parameter +// (``%[flag]width[.precision]specifier``): +// +// flags: +// ``-`` : left justify +// +// ``+`` : Forces to precede result with + or -. +// +// ``0`` : Left pad the number with zeros instead of space (see width). +// +// width: +// Minimum number of characters to be printed. The value is not truncated +// if it has more characters. +// +// precision: +// - For integer specifiers (eg. ``d,i,o,x``), the minimum number of +// digits. +// - For ``e, E`` and ``f`` specifiers, the number of digits to print +// after the decimal point. +// - For ``g`` and ``G``, the maximum number of significant digits. +// - For ``s``, the maximum number of characters. +// +// specifiers: +// ``c`` : character +// +// ``d`` or ``i`` : signed decimal integer +// +// ``e`` or ``E`` : scientific notation with ``e`` or ``E``. +// +// ``f`` : decimal floating point +// +// ``g,G`` : use the shorter of ``e,E`` or ``f`` +// +// ``o`` : signed octal +// +// ``s`` : string of characters +// +// ``u`` : unsigned decimal integer +// +// ``x,X`` : unsigned hexadecimal integer +// +// This explanation of ``fmt`` is not complete, for an exhaustive +// specification see [1]_. +// +// References +// ---------- +// .. [1] `Format Specification Mini-Language +// `_, +// Python Documentation. +// +// Examples +// -------- +// >>> x = y = z = np.arange(0.0,5.0,1.0) +// >>> np.savetxt('test.out', x, delimiter=',') # X is an array +// >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays +// >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation +// +// +// +//go:linkname Savetxt py.savetxt +func Savetxt(fname *py.Object, X *py.Object, fmt *py.Object, delimiter *py.Object, newline *py.Object, header *py.Object, footer *py.Object, comments *py.Object, encoding *py.Object) *py.Object +// +// unpackbits(a, /, axis=None, count=None, bitorder='big') +// +// Unpacks elements of a uint8 array into a binary-valued output array. +// +// Each element of `a` represents a bit-field that should be unpacked +// into a binary-valued output array. The shape of the output array is +// either 1-D (if `axis` is ``None``) or the same shape as the input +// array with unpacking done along the axis specified. +// +// Parameters +// ---------- +// a : ndarray, uint8 type +// Input array. +// axis : int, optional +// The dimension over which bit-unpacking is done. +// ``None`` implies unpacking the flattened array. +// count : int or None, optional +// The number of elements to unpack along `axis`, provided as a way +// of undoing the effect of packing a size that is not a multiple +// of eight. A non-negative number means to only unpack `count` +// bits. A negative number means to trim off that many bits from +// the end. ``None`` means to unpack the entire array (the +// default). Counts larger than the available number of bits will +// add zero padding to the output. Negative counts must not +// exceed the available number of bits. +// +// .. versionadded:: 1.17.0 +// +// bitorder : {'big', 'little'}, optional +// The order of the returned bits. 'big' will mimic bin(val), +// ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse +// the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``. +// Defaults to 'big'. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// unpacked : ndarray, uint8 type +// The elements are binary-valued (0 or 1). +// +// See Also +// -------- +// packbits : Packs the elements of a binary-valued array into bits in +// a uint8 array. +// +// Examples +// -------- +// >>> a = np.array([[2], [7], [23]], dtype=np.uint8) +// >>> a +// array([[ 2], +// [ 7], +// [23]], dtype=uint8) +// >>> b = np.unpackbits(a, axis=1) +// >>> b +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8) +// >>> c = np.unpackbits(a, axis=1, count=-3) +// >>> c +// array([[0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0], +// [0, 0, 0, 1, 0]], dtype=uint8) +// +// >>> p = np.packbits(b, axis=0) +// >>> np.unpackbits(p, axis=0) +// array([[0, 0, 0, 0, 0, 0, 1, 0], +// [0, 0, 0, 0, 0, 1, 1, 1], +// [0, 0, 0, 1, 0, 1, 1, 1], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0], +// [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) +// >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0])) +// True +// +// +// +//go:linkname Unpackbits py.unpackbits +func Unpackbits(a *py.Object, axis *py.Object, count *py.Object, bitorder *py.Object) *py.Object +// +// Return a sorted copy of an array. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// axis : int or None, optional +// Axis along which to sort. If None, the array is flattened before +// sorting. The default is -1, which sorts along the last axis. +// kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional +// Sorting algorithm. The default is 'quicksort'. Note that both 'stable' +// and 'mergesort' use timsort or radix sort under the covers and, in general, +// the actual implementation will vary with data type. The 'mergesort' option +// is retained for backwards compatibility. +// +// .. versionchanged:: 1.15.0. +// The 'stable' option was added. +// +// order : str or list of str, optional +// When `a` is an array with fields defined, this argument specifies +// which fields to compare first, second, etc. A single field can +// be specified as a string, and not all fields need be specified, +// but unspecified fields will still be used, in the order in which +// they come up in the dtype, to break ties. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// ndarray.sort : Method to sort an array in-place. +// argsort : Indirect sort. +// lexsort : Indirect stable sort on multiple keys. +// searchsorted : Find elements in a sorted array. +// partition : Partial sort. +// +// Notes +// ----- +// The various sorting algorithms are characterized by their average speed, +// worst case performance, work space size, and whether they are stable. A +// stable sort keeps items with the same key in the same relative +// order. The four algorithms implemented in NumPy have the following +// properties: +// +// =========== ======= ============= ============ ======== +// kind speed worst case work space stable +// =========== ======= ============= ============ ======== +// 'quicksort' 1 O(n^2) 0 no +// 'heapsort' 3 O(n*log(n)) 0 no +// 'mergesort' 2 O(n*log(n)) ~n/2 yes +// 'timsort' 2 O(n*log(n)) ~n/2 yes +// =========== ======= ============= ============ ======== +// +// .. note:: The datatype determines which of 'mergesort' or 'timsort' +// is actually used, even if 'mergesort' is specified. User selection +// at a finer scale is not currently available. +// +// All the sort algorithms make temporary copies of the data when +// sorting along any but the last axis. Consequently, sorting along +// the last axis is faster and uses less space than sorting along +// any other axis. +// +// The sort order for complex numbers is lexicographic. If both the real +// and imaginary parts are non-nan then the order is determined by the +// real parts except when they are equal, in which case the order is +// determined by the imaginary parts. +// +// Previous to numpy 1.4.0 sorting real and complex arrays containing nan +// values led to undefined behaviour. In numpy versions >= 1.4.0 nan +// values are sorted to the end. The extended sort order is: +// +// * Real: [R, nan] +// * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] +// +// where R is a non-nan real value. Complex values with the same nan +// placements are sorted according to the non-nan part if it exists. +// Non-nan values are sorted as before. +// +// .. versionadded:: 1.12.0 +// +// quicksort has been changed to `introsort `_. +// When sorting does not make enough progress it switches to +// `heapsort `_. +// This implementation makes quicksort O(n*log(n)) in the worst case. +// +// 'stable' automatically chooses the best stable sorting algorithm +// for the data type being sorted. +// It, along with 'mergesort' is currently mapped to +// `timsort `_ +// or `radix sort `_ +// depending on the data type. +// API forward compatibility currently limits the +// ability to select the implementation and it is hardwired for the different +// data types. +// +// .. versionadded:: 1.17.0 +// +// Timsort is added for better performance on already or nearly +// sorted data. On random data timsort is almost identical to +// mergesort. It is now used for stable sort while quicksort is still the +// default sort if none is chosen. For timsort details, refer to +// `CPython listsort.txt `_. +// 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an +// O(n) sort instead of O(n log n). +// +// .. versionchanged:: 1.18.0 +// +// NaT now sorts to the end of arrays for consistency with NaN. +// +// Examples +// -------- +// >>> a = np.array([[1,4],[3,1]]) +// >>> np.sort(a) # sort along the last axis +// array([[1, 4], +// [1, 3]]) +// >>> np.sort(a, axis=None) # sort the flattened array +// array([1, 1, 3, 4]) +// >>> np.sort(a, axis=0) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// Use the `order` keyword to specify a field to use when sorting a +// structured array: +// +// >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] +// >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), +// ... ('Galahad', 1.7, 38)] +// >>> a = np.array(values, dtype=dtype) # create a structured array +// >>> np.sort(a, order='height') # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), +// ('Lancelot', 1.8999999999999999, 38)], +// dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP +// array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), +// ('Arthur', 1.8, 41)], +// dtype=[('name', '|S10'), ('height', '>> a = np.array([[1, 2], [3, 4]]) +// >>> a +// array([[1, 2], +// [3, 4]]) +// >>> np.transpose(a) +// array([[1, 3], +// [2, 4]]) +// +// >>> a = np.array([1, 2, 3, 4]) +// >>> a +// array([1, 2, 3, 4]) +// >>> np.transpose(a) +// array([1, 2, 3, 4]) +// +// >>> a = np.ones((1, 2, 3)) +// >>> np.transpose(a, (1, 0, 2)).shape +// (2, 1, 3) +// +// >>> a = np.ones((2, 3, 4, 5)) +// >>> np.transpose(a).shape +// (5, 4, 3, 2) +// +// +// +//go:linkname Transpose py.transpose +func Transpose(a *py.Object, axes *py.Object) *py.Object +// +// Roll the specified axis backwards, until it lies in a given position. +// +// This function continues to be supported for backward compatibility, but you +// should prefer `moveaxis`. The `moveaxis` function was added in NumPy +// 1.11. +// +// Parameters +// ---------- +// a : ndarray +// Input array. +// axis : int +// The axis to be rolled. The positions of the other axes do not +// change relative to one another. +// start : int, optional +// When ``start <= axis``, the axis is rolled back until it lies in +// this position. When ``start > axis``, the axis is rolled until it +// lies before this position. The default, 0, results in a "complete" +// roll. The following table describes how negative values of ``start`` +// are interpreted: +// +// .. table:: +// :align: left +// +// +-------------------+----------------------+ +// | ``start`` | Normalized ``start`` | +// +===================+======================+ +// | ``-(arr.ndim+1)`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// | ``-arr.ndim`` | 0 | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``-1`` | ``arr.ndim-1`` | +// +-------------------+----------------------+ +// | ``0`` | ``0`` | +// +-------------------+----------------------+ +// | |vdots| | |vdots| | +// +-------------------+----------------------+ +// | ``arr.ndim`` | ``arr.ndim`` | +// +-------------------+----------------------+ +// | ``arr.ndim + 1`` | raise ``AxisError`` | +// +-------------------+----------------------+ +// +// .. |vdots| unicode:: U+22EE .. Vertical Ellipsis +// +// Returns +// ------- +// res : ndarray +// For NumPy >= 1.10.0 a view of `a` is always returned. For earlier +// NumPy versions a view of `a` is returned only if the order of the +// axes is changed, otherwise the input array is returned. +// +// See Also +// -------- +// moveaxis : Move array axes to new positions. +// roll : Roll the elements of an array by a number of positions along a +// given axis. +// +// Examples +// -------- +// >>> a = np.ones((3,4,5,6)) +// >>> np.rollaxis(a, 3, 1).shape +// (3, 6, 4, 5) +// >>> np.rollaxis(a, 2).shape +// (5, 3, 4, 6) +// >>> np.rollaxis(a, 1, 4).shape +// (3, 5, 6, 4) +// +// +// +//go:linkname Rollaxis py.rollaxis +func Rollaxis(a *py.Object, axis *py.Object, start *py.Object) *py.Object +// +// Returns a boolean array where two arrays are element-wise equal within a +// tolerance. +// +// The tolerance values are positive, typically very small numbers. The +// relative difference (`rtol` * abs(`b`)) and the absolute difference +// `atol` are added together to compare against the absolute difference +// between `a` and `b`. +// +// .. warning:: The default `atol` is not appropriate for comparing numbers +// that are much smaller than one (see Notes). +// +// Parameters +// ---------- +// a, b : array_like +// Input arrays to compare. +// rtol : float +// The relative tolerance parameter (see Notes). +// atol : float +// The absolute tolerance parameter (see Notes). +// equal_nan : bool +// Whether to compare NaN's as equal. If True, NaN's in `a` will be +// considered equal to NaN's in `b` in the output array. +// +// Returns +// ------- +// y : array_like +// Returns a boolean array of where `a` and `b` are equal within the +// given tolerance. If both `a` and `b` are scalars, returns a single +// boolean value. +// +// See Also +// -------- +// allclose +// math.isclose +// +// Notes +// ----- +// .. versionadded:: 1.7.0 +// +// For finite values, isclose uses the following equation to test whether +// two floating point values are equivalent. +// +// absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) +// +// Unlike the built-in `math.isclose`, the above equation is not symmetric +// in `a` and `b` -- it assumes `b` is the reference value -- so that +// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore, +// the default value of atol is not zero, and is used to determine what +// small values should be considered close to zero. The default value is +// appropriate for expected values of order unity: if the expected values +// are significantly smaller than one, it can result in false positives. +// `atol` should be carefully selected for the use case at hand. A zero value +// for `atol` will result in `False` if either `a` or `b` is zero. +// +// `isclose` is not defined for non-numeric data types. +// `bool` is considered a numeric data-type for this purpose. +// +// Examples +// -------- +// >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8]) +// array([ True, False]) +// >>> np.isclose([1e10,1e-8], [1.00001e10,1e-9]) +// array([ True, True]) +// >>> np.isclose([1e10,1e-8], [1.0001e10,1e-9]) +// array([False, True]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan]) +// array([ True, False]) +// >>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True) +// array([ True, True]) +// >>> np.isclose([1e-8, 1e-7], [0.0, 0.0]) +// array([ True, False]) +// >>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0) +// array([False, False]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.0]) +// array([ True, True]) +// >>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0) +// array([False, True]) +// +// +//go:linkname Isclose py.isclose +func Isclose(a *py.Object, b *py.Object, rtol *py.Object, atol *py.Object, equalNan *py.Object) *py.Object +// +// Returns the indices of the minimum values along an axis. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// By default, the index is into the flattened array, otherwise +// along the specified axis. +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the array. +// +// .. versionadded:: 1.22.0 +// +// Returns +// ------- +// index_array : ndarray of ints +// Array of indices into the array. It has the same shape as `a.shape` +// with the dimension along `axis` removed. If `keepdims` is set to True, +// then the size of `axis` will be 1 with the resulting array having same +// shape as `a.shape`. +// +// See Also +// -------- +// ndarray.argmin, argmax +// amin : The minimum value along a given axis. +// unravel_index : Convert a flat index into an index tuple. +// take_along_axis : Apply ``np.expand_dims(index_array, axis)`` +// from argmin to an array as if by calling min. +// +// Notes +// ----- +// In case of multiple occurrences of the minimum values, the indices +// corresponding to the first occurrence are returned. +// +// Examples +// -------- +// >>> a = np.arange(6).reshape(2,3) + 10 +// >>> a +// array([[10, 11, 12], +// [13, 14, 15]]) +// >>> np.argmin(a) +// 0 +// >>> np.argmin(a, axis=0) +// array([0, 0, 0]) +// >>> np.argmin(a, axis=1) +// array([0, 0]) +// +// Indices of the minimum elements of a N-dimensional array: +// +// >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) +// >>> ind +// (0, 0) +// >>> a[ind] +// 10 +// +// >>> b = np.arange(6) + 10 +// >>> b[4] = 10 +// >>> b +// array([10, 11, 12, 13, 10, 15]) +// >>> np.argmin(b) # Only the first occurrence is returned. +// 0 +// +// >>> x = np.array([[4,2,3], [1,0,3]]) +// >>> index_array = np.argmin(x, axis=-1) +// >>> # Same as np.amin(x, axis=-1, keepdims=True) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) +// array([[2], +// [0]]) +// >>> # Same as np.amax(x, axis=-1) +// >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) +// array([2, 0]) +// +// Setting `keepdims` to `True`, +// +// >>> x = np.arange(24).reshape((2, 3, 4)) +// >>> res = np.argmin(x, axis=1, keepdims=True) +// >>> res.shape +// (2, 1, 4) +// +// +//go:linkname Argmin py.argmin +func Argmin(a *py.Object, axis *py.Object, out *py.Object) *py.Object +// +// Round an array to the given number of decimals. +// +// `around` is an alias of `~numpy.round`. +// +// See Also +// -------- +// ndarray.round : equivalent method +// round : alias for this function +// ceil, fix, floor, rint, trunc +// +// +// +//go:linkname Around py.around +func Around(a *py.Object, decimals *py.Object, out *py.Object) *py.Object +// fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the absolute values element-wise. +// +// This function returns the absolute values (positive magnitude) of the +// data in `x`. Complex values are not handled, use `absolute` to find the +// absolute values of complex data. +// +// Parameters +// ---------- +// x : array_like +// The array of numbers for which the absolute values are required. If +// `x` is a scalar, the result `y` will also be a scalar. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The absolute values of `x`, the returned values are always floats. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// absolute : Absolute values including `complex` types. +// +// Examples +// -------- +// >>> np.fabs(-1) +// 1.0 +// >>> np.fabs([-1.2, 1.2]) +// array([ 1.2, 1.2]) +// +//go:linkname Fabs py.fabs +func Fabs(x *py.Object, out *py.Object) *py.Object +// remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the element-wise remainder of division. +// +// Computes the remainder complementary to the `floor_divide` function. It is +// equivalent to the Python modulus operator``x1 % x2`` and has the same sign +// as the divisor `x2`. The MATLAB function equivalent to ``np.remainder`` +// is ``mod``. +// +// .. warning:: +// +// This should not be confused with: +// +// * Python 3.7's `math.remainder` and C's ``remainder``, which +// computes the IEEE remainder, which are the complement to +// ``round(x1 / x2)``. +// * The MATLAB ``rem`` function and or the C ``%`` operator which is the +// complement to ``int(x1 / x2)``. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The element-wise remainder of the quotient ``floor_divide(x1, x2)``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// floor_divide : Equivalent of Python ``//`` operator. +// divmod : Simultaneous floor division and remainder. +// fmod : Equivalent of the MATLAB ``rem`` function. +// divide, floor +// +// Notes +// ----- +// Returns 0 when `x2` is 0 and both `x1` and `x2` are (arrays of) +// integers. +// ``mod`` is an alias of ``remainder``. +// +// Examples +// -------- +// >>> np.remainder([4, 7], [2, 3]) +// array([0, 1]) +// >>> np.remainder(np.arange(7), 5) +// array([0, 1, 2, 3, 4, 0, 1]) +// +// The ``%`` operator can be used as a shorthand for ``np.remainder`` on +// ndarrays. +// +// >>> x1 = np.arange(7) +// >>> x1 % 5 +// array([0, 1, 2, 3, 4, 0, 1]) +// +//go:linkname Mod py.mod +func Mod(__llgo_va_list ...interface{}) *py.Object +// asfortranarray(a, dtype=None, *, like=None) +// +// Return an array (ndim >= 1) laid out in Fortran order in memory. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// dtype : str or dtype object, optional +// By default, the data-type is inferred from the input data. +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// The input `a` in Fortran, or column-major, order. +// +// See Also +// -------- +// ascontiguousarray : Convert input to a contiguous (C order) array. +// asanyarray : Convert input to an ndarray with either row or +// column-major memory order. +// require : Return an ndarray that satisfies requirements. +// ndarray.flags : Information about the memory layout of the array. +// +// Examples +// -------- +// Starting with a C-contiguous array: +// +// >>> x = np.ones((2, 3), order='C') +// >>> x.flags['C_CONTIGUOUS'] +// True +// +// Calling ``asfortranarray`` makes a Fortran-contiguous copy: +// +// >>> y = np.asfortranarray(x) +// >>> y.flags['F_CONTIGUOUS'] +// True +// >>> np.may_share_memory(x, y) +// False +// +// Now, starting with a Fortran-contiguous array: +// +// >>> x = np.ones((2, 3), order='F') +// >>> x.flags['F_CONTIGUOUS'] +// True +// +// Then, calling ``asfortranarray`` returns the same object: +// +// >>> y = np.asfortranarray(x) +// >>> x is y +// True +// +// Note: This function returns an array with at least one-dimension (1-d) +// so it will not preserve 0-d arrays. +// +//go:linkname Asfortranarray py.asfortranarray +func Asfortranarray(a *py.Object, dtype *py.Object) *py.Object +// +// Return the number of dimensions of an array. +// +// Parameters +// ---------- +// a : array_like +// Input array. If it is not already an ndarray, a conversion is +// attempted. +// +// Returns +// ------- +// number_of_dimensions : int +// The number of dimensions in `a`. Scalars are zero-dimensional. +// +// See Also +// -------- +// ndarray.ndim : equivalent method +// shape : dimensions of array +// ndarray.shape : dimensions of array +// +// Examples +// -------- +// >>> np.ndim([[1,2,3],[4,5,6]]) +// 2 +// >>> np.ndim(np.array([[1,2,3],[4,5,6]])) +// 2 +// >>> np.ndim(1) +// 0 +// +// +// +//go:linkname Ndim py.ndim +func Ndim(a *py.Object) *py.Object +// lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns the lowest common multiple of ``|x1|`` and ``|x2|`` +// +// Parameters +// ---------- +// x1, x2 : array_like, int +// Arrays of values. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// +// Returns +// ------- +// y : ndarray or scalar +// The lowest common multiple of the absolute value of the inputs +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// gcd : The greatest common divisor +// +// Examples +// -------- +// >>> np.lcm(12, 20) +// 60 +// >>> np.lcm.reduce([3, 12, 20]) +// 60 +// >>> np.lcm.reduce([40, 12, 20]) +// 120 +// >>> np.lcm(np.arange(6), 20) +// array([ 0, 20, 20, 60, 20, 20]) +// +//go:linkname Lcm py.lcm +func Lcm(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the reciprocal of the argument, element-wise. +// +// Calculates ``1/x``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// Return array. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// .. note:: +// This function is not designed to work with integers. +// +// For integer arguments with absolute value larger than 1 the result is +// always zero because of the way Python handles integer division. For +// integer zero the result is an overflow. +// +// Examples +// -------- +// >>> np.reciprocal(2.) +// 0.5 +// >>> np.reciprocal([1, 2., 3.33]) +// array([ 1. , 0.5 , 0.3003003]) +// +//go:linkname Reciprocal py.reciprocal +func Reciprocal(x *py.Object, out *py.Object) *py.Object +// +// Integrate along the given axis using the composite trapezoidal rule. +// +// If `x` is provided, the integration happens in sequence along its +// elements - they are not sorted. +// +// Integrate `y` (`x`) along each 1d slice on the given axis, compute +// :math:`\int y(x) dx`. +// When `x` is specified, this integrates along the parametric curve, +// computing :math:`\int_t y(t) dt = +// \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. +// +// Parameters +// ---------- +// y : array_like +// Input array to integrate. +// x : array_like, optional +// The sample points corresponding to the `y` values. If `x` is None, +// the sample points are assumed to be evenly spaced `dx` apart. The +// default is None. +// dx : scalar, optional +// The spacing between sample points when `x` is None. The default is 1. +// axis : int, optional +// The axis along which to integrate. +// +// Returns +// ------- +// trapz : float or ndarray +// Definite integral of `y` = n-dimensional array as approximated along +// a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, +// then the result is a float. If `n` is greater than 1, then the result +// is an `n`-1 dimensional array. +// +// See Also +// -------- +// sum, cumsum +// +// Notes +// ----- +// Image [2]_ illustrates trapezoidal rule -- y-axis locations of points +// will be taken from `y` array, by default x-axis distances between +// points will be 1.0, alternatively they can be provided with `x` array +// or with `dx` scalar. Return value will be equal to combined area under +// the red lines. +// +// +// References +// ---------- +// .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule +// +// .. [2] Illustration image: +// https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png +// +// Examples +// -------- +// Use the trapezoidal rule on evenly spaced points: +// +// >>> np.trapz([1, 2, 3]) +// 4.0 +// +// The spacing between sample points can be selected by either the +// ``x`` or ``dx`` arguments: +// +// >>> np.trapz([1, 2, 3], x=[4, 6, 8]) +// 8.0 +// >>> np.trapz([1, 2, 3], dx=2) +// 8.0 +// +// Using a decreasing ``x`` corresponds to integrating in reverse: +// +// >>> np.trapz([1, 2, 3], x=[8, 6, 4]) +// -8.0 +// +// More generally ``x`` is used to integrate along a parametric curve. We can +// estimate the integral :math:`\int_0^1 x^2 = 1/3` using: +// +// >>> x = np.linspace(0, 1, num=50) +// >>> y = x**2 +// >>> np.trapz(y, x) +// 0.33340274885464394 +// +// Or estimate the area of a circle, noting we repeat the sample which closes +// the curve: +// +// >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) +// >>> np.trapz(np.cos(theta), x=np.sin(theta)) +// 3.141571941375841 +// +// ``np.trapz`` can be applied along a specified axis to do multiple +// computations in one call: +// +// >>> a = np.arange(6).reshape(2, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5]]) +// >>> np.trapz(a, axis=0) +// array([1.5, 2.5, 3.5]) +// >>> np.trapz(a, axis=1) +// array([2., 8.]) +// +// +//go:linkname Trapz py.trapz +func Trapz(y *py.Object, x *py.Object, dx *py.Object, axis *py.Object) *py.Object +// +// Reverse the order of elements along axis 1 (left/right). +// +// For a 2-D array, this flips the entries in each row in the left/right +// direction. Columns are preserved, but appear in a different order than +// before. +// +// Parameters +// ---------- +// m : array_like +// Input array, must be at least 2-D. +// +// Returns +// ------- +// f : ndarray +// A view of `m` with the columns reversed. Since a view +// is returned, this operation is :math:`\mathcal O(1)`. +// +// See Also +// -------- +// flipud : Flip array in the up/down direction. +// flip : Flip array in one or more dimensions. +// rot90 : Rotate array counterclockwise. +// +// Notes +// ----- +// Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. +// Requires the array to be at least 2-D. +// +// Examples +// -------- +// >>> A = np.diag([1.,2.,3.]) +// >>> A +// array([[1., 0., 0.], +// [0., 2., 0.], +// [0., 0., 3.]]) +// >>> np.fliplr(A) +// array([[0., 0., 1.], +// [0., 2., 0.], +// [3., 0., 0.]]) +// +// >>> A = np.random.randn(2,3,5) +// >>> np.all(np.fliplr(A) == A[:,::-1,...]) +// True +// +// +// +//go:linkname Fliplr py.fliplr +func Fliplr(m *py.Object) *py.Object +// +// Issues a DeprecationWarning, adds warning to `old_name`'s +// docstring, rebinds ``old_name.__name__`` and returns the new +// function object. +// +// This function may also be used as a decorator. +// +// Parameters +// ---------- +// func : function +// The function to be deprecated. +// old_name : str, optional +// The name of the function to be deprecated. Default is None, in +// which case the name of `func` is used. +// new_name : str, optional +// The new name for the function. Default is None, in which case the +// deprecation message is that `old_name` is deprecated. If given, the +// deprecation message is that `old_name` is deprecated and `new_name` +// should be used instead. +// message : str, optional +// Additional explanation of the deprecation. Displayed in the +// docstring after the warning. +// +// Returns +// ------- +// old_func : function +// The deprecated function. +// +// Examples +// -------- +// Note that ``olduint`` returns a value after printing Deprecation +// Warning: +// +// >>> olduint = np.deprecate(np.uint) +// DeprecationWarning: `uint64` is deprecated! # may vary +// >>> olduint(6) +// 6 +// +// +// +//go:linkname Deprecate py.deprecate +func Deprecate(__llgo_va_list ...interface{}) *py.Object +// +// Find the intersection of two arrays. +// +// Return the sorted, unique values that are in both of the input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. Will be flattened if not already 1D. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. If True but ``ar1`` or ``ar2`` are not +// unique, incorrect results and out-of-bounds indices could result. +// Default is False. +// return_indices : bool +// If True, the indices which correspond to the intersection of the two +// arrays are returned. The first instance of a value is used if there are +// multiple. Default is False. +// +// .. versionadded:: 1.15.0 +// +// Returns +// ------- +// intersect1d : ndarray +// Sorted 1D array of common and unique elements. +// comm1 : ndarray +// The indices of the first occurrences of the common values in `ar1`. +// Only provided if `return_indices` is True. +// comm2 : ndarray +// The indices of the first occurrences of the common values in `ar2`. +// Only provided if `return_indices` is True. +// +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// +// Examples +// -------- +// >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1]) +// array([1, 3]) +// +// To intersect more than two arrays, use functools.reduce: +// +// >>> from functools import reduce +// >>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) +// array([3]) +// +// To return the indices of the values common to the input arrays +// along with the intersected values: +// +// >>> x = np.array([1, 1, 2, 3, 4]) +// >>> y = np.array([2, 1, 4, 6]) +// >>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True) +// >>> x_ind, y_ind +// (array([0, 2, 4]), array([1, 0, 2])) +// >>> xy, x[x_ind], y[y_ind] +// (array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4])) +// +// +// +//go:linkname Intersect1d py.intersect1d +func Intersect1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object, returnIndices *py.Object) *py.Object +// +// min_scalar_type(a, /) +// +// For scalar ``a``, returns the data type with the smallest size +// and smallest scalar kind which can hold its value. For non-scalar +// array ``a``, returns the vector's dtype unmodified. +// +// Floating point values are not demoted to integers, +// and complex values are not demoted to floats. +// +// Parameters +// ---------- +// a : scalar or array_like +// The value whose minimal data type is to be found. +// +// Returns +// ------- +// out : dtype +// The minimal data type. +// +// Notes +// ----- +// .. versionadded:: 1.6.0 +// +// See Also +// -------- +// result_type, promote_types, dtype, can_cast +// +// Examples +// -------- +// >>> np.min_scalar_type(10) +// dtype('uint8') +// +// >>> np.min_scalar_type(-260) +// dtype('int16') +// +// >>> np.min_scalar_type(3.1) +// dtype('float16') +// +// >>> np.min_scalar_type(1e50) +// dtype('float64') +// +// >>> np.min_scalar_type(np.arange(4,dtype='f8')) +// dtype('float64') +// +// +// +//go:linkname MinScalarType py.min_scalar_type +func MinScalarType(a *py.Object) *py.Object +// +// Return the indices of the elements that are non-zero. +// +// Returns a tuple of arrays, one for each dimension of `a`, +// containing the indices of the non-zero elements in that +// dimension. The values in `a` are always tested and returned in +// row-major, C-style order. +// +// To group the indices by element, rather than dimension, use `argwhere`, +// which returns a row for each non-zero element. +// +// .. note:: +// +// When called on a zero-d array or scalar, ``nonzero(a)`` is treated +// as ``nonzero(atleast_1d(a))``. +// +// .. deprecated:: 1.17.0 +// +// Use `atleast_1d` explicitly if this behavior is deliberate. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// +// Returns +// ------- +// tuple_of_arrays : tuple +// Indices of elements that are non-zero. +// +// See Also +// -------- +// flatnonzero : +// Return indices that are non-zero in the flattened version of the input +// array. +// ndarray.nonzero : +// Equivalent ndarray method. +// count_nonzero : +// Counts the number of non-zero elements in the input array. +// +// Notes +// ----- +// While the nonzero values can be obtained with ``a[nonzero(a)]``, it is +// recommended to use ``x[x.astype(bool)]`` or ``x[x != 0]`` instead, which +// will correctly handle 0-d arrays. +// +// Examples +// -------- +// >>> x = np.array([[3, 0, 0], [0, 4, 0], [5, 6, 0]]) +// >>> x +// array([[3, 0, 0], +// [0, 4, 0], +// [5, 6, 0]]) +// >>> np.nonzero(x) +// (array([0, 1, 2, 2]), array([0, 1, 0, 1])) +// +// >>> x[np.nonzero(x)] +// array([3, 4, 5, 6]) +// >>> np.transpose(np.nonzero(x)) +// array([[0, 0], +// [1, 1], +// [2, 0], +// [2, 1]]) +// +// A common use for ``nonzero`` is to find the indices of an array, where +// a condition is True. Given an array `a`, the condition `a` > 3 is a +// boolean array and since False is interpreted as 0, np.nonzero(a > 3) +// yields the indices of the `a` where the condition is true. +// +// >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) +// >>> a > 3 +// array([[False, False, False], +// [ True, True, True], +// [ True, True, True]]) +// >>> np.nonzero(a > 3) +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// Using this result to index `a` is equivalent to using the mask directly: +// +// >>> a[np.nonzero(a > 3)] +// array([4, 5, 6, 7, 8, 9]) +// >>> a[a > 3] # prefer this spelling +// array([4, 5, 6, 7, 8, 9]) +// +// ``nonzero`` can also be called as a method of the array. +// +// >>> (a > 3).nonzero() +// (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) +// +// +// +//go:linkname Nonzero py.nonzero +func Nonzero(a *py.Object) *py.Object +// +// Compute the median along the specified axis, while ignoring NaNs. +// +// Returns the median of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array. +// axis : {int, sequence of int, None}, optional +// Axis or axes along which the medians are computed. The default +// is to compute the median along a flattened version of the array. +// A sequence of axes is supported since version 1.9.0. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow use of memory of input array `a` for +// calculations. The input array will be modified by the call to +// `median`. This will save memory when you do not need to preserve +// the contents of the input array. Treat the input as undefined, +// but it will probably be fully or partially sorted. Default is +// False. If `overwrite_input` is ``True`` and `a` is not already an +// `ndarray`, an error will be raised. +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left +// in the result as dimensions with size one. With this option, +// the result will broadcast correctly against the original `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// Returns +// ------- +// median : ndarray +// A new array holding the result. If the input contains integers +// or floats smaller than ``float64``, then the output data-type is +// ``np.float64``. Otherwise, the data-type of the output is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean, median, percentile +// +// Notes +// ----- +// Given a vector ``V`` of length ``N``, the median of ``V`` is the +// middle value of a sorted copy of ``V``, ``V_sorted`` - i.e., +// ``V_sorted[(N-1)/2]``, when ``N`` is odd and the average of the two +// middle values of ``V_sorted`` when ``N`` is even. +// +// Examples +// -------- +// >>> a = np.array([[10.0, 7, 4], [3, 2, 1]]) +// >>> a[0, 1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.median(a) +// nan +// >>> np.nanmedian(a) +// 3.0 +// >>> np.nanmedian(a, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.median(a, axis=1) +// array([nan, 2.]) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// >>> b = a.copy() +// >>> np.nanmedian(b, axis=None, overwrite_input=True) +// 3.0 +// >>> assert not np.all(a==b) +// +// +// +//go:linkname Nanmedian py.nanmedian +func Nanmedian(a *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, keepdims *py.Object) *py.Object +// square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the element-wise square of the input. +// +// Parameters +// ---------- +// x : array_like +// Input data. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise `x*x`, of the same shape and dtype as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// numpy.linalg.matrix_power +// sqrt +// power +// +// Examples +// -------- +// >>> np.square([-1j, 1]) +// array([-1.-0.j, 1.+0.j]) +// +//go:linkname Square py.square +func Square(x *py.Object, out *py.Object) *py.Object +// +// Construct an open mesh from multiple sequences. +// +// This function takes N 1-D sequences and returns N outputs with N +// dimensions each, such that the shape is 1 in all but one dimension +// and the dimension with the non-unit shape value cycles through all +// N dimensions. +// +// Using `ix_` one can quickly construct index arrays that will index +// the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array +// ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. +// +// Parameters +// ---------- +// args : 1-D sequences +// Each sequence should be of integer or boolean type. +// Boolean sequences will be interpreted as boolean masks for the +// corresponding dimension (equivalent to passing in +// ``np.nonzero(boolean_sequence)``). +// +// Returns +// ------- +// out : tuple of ndarrays +// N arrays with N dimensions each, with N the number of input +// sequences. Together these arrays form an open mesh. +// +// See Also +// -------- +// ogrid, mgrid, meshgrid +// +// Examples +// -------- +// >>> a = np.arange(10).reshape(2, 5) +// >>> a +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> ixgrid = np.ix_([0, 1], [2, 4]) +// >>> ixgrid +// (array([[0], +// [1]]), array([[2, 4]])) +// >>> ixgrid[0].shape, ixgrid[1].shape +// ((2, 1), (1, 2)) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// >>> ixgrid = np.ix_([True, True], [2, 4]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) +// >>> a[ixgrid] +// array([[2, 4], +// [7, 9]]) +// +// +// +//go:linkname Ix_ py.ix_ +func Ix_(__llgo_va_list ...interface{}) *py.Object +// +// Return the normalized sinc function. +// +// The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument +// :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not +// only everywhere continuous but also infinitely differentiable. +// +// .. note:: +// +// Note the normalization factor of ``pi`` used in the definition. +// This is the most commonly used definition in signal processing. +// Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function +// :math:`\sin(x)/x` that is more common in mathematics. +// +// Parameters +// ---------- +// x : ndarray +// Array (possibly multi-dimensional) of values for which to calculate +// ``sinc(x)``. +// +// Returns +// ------- +// out : ndarray +// ``sinc(x)``, which has the same shape as the input. +// +// Notes +// ----- +// The name sinc is short for "sine cardinal" or "sinus cardinalis". +// +// The sinc function is used in various signal processing applications, +// including in anti-aliasing, in the construction of a Lanczos resampling +// filter, and in interpolation. +// +// For bandlimited interpolation of discrete-time signals, the ideal +// interpolation kernel is proportional to the sinc function. +// +// References +// ---------- +// .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web +// Resource. http://mathworld.wolfram.com/SincFunction.html +// .. [2] Wikipedia, "Sinc function", +// https://en.wikipedia.org/wiki/Sinc_function +// +// Examples +// -------- +// >>> import matplotlib.pyplot as plt +// >>> x = np.linspace(-4, 4, 41) +// >>> np.sinc(x) +// array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary +// -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, +// 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, +// 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, +// -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, +// 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, +// 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, +// 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, +// 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, +// -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, +// -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, +// 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, +// -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, +// -4.92362781e-02, -3.89804309e-17]) +// +// >>> plt.plot(x, np.sinc(x)) +// [] +// >>> plt.title("Sinc Function") +// Text(0.5, 1.0, 'Sinc Function') +// >>> plt.ylabel("Amplitude") +// Text(0, 0.5, 'Amplitude') +// >>> plt.xlabel("X") +// Text(0.5, 0, 'X') +// >>> plt.show() +// +// +// +//go:linkname Sinc py.sinc +func Sinc(x *py.Object) *py.Object +// +// Return the roots of a polynomial with coefficients given in p. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// The values in the rank-1 array `p` are coefficients of a polynomial. +// If the length of `p` is n+1 then the polynomial is described by:: +// +// p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] +// +// Parameters +// ---------- +// p : array_like +// Rank-1 array of polynomial coefficients. +// +// Returns +// ------- +// out : ndarray +// An array containing the roots of the polynomial. +// +// Raises +// ------ +// ValueError +// When `p` cannot be converted to a rank-1 array. +// +// See also +// -------- +// poly : Find the coefficients of a polynomial with a given sequence +// of roots. +// polyval : Compute polynomial values. +// polyfit : Least squares polynomial fit. +// poly1d : A one-dimensional polynomial class. +// +// Notes +// ----- +// The algorithm relies on computing the eigenvalues of the +// companion matrix [1]_. +// +// References +// ---------- +// .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: +// Cambridge University Press, 1999, pp. 146-7. +// +// Examples +// -------- +// >>> coeff = [3.2, 2, 1] +// >>> np.roots(coeff) +// array([-0.3125+0.46351241j, -0.3125-0.46351241j]) +// +// +// +//go:linkname Roots py.roots +func Roots(p *py.Object) *py.Object +// nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order="K", casting="safe", buffersize=0) +// +// Create nditers for use in nested loops +// +// Create a tuple of `nditer` objects which iterate in nested loops over +// different axes of the op argument. The first iterator is used in the +// outermost loop, the last in the innermost loop. Advancing one will change +// the subsequent iterators to point at its new element. +// +// Parameters +// ---------- +// op : ndarray or sequence of array_like +// The array(s) to iterate over. +// +// axes : list of list of int +// Each item is used as an "op_axes" argument to an nditer +// +// flags, op_flags, op_dtypes, order, casting, buffersize (optional) +// See `nditer` parameters of the same name +// +// Returns +// ------- +// iters : tuple of nditer +// An nditer for each item in `axes`, outermost first +// +// See Also +// -------- +// nditer +// +// Examples +// -------- +// +// Basic usage. Note how y is the "flattened" version of +// [a[:, 0, :], a[:, 1, 0], a[:, 2, :]] since we specified +// the first iter's axes as [1] +// +// >>> a = np.arange(12).reshape(2, 3, 2) +// >>> i, j = np.nested_iters(a, [[1], [0, 2]], flags=["multi_index"]) +// >>> for x in i: +// ... print(i.multi_index) +// ... for y in j: +// ... print('', j.multi_index, y) +// (0,) +// (0, 0) 0 +// (0, 1) 1 +// (1, 0) 6 +// (1, 1) 7 +// (1,) +// (0, 0) 2 +// (0, 1) 3 +// (1, 0) 8 +// (1, 1) 9 +// (2,) +// (0, 0) 4 +// (0, 1) 5 +// (1, 0) 10 +// (1, 1) 11 +// +//go:linkname NestedIters py.nested_iters +func NestedIters(op *py.Object, axes *py.Object, flags *py.Object, opFlags *py.Object, opDtypes *py.Object, order *py.Object, casting *py.Object, buffersize *py.Object) *py.Object +// arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Inverse hyperbolic tangent element-wise. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Array of the same shape as `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// emath.arctanh +// +// Notes +// ----- +// `arctanh` is a multivalued function: for each `x` there are infinitely +// many numbers `z` such that ``tanh(z) = x``. The convention is to return +// the `z` whose imaginary part lies in `[-pi/2, pi/2]`. +// +// For real-valued input data types, `arctanh` always returns real output. +// For each value that cannot be expressed as a real number or infinity, +// it yields ``nan`` and sets the `invalid` floating point error flag. +// +// For complex-valued input, `arctanh` is a complex analytical function +// that has branch cuts `[-1, -inf]` and `[1, inf]` and is continuous from +// above on the former and from below on the latter. +// +// The inverse hyperbolic tangent is also known as `atanh` or ``tanh^-1``. +// +// References +// ---------- +// .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", +// 10th printing, 1964, pp. 86. +// https://personal.math.ubc.ca/~cbm/aands/page_86.htm +// .. [2] Wikipedia, "Inverse hyperbolic function", +// https://en.wikipedia.org/wiki/Arctanh +// +// Examples +// -------- +// >>> np.arctanh([0, -0.5]) +// array([ 0. , -0.54930614]) +// +//go:linkname Arctanh py.arctanh +func Arctanh(x *py.Object, out *py.Object) *py.Object +// signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns element-wise True where signbit is set (less than zero). +// +// Parameters +// ---------- +// x : array_like +// The input value(s). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// result : ndarray of bool +// Output array, or reference to `out` if that was supplied. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> np.signbit(-1.2) +// True +// >>> np.signbit(np.array([1, -2.3, 2.1])) +// array([False, True, False]) +// +//go:linkname Signbit py.signbit +func Signbit(x *py.Object, out *py.Object) *py.Object +// +// Change elements of an array based on conditional and input values. +// +// Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that +// `place` uses the first N elements of `vals`, where N is the number of +// True values in `mask`, while `copyto` uses the elements where `mask` +// is True. +// +// Note that `extract` does the exact opposite of `place`. +// +// Parameters +// ---------- +// arr : ndarray +// Array to put data into. +// mask : array_like +// Boolean mask array. Must have the same size as `a`. +// vals : 1-D sequence +// Values to put into `a`. Only the first N elements are used, where +// N is the number of True values in `mask`. If `vals` is smaller +// than N, it will be repeated, and if elements of `a` are to be masked, +// this sequence must be non-empty. +// +// See Also +// -------- +// copyto, put, take, extract +// +// Examples +// -------- +// >>> arr = np.arange(6).reshape(2, 3) +// >>> np.place(arr, arr>2, [44, 55]) +// >>> arr +// array([[ 0, 1, 2], +// [44, 55, 44]]) +// +// +// +//go:linkname Place py.place +func Place(arr *py.Object, mask *py.Object, vals *py.Object) *py.Object +// +// Returns True if the type of `element` is a scalar type. +// +// Parameters +// ---------- +// element : any +// Input argument, can be of any type and shape. +// +// Returns +// ------- +// val : bool +// True if `element` is a scalar type, False if it is not. +// +// See Also +// -------- +// ndim : Get the number of dimensions of an array +// +// Notes +// ----- +// If you need a stricter way to identify a *numerical* scalar, use +// ``isinstance(x, numbers.Number)``, as that returns ``False`` for most +// non-numerical elements such as strings. +// +// In most cases ``np.ndim(x) == 0`` should be used instead of this function, +// as that will also return true for 0d arrays. This is how numpy overloads +// functions in the style of the ``dx`` arguments to `gradient` and the ``bins`` +// argument to `histogram`. Some key differences: +// +// +--------------------------------------+---------------+-------------------+ +// | x |``isscalar(x)``|``np.ndim(x) == 0``| +// +======================================+===============+===================+ +// | PEP 3141 numeric objects (including | ``True`` | ``True`` | +// | builtins) | | | +// +--------------------------------------+---------------+-------------------+ +// | builtin string and buffer objects | ``True`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other builtin objects, like | ``False`` | ``True`` | +// | `pathlib.Path`, `Exception`, | | | +// | the result of `re.compile` | | | +// +--------------------------------------+---------------+-------------------+ +// | third-party objects like | ``False`` | ``True`` | +// | `matplotlib.figure.Figure` | | | +// +--------------------------------------+---------------+-------------------+ +// | zero-dimensional numpy arrays | ``False`` | ``True`` | +// +--------------------------------------+---------------+-------------------+ +// | other numpy arrays | ``False`` | ``False`` | +// +--------------------------------------+---------------+-------------------+ +// | `list`, `tuple`, and other sequence | ``False`` | ``False`` | +// | objects | | | +// +--------------------------------------+---------------+-------------------+ +// +// Examples +// -------- +// >>> np.isscalar(3.1) +// True +// >>> np.isscalar(np.array(3.1)) +// False +// >>> np.isscalar([3.1]) +// False +// >>> np.isscalar(False) +// True +// >>> np.isscalar('numpy') +// True +// +// NumPy supports PEP 3141 numbers: +// +// >>> from fractions import Fraction +// >>> np.isscalar(Fraction(5, 17)) +// True +// >>> from numbers import Number +// >>> np.isscalar(Number()) +// True +// +// +// +//go:linkname Isscalar py.isscalar +func Isscalar(element *py.Object) *py.Object +// left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Shift the bits of an integer to the left. +// +// Bits are shifted to the left by appending `x2` 0s at the right of `x1`. +// Since the internal representation of numbers is in binary format, this +// operation is equivalent to multiplying `x1` by ``2**x2``. +// +// Parameters +// ---------- +// x1 : array_like of integer type +// Input values. +// x2 : array_like of integer type +// Number of zeros to append to `x1`. Has to be non-negative. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : array of integer type +// Return `x1` with bits shifted `x2` times to the left. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// right_shift : Shift the bits of an integer to the right. +// binary_repr : Return the binary representation of the input number +// as a string. +// +// Examples +// -------- +// >>> np.binary_repr(5) +// '101' +// >>> np.left_shift(5, 2) +// 20 +// >>> np.binary_repr(20) +// '10100' +// +// >>> np.left_shift(5, [1,2,3]) +// array([10, 20, 40]) +// +// Note that the dtype of the second argument may change the dtype of the +// result and can lead to unexpected results in some cases (see +// :ref:`Casting Rules `): +// +// >>> a = np.left_shift(np.uint8(255), 1) # Expect 254 +// >>> print(a, type(a)) # Unexpected result due to upcasting +// 510 +// >>> b = np.left_shift(np.uint8(255), np.uint8(1)) +// >>> print(b, type(b)) +// 254 +// +// The ``<<`` operator can be used as a shorthand for ``np.left_shift`` on +// ndarrays. +// +// >>> x1 = 5 +// >>> x2 = np.array([1, 2, 3]) +// >>> x1 << x2 +// array([10, 20, 40]) +// +//go:linkname LeftShift py.left_shift +func LeftShift(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return (x1 != x2) element-wise. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Input arrays. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Output array, element-wise comparison of `x1` and `x2`. +// Typically of type bool, unless ``dtype=object`` is passed. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// equal, greater, greater_equal, less, less_equal +// +// Examples +// -------- +// >>> np.not_equal([1.,2.], [1., 3.]) +// array([False, True]) +// >>> np.not_equal([1, 2], [[1, 3],[1, 4]]) +// array([[False, True], +// [False, True]]) +// +// The ``!=`` operator can be used as a shorthand for ``np.not_equal`` on +// ndarrays. +// +// >>> a = np.array([1., 2.]) +// >>> b = np.array([1., 3.]) +// >>> a != b +// array([False, True]) +// +//go:linkname NotEqual py.not_equal +func NotEqual(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// seterrobj(errobj, /) +// +// Set the object that defines floating-point error handling. +// +// The error object contains all information that defines the error handling +// behavior in NumPy. `seterrobj` is used internally by the other +// functions that set error handling behavior (`seterr`, `seterrcall`). +// +// Parameters +// ---------- +// errobj : list +// The error object, a list containing three elements: +// [internal numpy buffer size, error mask, error callback function]. +// +// The error mask is a single integer that holds the treatment information +// on all four floating point errors. The information for each error type +// is contained in three bits of the integer. If we print it in base 8, we +// can see what treatment is set for "invalid", "under", "over", and +// "divide" (in that order). The printed string can be interpreted with +// +// * 0 : 'ignore' +// * 1 : 'warn' +// * 2 : 'raise' +// * 3 : 'call' +// * 4 : 'print' +// * 5 : 'log' +// +// See Also +// -------- +// geterrobj, seterr, geterr, seterrcall, geterrcall +// getbufsize, setbufsize +// +// Notes +// ----- +// For complete documentation of the types of floating-point exceptions and +// treatment options, see `seterr`. +// +// Examples +// -------- +// >>> old_errobj = np.geterrobj() # first get the defaults +// >>> old_errobj +// [8192, 521, None] +// +// >>> def err_handler(type, flag): +// ... print("Floating point error (%s), with flag %s" % (type, flag)) +// ... +// >>> new_errobj = [20000, 12, err_handler] +// >>> np.seterrobj(new_errobj) +// >>> np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') +// '14' +// >>> np.geterr() +// {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'} +// >>> np.geterrcall() is err_handler +// True +// +//go:linkname Seterrobj py.seterrobj +func Seterrobj(errobj *py.Object) *py.Object +// +// Return the scalar dtype or NumPy equivalent of Python type of an object. +// +// Parameters +// ---------- +// rep : any +// The object of which the type is returned. +// default : any, optional +// If given, this is returned for objects whose types can not be +// determined. If not given, None is returned for those objects. +// +// Returns +// ------- +// dtype : dtype or Python type +// The data type of `rep`. +// +// See Also +// -------- +// sctype2char, issctype, issubsctype, issubdtype, maximum_sctype +// +// Examples +// -------- +// >>> np.obj2sctype(np.int32) +// +// >>> np.obj2sctype(np.array([1., 2.])) +// +// >>> np.obj2sctype(np.array([1.j])) +// +// +// >>> np.obj2sctype(dict) +// +// >>> np.obj2sctype('string') +// +// >>> np.obj2sctype(1, default=list) +// +// +// +// +//go:linkname Obj2sctype py.obj2sctype +func Obj2sctype(rep *py.Object, Default *py.Object) *py.Object +// +// einsum_path(subscripts, *operands, optimize='greedy') +// +// Evaluates the lowest cost contraction order for an einsum expression by +// considering the creation of intermediate arrays. +// +// Parameters +// ---------- +// subscripts : str +// Specifies the subscripts for summation. +// *operands : list of array_like +// These are the arrays for the operation. +// optimize : {bool, list, tuple, 'greedy', 'optimal'} +// Choose the type of path. If a tuple is provided, the second argument is +// assumed to be the maximum intermediate size created. If only a single +// argument is provided the largest input or output array size is used +// as a maximum intermediate size. +// +// * if a list is given that starts with ``einsum_path``, uses this as the +// contraction path +// * if False no optimization is taken +// * if True defaults to the 'greedy' algorithm +// * 'optimal' An algorithm that combinatorially explores all possible +// ways of contracting the listed tensors and chooses the least costly +// path. Scales exponentially with the number of terms in the +// contraction. +// * 'greedy' An algorithm that chooses the best pair contraction +// at each step. Effectively, this algorithm searches the largest inner, +// Hadamard, and then outer products at each step. Scales cubically with +// the number of terms in the contraction. Equivalent to the 'optimal' +// path for most contractions. +// +// Default is 'greedy'. +// +// Returns +// ------- +// path : list of tuples +// A list representation of the einsum path. +// string_repr : str +// A printable representation of the einsum path. +// +// Notes +// ----- +// The resulting path indicates which terms of the input contraction should be +// contracted first, the result of this contraction is then appended to the +// end of the contraction list. This list can then be iterated over until all +// intermediate contractions are complete. +// +// See Also +// -------- +// einsum, linalg.multi_dot +// +// Examples +// -------- +// +// We can begin with a chain dot example. In this case, it is optimal to +// contract the ``b`` and ``c`` tensors first as represented by the first +// element of the path ``(1, 2)``. The resulting tensor is added to the end +// of the contraction and the remaining contraction ``(0, 1)`` is then +// completed. +// +// >>> np.random.seed(123) +// >>> a = np.random.rand(2, 2) +// >>> b = np.random.rand(2, 5) +// >>> c = np.random.rand(5, 2) +// >>> path_info = np.einsum_path('ij,jk,kl->il', a, b, c, optimize='greedy') +// >>> print(path_info[0]) +// ['einsum_path', (1, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ij,jk,kl->il # may vary +// Naive scaling: 4 +// Optimized scaling: 3 +// Naive FLOP count: 1.600e+02 +// Optimized FLOP count: 5.600e+01 +// Theoretical speedup: 2.857 +// Largest intermediate: 4.000e+00 elements +// ------------------------------------------------------------------------- +// scaling current remaining +// ------------------------------------------------------------------------- +// 3 kl,jk->jl ij,jl->il +// 3 jl,ij->il il->il +// +// +// A more complex index transformation example. +// +// >>> I = np.random.rand(10, 10, 10, 10) +// >>> C = np.random.rand(10, 10) +// >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, +// ... optimize='greedy') +// +// >>> print(path_info[0]) +// ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] +// >>> print(path_info[1]) +// Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary +// Naive scaling: 8 +// Optimized scaling: 5 +// Naive FLOP count: 8.000e+08 +// Optimized FLOP count: 8.000e+05 +// Theoretical speedup: 1000.000 +// Largest intermediate: 1.000e+04 elements +// -------------------------------------------------------------------------- +// scaling current remaining +// -------------------------------------------------------------------------- +// 5 abcd,ea->bcde fb,gc,hd,bcde->efgh +// 5 bcde,fb->cdef gc,hd,cdef->efgh +// 5 cdef,gc->defg hd,defg->efgh +// 5 defg,hd->efgh efgh->efgh +// +// +//go:linkname EinsumPath py.einsum_path +func EinsumPath(__llgo_va_list ...interface{}) *py.Object +// +// Unwrap by taking the complement of large deltas with respect to the period. +// +// This unwraps a signal `p` by changing elements which have an absolute +// difference from their predecessor of more than ``max(discont, period/2)`` +// to their `period`-complementary values. +// +// For the default case where `period` is :math:`2\pi` and `discont` is +// :math:`\pi`, this unwraps a radian phase `p` such that adjacent differences +// are never greater than :math:`\pi` by adding :math:`2k\pi` for some +// integer :math:`k`. +// +// Parameters +// ---------- +// p : array_like +// Input array. +// discont : float, optional +// Maximum discontinuity between values, default is ``period/2``. +// Values below ``period/2`` are treated as if they were ``period/2``. +// To have an effect different from the default, `discont` should be +// larger than ``period/2``. +// axis : int, optional +// Axis along which unwrap will operate, default is the last axis. +// period : float, optional +// Size of the range over which the input wraps. By default, it is +// ``2 pi``. +// +// .. versionadded:: 1.21.0 +// +// Returns +// ------- +// out : ndarray +// Output array. +// +// See Also +// -------- +// rad2deg, deg2rad +// +// Notes +// ----- +// If the discontinuity in `p` is smaller than ``period/2``, +// but larger than `discont`, no unwrapping is done because taking +// the complement would only make the discontinuity larger. +// +// Examples +// -------- +// >>> phase = np.linspace(0, np.pi, num=5) +// >>> phase[3:] += np.pi +// >>> phase +// array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary +// >>> np.unwrap(phase) +// array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) # may vary +// >>> np.unwrap([0, 1, 2, -1, 0], period=4) +// array([0, 1, 2, 3, 4]) +// >>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6) +// array([1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4) +// array([2, 3, 4, 5, 6, 7, 8, 9]) +// >>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180 +// >>> np.unwrap(phase_deg, period=360) +// array([-180., -140., -100., -60., -20., 20., 60., 100., 140., +// 180., 220., 260., 300., 340., 380., 420., 460., 500., +// 540.]) +// +// +//go:linkname Unwrap py.unwrap +func Unwrap(p *py.Object, discont *py.Object, axis *py.Object) *py.Object +// +// Function to calculate only the edges of the bins used by the `histogram` +// function. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines the bin edges, including the rightmost +// edge, allowing for non-uniform bin widths. +// +// If `bins` is a string from the list below, `histogram_bin_edges` will use +// the method chosen to calculate the optimal bin width and +// consequently the number of bins (see `Notes` for more detail on +// the estimators) from the data that falls within the requested +// range. While the bin width will be optimal for the actual data +// in the range, the number of bins will be computed to fill the +// entire range, including the empty portions. For visualisation, +// using the 'auto' option is suggested. Weighted data is not +// supported for automated bin size selection. +// +// 'auto' +// Maximum of the 'sturges' and 'fd' estimators. Provides good +// all around performance. +// +// 'fd' (Freedman Diaconis Estimator) +// Robust (resilient to outliers) estimator that takes into +// account data variability and data size. +// +// 'doane' +// An improved version of Sturges' estimator that works better +// with non-normal datasets. +// +// 'scott' +// Less robust estimator that takes into account data variability +// and data size. +// +// 'stone' +// Estimator based on leave-one-out cross-validation estimate of +// the integrated squared error. Can be regarded as a generalization +// of Scott's rule. +// +// 'rice' +// Estimator does not take variability into account, only data +// size. Commonly overestimates number of bins required. +// +// 'sturges' +// R's default method, only accounts for data size. Only +// optimal for gaussian data and underestimates number of bins +// for large non-gaussian datasets. +// +// 'sqrt' +// Square root (of data size) estimator, used by Excel and +// other programs for its speed and simplicity. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). This is currently not used by any of the bin estimators, +// but may be in the future. +// +// Returns +// ------- +// bin_edges : array of dtype float +// The edges to pass into `histogram` +// +// See Also +// -------- +// histogram +// +// Notes +// ----- +// The methods to estimate the optimal number of bins are well founded +// in literature, and are inspired by the choices R provides for +// histogram visualisation. Note that having the number of bins +// proportional to :math:`n^{1/3}` is asymptotically optimal, which is +// why it appears in most estimators. These are simply plug-in methods +// that give good starting points for number of bins. In the equations +// below, :math:`h` is the binwidth and :math:`n_h` is the number of +// bins. All estimators that compute bin counts are recast to bin width +// using the `ptp` of the data. The final bin count is obtained from +// ``np.round(np.ceil(range / h))``. The final bin width is often less +// than what is returned by the estimators below. +// +// 'auto' (maximum of the 'sturges' and 'fd' estimators) +// A compromise to get a good value. For small datasets the Sturges +// value will usually be chosen, while larger datasets will usually +// default to FD. Avoids the overly conservative behaviour of FD +// and Sturges for small and large datasets respectively. +// Switchover point is usually :math:`a.size \approx 1000`. +// +// 'fd' (Freedman Diaconis Estimator) +// .. math:: h = 2 \frac{IQR}{n^{1/3}} +// +// The binwidth is proportional to the interquartile range (IQR) +// and inversely proportional to cube root of a.size. Can be too +// conservative for small datasets, but is quite good for large +// datasets. The IQR is very robust to outliers. +// +// 'scott' +// .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} +// +// The binwidth is proportional to the standard deviation of the +// data and inversely proportional to cube root of ``x.size``. Can +// be too conservative for small datasets, but is quite good for +// large datasets. The standard deviation is not very robust to +// outliers. Values are very similar to the Freedman-Diaconis +// estimator in the absence of outliers. +// +// 'rice' +// .. math:: n_h = 2n^{1/3} +// +// The number of bins is only proportional to cube root of +// ``a.size``. It tends to overestimate the number of bins and it +// does not take into account data variability. +// +// 'sturges' +// .. math:: n_h = \log _{2}(n) + 1 +// +// The number of bins is the base 2 log of ``a.size``. This +// estimator assumes normality of data and is too conservative for +// larger, non-normal datasets. This is the default method in R's +// ``hist`` method. +// +// 'doane' +// .. math:: n_h = 1 + \log_{2}(n) + +// \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) +// +// g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] +// +// \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} +// +// An improved version of Sturges' formula that produces better +// estimates for non-normal datasets. This estimator attempts to +// account for the skew of the data. +// +// 'sqrt' +// .. math:: n_h = \sqrt n +// +// The simplest and fastest estimator. Only takes into account the +// data size. +// +// Examples +// -------- +// >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) +// >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) +// array([0. , 0.25, 0.5 , 0.75, 1. ]) +// >>> np.histogram_bin_edges(arr, bins=2) +// array([0. , 2.5, 5. ]) +// +// For consistency with histogram, an array of pre-computed bins is +// passed through unmodified: +// +// >>> np.histogram_bin_edges(arr, [1, 2]) +// array([1, 2]) +// +// This function allows one set of bins to be computed, and reused across +// multiple histograms: +// +// >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') +// >>> shared_bins +// array([0., 1., 2., 3., 4., 5.]) +// +// >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) +// >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) +// >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) +// +// >>> hist_0; hist_1 +// array([1, 1, 0, 1, 0]) +// array([2, 0, 1, 1, 2]) +// +// Which gives more easily comparable results than using separate bins for +// each histogram: +// +// >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') +// >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') +// >>> hist_0; hist_1 +// array([1, 1, 1]) +// array([2, 1, 1, 2]) +// >>> bins_0; bins_1 +// array([0., 1., 2., 3.]) +// array([0. , 1.25, 2.5 , 3.75, 5. ]) +// +// +// +//go:linkname HistogramBinEdges py.histogram_bin_edges +func HistogramBinEdges(a *py.Object, bins *py.Object, Range *py.Object, weights *py.Object) *py.Object +// +// shares_memory(a, b, /, max_work=None) +// +// Determine if two arrays share memory. +// +// .. warning:: +// +// This function can be exponentially slow for some inputs, unless +// `max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``. +// If in doubt, use `numpy.may_share_memory` instead. +// +// Parameters +// ---------- +// a, b : ndarray +// Input arrays +// max_work : int, optional +// Effort to spend on solving the overlap problem (maximum number +// of candidate solutions to consider). The following special +// values are recognized: +// +// max_work=MAY_SHARE_EXACT (default) +// The problem is solved exactly. In this case, the function returns +// True only if there is an element shared between the arrays. Finding +// the exact solution may take extremely long in some cases. +// max_work=MAY_SHARE_BOUNDS +// Only the memory bounds of a and b are checked. +// +// Raises +// ------ +// numpy.exceptions.TooHardError +// Exceeded max_work. +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// may_share_memory +// +// Examples +// -------- +// >>> x = np.array([1, 2, 3, 4]) +// >>> np.shares_memory(x, np.array([5, 6, 7])) +// False +// >>> np.shares_memory(x[::2], x) +// True +// >>> np.shares_memory(x[::2], x[1::2]) +// False +// +// Checking whether two arrays share memory is NP-complete, and +// runtime may increase exponentially in the number of +// dimensions. Hence, `max_work` should generally be set to a finite +// number, as it is possible to construct examples that take +// extremely long to run: +// +// >>> from numpy.lib.stride_tricks import as_strided +// >>> x = np.zeros([192163377], dtype=np.int8) +// >>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049)) +// >>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1)) +// >>> np.shares_memory(x1, x2, max_work=1000) +// Traceback (most recent call last): +// ... +// numpy.exceptions.TooHardError: Exceeded max_work +// +// Running ``np.shares_memory(x1, x2)`` without `max_work` set takes +// around 1 minute for this case. It is possible to find problems +// that take still significantly longer. +// +// +// +//go:linkname SharesMemory py.shares_memory +func SharesMemory(a *py.Object, b *py.Object, maxWork *py.Object) *py.Object +// +// Return evenly spaced numbers over a specified interval. +// +// Returns `num` evenly spaced samples, calculated over the +// interval [`start`, `stop`]. +// +// The endpoint of the interval can optionally be excluded. +// +// .. versionchanged:: 1.16.0 +// Non-scalar `start` and `stop` are now supported. +// +// .. versionchanged:: 1.20.0 +// Values are rounded towards ``-inf`` instead of ``0`` when an +// integer ``dtype`` is specified. The old behavior can +// still be obtained with ``np.linspace(start, stop, num).astype(int)`` +// +// Parameters +// ---------- +// start : array_like +// The starting value of the sequence. +// stop : array_like +// The end value of the sequence, unless `endpoint` is set to False. +// In that case, the sequence consists of all but the last of ``num + 1`` +// evenly spaced samples, so that `stop` is excluded. Note that the step +// size changes when `endpoint` is False. +// num : int, optional +// Number of samples to generate. Default is 50. Must be non-negative. +// endpoint : bool, optional +// If True, `stop` is the last sample. Otherwise, it is not included. +// Default is True. +// retstep : bool, optional +// If True, return (`samples`, `step`), where `step` is the spacing +// between samples. +// dtype : dtype, optional +// The type of the output array. If `dtype` is not given, the data type +// is inferred from `start` and `stop`. The inferred dtype will never be +// an integer; `float` is chosen even if the arguments would produce an +// array of integers. +// +// .. versionadded:: 1.9.0 +// +// axis : int, optional +// The axis in the result to store the samples. Relevant only if start +// or stop are array-like. By default (0), the samples will be along a +// new axis inserted at the beginning. Use -1 to get an axis at the end. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// samples : ndarray +// There are `num` equally spaced samples in the closed interval +// ``[start, stop]`` or the half-open interval ``[start, stop)`` +// (depending on whether `endpoint` is True or False). +// step : float, optional +// Only returned if `retstep` is True +// +// Size of spacing between samples. +// +// +// See Also +// -------- +// arange : Similar to `linspace`, but uses a step size (instead of the +// number of samples). +// geomspace : Similar to `linspace`, but with numbers spaced evenly on a log +// scale (a geometric progression). +// logspace : Similar to `geomspace`, but with the end points specified as +// logarithms. +// :ref:`how-to-partition` +// +// Examples +// -------- +// >>> np.linspace(2.0, 3.0, num=5) +// array([2. , 2.25, 2.5 , 2.75, 3. ]) +// >>> np.linspace(2.0, 3.0, num=5, endpoint=False) +// array([2. , 2.2, 2.4, 2.6, 2.8]) +// >>> np.linspace(2.0, 3.0, num=5, retstep=True) +// (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) +// +// Graphical illustration: +// +// >>> import matplotlib.pyplot as plt +// >>> N = 8 +// >>> y = np.zeros(N) +// >>> x1 = np.linspace(0, 10, N, endpoint=True) +// >>> x2 = np.linspace(0, 10, N, endpoint=False) +// >>> plt.plot(x1, y, 'o') +// [] +// >>> plt.plot(x2, y + 0.5, 'o') +// [] +// >>> plt.ylim([-0.5, 1]) +// (-0.5, 1) +// >>> plt.show() +// +// +// +//go:linkname Linspace py.linspace +func Linspace(start *py.Object, stop *py.Object, num *py.Object, endpoint *py.Object, retstep *py.Object, dtype *py.Object, axis *py.Object) *py.Object +// +// Find the product of two polynomials. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Finds the polynomial resulting from the multiplication of the two input +// polynomials. Each input must be either a poly1d object or a 1D sequence +// of polynomial coefficients, from highest to lowest degree. +// +// Parameters +// ---------- +// a1, a2 : array_like or poly1d object +// Input polynomials. +// +// Returns +// ------- +// out : ndarray or poly1d object +// The polynomial resulting from the multiplication of the inputs. If +// either inputs is a poly1d object, then the output is also a poly1d +// object. Otherwise, it is a 1D array of polynomial coefficients from +// highest to lowest degree. +// +// See Also +// -------- +// poly1d : A one-dimensional polynomial class. +// poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, polyval +// convolve : Array convolution. Same output as polymul, but has parameter +// for overlap mode. +// +// Examples +// -------- +// >>> np.polymul([1, 2, 3], [9, 5, 1]) +// array([ 9, 23, 38, 17, 3]) +// +// Using poly1d objects: +// +// >>> p1 = np.poly1d([1, 2, 3]) +// >>> p2 = np.poly1d([9, 5, 1]) +// >>> print(p1) +// 2 +// 1 x + 2 x + 3 +// >>> print(p2) +// 2 +// 9 x + 5 x + 1 +// >>> print(np.polymul(p1, p2)) +// 4 3 2 +// 9 x + 23 x + 38 x + 17 x + 3 +// +// +// +//go:linkname Polymul py.polymul +func Polymul(a1 *py.Object, a2 *py.Object) *py.Object +// +// Print information about various resources in the system +// including available intrinsic support and BLAS/LAPACK library +// in use +// +// .. versionadded:: 1.24.0 +// +// See Also +// -------- +// show_config : Show libraries in the system on which NumPy was built. +// +// Notes +// ----- +// 1. Information is derived with the help of `threadpoolctl `_ +// library if available. +// 2. SIMD related information is derived from ``__cpu_features__``, +// ``__cpu_baseline__`` and ``__cpu_dispatch__`` +// +// +// +//go:linkname ShowRuntime py.show_runtime +func ShowRuntime() *py.Object +// +// Construct an array from an index array and a list of arrays to choose from. +// +// First of all, if confused or uncertain, definitely look at the Examples - +// in its full generality, this function is less simple than it might +// seem from the following code description (below ndi = +// `numpy.lib.index_tricks`): +// +// ``np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)])``. +// +// But this omits some subtleties. Here is a fully general summary: +// +// Given an "index" array (`a`) of integers and a sequence of ``n`` arrays +// (`choices`), `a` and each choice array are first broadcast, as necessary, +// to arrays of a common shape; calling these *Ba* and *Bchoices[i], i = +// 0,...,n-1* we have that, necessarily, ``Ba.shape == Bchoices[i].shape`` +// for each ``i``. Then, a new array with shape ``Ba.shape`` is created as +// follows: +// +// * if ``mode='raise'`` (the default), then, first of all, each element of +// ``a`` (and thus ``Ba``) must be in the range ``[0, n-1]``; now, suppose +// that ``i`` (in that range) is the value at the ``(j0, j1, ..., jm)`` +// position in ``Ba`` - then the value at the same position in the new array +// is the value in ``Bchoices[i]`` at that same position; +// +// * if ``mode='wrap'``, values in `a` (and thus `Ba`) may be any (signed) +// integer; modular arithmetic is used to map integers outside the range +// `[0, n-1]` back into that range; and then the new array is constructed +// as above; +// +// * if ``mode='clip'``, values in `a` (and thus ``Ba``) may be any (signed) +// integer; negative integers are mapped to 0; values greater than ``n-1`` +// are mapped to ``n-1``; and then the new array is constructed as above. +// +// Parameters +// ---------- +// a : int array +// This array must contain integers in ``[0, n-1]``, where ``n`` is the +// number of choices, unless ``mode=wrap`` or ``mode=clip``, in which +// cases any integers are permissible. +// choices : sequence of arrays +// Choice arrays. `a` and all of the choices must be broadcastable to the +// same shape. If `choices` is itself an array (not recommended), then +// its outermost dimension (i.e., the one corresponding to +// ``choices.shape[0]``) is taken as defining the "sequence". +// out : array, optional +// If provided, the result will be inserted into this array. It should +// be of the appropriate shape and dtype. Note that `out` is always +// buffered if ``mode='raise'``; use other modes for better performance. +// mode : {'raise' (default), 'wrap', 'clip'}, optional +// Specifies how indices outside ``[0, n-1]`` will be treated: +// +// * 'raise' : an exception is raised +// * 'wrap' : value becomes value mod ``n`` +// * 'clip' : values < 0 are mapped to 0, values > n-1 are mapped to n-1 +// +// Returns +// ------- +// merged_array : array +// The merged result. +// +// Raises +// ------ +// ValueError: shape mismatch +// If `a` and each choice array are not all broadcastable to the same +// shape. +// +// See Also +// -------- +// ndarray.choose : equivalent method +// numpy.take_along_axis : Preferable if `choices` is an array +// +// Notes +// ----- +// To reduce the chance of misinterpretation, even though the following +// "abuse" is nominally supported, `choices` should neither be, nor be +// thought of as, a single array, i.e., the outermost sequence-like container +// should be either a list or a tuple. +// +// Examples +// -------- +// +// >>> choices = [[0, 1, 2, 3], [10, 11, 12, 13], +// ... [20, 21, 22, 23], [30, 31, 32, 33]] +// >>> np.choose([2, 3, 1, 0], choices +// ... # the first element of the result will be the first element of the +// ... # third (2+1) "array" in choices, namely, 20; the second element +// ... # will be the second element of the fourth (3+1) choice array, i.e., +// ... # 31, etc. +// ... ) +// array([20, 31, 12, 3]) +// >>> np.choose([2, 4, 1, 0], choices, mode='clip') # 4 goes to 3 (4-1) +// array([20, 31, 12, 3]) +// >>> # because there are 4 choice arrays +// >>> np.choose([2, 4, 1, 0], choices, mode='wrap') # 4 goes to (4 mod 4) +// array([20, 1, 12, 3]) +// >>> # i.e., 0 +// +// A couple examples illustrating how choose broadcasts: +// +// >>> a = [[1, 0, 1], [0, 1, 0], [1, 0, 1]] +// >>> choices = [-10, 10] +// >>> np.choose(a, choices) +// array([[ 10, -10, 10], +// [-10, 10, -10], +// [ 10, -10, 10]]) +// +// >>> # With thanks to Anne Archibald +// >>> a = np.array([0, 1]).reshape((2,1,1)) +// >>> c1 = np.array([1, 2, 3]).reshape((1,3,1)) +// >>> c2 = np.array([-1, -2, -3, -4, -5]).reshape((1,1,5)) +// >>> np.choose(a, (c1, c2)) # result is 2x3x5, res[0,:,:]=c1, res[1,:,:]=c2 +// array([[[ 1, 1, 1, 1, 1], +// [ 2, 2, 2, 2, 2], +// [ 3, 3, 3, 3, 3]], +// [[-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5], +// [-1, -2, -3, -4, -5]]]) +// +// +// +//go:linkname Choose py.choose +func Choose(a *py.Object, choices *py.Object, out *py.Object, mode *py.Object) *py.Object +// exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate `2**p` for all `p` in the input array. +// +// Parameters +// ---------- +// x : array_like +// Input values. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Element-wise 2 to the power `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// power +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// +// +// Examples +// -------- +// >>> np.exp2([2, 3]) +// array([ 4., 8.]) +// +//go:linkname Exp2 py.exp2 +func Exp2(x *py.Object, out *py.Object) *py.Object +// +// Return the imaginary part of the complex argument. +// +// Parameters +// ---------- +// val : array_like +// Input array. +// +// Returns +// ------- +// out : ndarray or scalar +// The imaginary component of the complex argument. If `val` is real, +// the type of `val` is used for the output. If `val` has complex +// elements, the returned type is float. +// +// See Also +// -------- +// real, angle, real_if_close +// +// Examples +// -------- +// >>> a = np.array([1+2j, 3+4j, 5+6j]) +// >>> a.imag +// array([2., 4., 6.]) +// >>> a.imag = np.array([8, 10, 12]) +// >>> a +// array([1. +8.j, 3.+10.j, 5.+12.j]) +// >>> np.imag(1 + 1j) +// 1.0 +// +// +// +//go:linkname Imag py.imag +func Imag(val *py.Object) *py.Object +// +// Find the set exclusive-or of two arrays. +// +// Return the sorted, unique values that are in only one (not both) of the +// input arrays. +// +// Parameters +// ---------- +// ar1, ar2 : array_like +// Input arrays. +// assume_unique : bool +// If True, the input arrays are both assumed to be unique, which +// can speed up the calculation. Default is False. +// +// Returns +// ------- +// setxor1d : ndarray +// Sorted 1D array of unique values that are in only one of the input +// arrays. +// +// Examples +// -------- +// >>> a = np.array([1, 2, 3, 2, 4]) +// >>> b = np.array([2, 3, 5, 7, 5]) +// >>> np.setxor1d(a,b) +// array([1, 4, 5, 7]) +// +// +// +//go:linkname Setxor1d py.setxor1d +func Setxor1d(ar1 *py.Object, ar2 *py.Object, assumeUnique *py.Object) *py.Object +// Fill the main diagonal of the given array of any dimensionality. +// +// For an array `a` with ``a.ndim >= 2``, the diagonal is the list of +// locations with indices ``a[i, ..., i]`` all identical. This function +// modifies the input array in-place, it does not return a value. +// +// Parameters +// ---------- +// a : array, at least 2-D. +// Array whose diagonal is to be filled, it gets modified in-place. +// +// val : scalar or array_like +// Value(s) to write on the diagonal. If `val` is scalar, the value is +// written along the diagonal. If array-like, the flattened `val` is +// written along the diagonal, repeating if necessary to fill all +// diagonal entries. +// +// wrap : bool +// For tall matrices in NumPy version up to 1.6.2, the +// diagonal "wrapped" after N columns. You can have this behavior +// with this option. This affects only tall matrices. +// +// See also +// -------- +// diag_indices, diag_indices_from +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// This functionality can be obtained via `diag_indices`, but internally +// this version uses a much faster implementation that never constructs the +// indices and uses simple slicing. +// +// Examples +// -------- +// >>> a = np.zeros((3, 3), int) +// >>> np.fill_diagonal(a, 5) +// >>> a +// array([[5, 0, 0], +// [0, 5, 0], +// [0, 0, 5]]) +// +// The same function can operate on a 4-D array: +// +// >>> a = np.zeros((3, 3, 3, 3), int) +// >>> np.fill_diagonal(a, 4) +// +// We only show a few blocks for clarity: +// +// >>> a[0, 0] +// array([[4, 0, 0], +// [0, 0, 0], +// [0, 0, 0]]) +// >>> a[1, 1] +// array([[0, 0, 0], +// [0, 4, 0], +// [0, 0, 0]]) +// >>> a[2, 2] +// array([[0, 0, 0], +// [0, 0, 0], +// [0, 0, 4]]) +// +// The wrap option affects only tall matrices: +// +// >>> # tall matrices no wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [0, 0, 0]]) +// +// >>> # tall matrices wrap +// >>> a = np.zeros((5, 3), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0], +// [0, 4, 0], +// [0, 0, 4], +// [0, 0, 0], +// [4, 0, 0]]) +// +// >>> # wide matrices +// >>> a = np.zeros((3, 5), int) +// >>> np.fill_diagonal(a, 4, wrap=True) +// >>> a +// array([[4, 0, 0, 0, 0], +// [0, 4, 0, 0, 0], +// [0, 0, 4, 0, 0]]) +// +// The anti-diagonal can be filled by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.zeros((3, 3), int); +// >>> np.fill_diagonal(np.fliplr(a), [1,2,3]) # Horizontal flip +// >>> a +// array([[0, 0, 1], +// [0, 2, 0], +// [3, 0, 0]]) +// >>> np.fill_diagonal(np.flipud(a), [1,2,3]) # Vertical flip +// >>> a +// array([[0, 0, 3], +// [0, 2, 0], +// [1, 0, 0]]) +// +// Note that the order in which the diagonal is filled varies depending +// on the flip function. +// +// +//go:linkname FillDiagonal py.fill_diagonal +func FillDiagonal(a *py.Object, val *py.Object, wrap *py.Object) *py.Object +// compare_chararrays(a1, a2, cmp, rstrip) +// +// Performs element-wise comparison of two string arrays using the +// comparison operator specified by `cmp_op`. +// +// Parameters +// ---------- +// a1, a2 : array_like +// Arrays to be compared. +// cmp : {"<", "<=", "==", ">=", ">", "!="} +// Type of comparison. +// rstrip : Boolean +// If True, the spaces at the end of Strings are removed before the comparison. +// +// Returns +// ------- +// out : ndarray +// The output array of type Boolean with the same shape as a and b. +// +// Raises +// ------ +// ValueError +// If `cmp_op` is not valid. +// TypeError +// If at least one of `a` or `b` is a non-string array +// +// Examples +// -------- +// >>> a = np.array(["a", "b", "cde"]) +// >>> b = np.array(["a", "a", "dec"]) +// >>> np.compare_chararrays(a, b, ">", True) +// array([False, True, False]) +// +//go:linkname CompareChararrays py.compare_chararrays +func CompareChararrays(a1 *py.Object, a2 *py.Object, cmp *py.Object, rstrip *py.Object) *py.Object +// +// Clip (limit) the values in an array. +// +// Given an interval, values outside the interval are clipped to +// the interval edges. For example, if an interval of ``[0, 1]`` +// is specified, values smaller than 0 become 0, and values larger +// than 1 become 1. +// +// Equivalent to but faster than ``np.minimum(a_max, np.maximum(a, a_min))``. +// +// No check is performed to ensure ``a_min < a_max``. +// +// Parameters +// ---------- +// a : array_like +// Array containing elements to clip. +// a_min, a_max : array_like or None +// Minimum and maximum value. If ``None``, clipping is not performed on +// the corresponding edge. Only one of `a_min` and `a_max` may be +// ``None``. Both are broadcast against `a`. +// out : ndarray, optional +// The results will be placed in this array. It may be the input +// array for in-place clipping. `out` must be of the right shape +// to hold the output. Its type is preserved. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// .. versionadded:: 1.17.0 +// +// Returns +// ------- +// clipped_array : ndarray +// An array with the elements of `a`, but where values +// < `a_min` are replaced with `a_min`, and those > `a_max` +// with `a_max`. +// +// See Also +// -------- +// :ref:`ufuncs-output-type` +// +// Notes +// ----- +// When `a_min` is greater than `a_max`, `clip` returns an +// array in which all values are equal to `a_max`, +// as shown in the second example. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, 1, 8) +// array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) +// >>> np.clip(a, 8, 1) +// array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) +// >>> np.clip(a, 3, 6, out=a) +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a +// array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6]) +// >>> a = np.arange(10) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) +// array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) +// +// +// +//go:linkname Clip py.clip +func Clip(a *py.Object, aMin *py.Object, aMax *py.Object, out *py.Object) *py.Object +// +// Return specified diagonals. +// +// If `a` is 2-D, returns the diagonal of `a` with the given offset, +// i.e., the collection of elements of the form ``a[i, i+offset]``. If +// `a` has more than two dimensions, then the axes specified by `axis1` +// and `axis2` are used to determine the 2-D sub-array whose diagonal is +// returned. The shape of the resulting array can be determined by +// removing `axis1` and `axis2` and appending an index to the right equal +// to the size of the resulting diagonals. +// +// In versions of NumPy prior to 1.7, this function always returned a new, +// independent array containing a copy of the values in the diagonal. +// +// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, +// but depending on this fact is deprecated. Writing to the resulting +// array continues to work as it used to, but a FutureWarning is issued. +// +// Starting in NumPy 1.9 it returns a read-only view on the original array. +// Attempting to write to the resulting array will produce an error. +// +// In some future release, it will return a read/write view and writing to +// the returned array will alter your original array. The returned array +// will have the same type as the input array. +// +// If you don't write to the array returned by this function, then you can +// just ignore all of the above. +// +// If you depend on the current behavior, then we suggest copying the +// returned array explicitly, i.e., use ``np.diagonal(a).copy()`` instead +// of just ``np.diagonal(a)``. This will work with both past and future +// versions of NumPy. +// +// Parameters +// ---------- +// a : array_like +// Array from which the diagonals are taken. +// offset : int, optional +// Offset of the diagonal from the main diagonal. Can be positive or +// negative. Defaults to main diagonal (0). +// axis1 : int, optional +// Axis to be used as the first axis of the 2-D sub-arrays from which +// the diagonals should be taken. Defaults to first axis (0). +// axis2 : int, optional +// Axis to be used as the second axis of the 2-D sub-arrays from +// which the diagonals should be taken. Defaults to second axis (1). +// +// Returns +// ------- +// array_of_diagonals : ndarray +// If `a` is 2-D, then a 1-D array containing the diagonal and of the +// same type as `a` is returned unless `a` is a `matrix`, in which case +// a 1-D array rather than a (2-D) `matrix` is returned in order to +// maintain backward compatibility. +// +// If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` +// are removed, and a new axis inserted at the end corresponding to the +// diagonal. +// +// Raises +// ------ +// ValueError +// If the dimension of `a` is less than 2. +// +// See Also +// -------- +// diag : MATLAB work-a-like for 1-D and 2-D arrays. +// diagflat : Create diagonal arrays. +// trace : Sum along diagonals. +// +// Examples +// -------- +// >>> a = np.arange(4).reshape(2,2) +// >>> a +// array([[0, 1], +// [2, 3]]) +// >>> a.diagonal() +// array([0, 3]) +// >>> a.diagonal(1) +// array([1]) +// +// A 3-D example: +// +// >>> a = np.arange(8).reshape(2,2,2); a +// array([[[0, 1], +// [2, 3]], +// [[4, 5], +// [6, 7]]]) +// >>> a.diagonal(0, # Main diagonals of two arrays created by skipping +// ... 0, # across the outer(left)-most axis last and +// ... 1) # the "middle" (row) axis first. +// array([[0, 6], +// [1, 7]]) +// +// The sub-arrays whose main diagonals we just obtained; note that each +// corresponds to fixing the right-most (column) axis, and that the +// diagonals are "packed" in rows. +// +// >>> a[:,:,0] # main diagonal is [0 6] +// array([[0, 2], +// [4, 6]]) +// >>> a[:,:,1] # main diagonal is [1 7] +// array([[1, 3], +// [5, 7]]) +// +// The anti-diagonal can be obtained by reversing the order of elements +// using either `numpy.flipud` or `numpy.fliplr`. +// +// >>> a = np.arange(9).reshape(3, 3) +// >>> a +// array([[0, 1, 2], +// [3, 4, 5], +// [6, 7, 8]]) +// >>> np.fliplr(a).diagonal() # Horizontal flip +// array([2, 4, 6]) +// >>> np.flipud(a).diagonal() # Vertical flip +// array([6, 4, 2]) +// +// Note that the order in which the diagonal is retrieved varies depending +// on the flip function. +// +// +//go:linkname Diagonal py.diagonal +func Diagonal(a *py.Object, offset *py.Object, axis1 *py.Object, axis2 *py.Object) *py.Object +// cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the cube-root of an array, element-wise. +// +// .. versionadded:: 1.10.0 +// +// Parameters +// ---------- +// x : array_like +// The values whose cube-roots are required. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// An array of the same shape as `x`, containing the cube +// cube-root of each element in `x`. +// If `out` was provided, `y` is a reference to it. +// This is a scalar if `x` is a scalar. +// +// +// Examples +// -------- +// >>> np.cbrt([1,8,27]) +// array([ 1., 2., 3.]) +// +//go:linkname Cbrt py.cbrt +func Cbrt(x *py.Object, out *py.Object) *py.Object +// sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Hyperbolic sine, element-wise. +// +// Equivalent to ``1/2 * (np.exp(x) - np.exp(-x))`` or +// ``-1j * np.sin(1j*x)``. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray +// The corresponding hyperbolic sine values. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// If `out` is provided, the function writes the result into it, +// and returns a reference to `out`. (See Examples) +// +// References +// ---------- +// M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. +// New York, NY: Dover, 1972, pg. 83. +// +// Examples +// -------- +// >>> np.sinh(0) +// 0.0 +// >>> np.sinh(np.pi*1j/2) +// 1j +// >>> np.sinh(np.pi*1j) # (exact value is 0) +// 1.2246063538223773e-016j +// >>> # Discrepancy due to vagaries of floating point arithmetic. +// +// >>> # Example of providing the optional output parameter +// >>> out1 = np.array([0], dtype='d') +// >>> out2 = np.sinh([0.1], out1) +// >>> out2 is out1 +// True +// +// >>> # Example of ValueError due to provision of shape mis-matched `out` +// >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) +// Traceback (most recent call last): +// File "", line 1, in +// ValueError: operands could not be broadcast together with shapes (3,3) (2,2) +// +//go:linkname Sinh py.sinh +func Sinh(x *py.Object, out *py.Object) *py.Object +// +// Return the indices to access the main diagonal of an n-dimensional array. +// +// See `diag_indices` for full details. +// +// Parameters +// ---------- +// arr : array, at least 2-D +// +// See Also +// -------- +// diag_indices +// +// Notes +// ----- +// .. versionadded:: 1.4.0 +// +// Examples +// -------- +// +// Create a 4 by 4 array. +// +// >>> a = np.arange(16).reshape(4, 4) +// >>> a +// array([[ 0, 1, 2, 3], +// [ 4, 5, 6, 7], +// [ 8, 9, 10, 11], +// [12, 13, 14, 15]]) +// +// Get the indices of the diagonal elements. +// +// >>> di = np.diag_indices_from(a) +// >>> di +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// >>> a[di] +// array([ 0, 5, 10, 15]) +// +// This is simply syntactic sugar for diag_indices. +// +// >>> np.diag_indices(a.shape[0]) +// (array([0, 1, 2, 3]), array([0, 1, 2, 3])) +// +// +// +//go:linkname DiagIndicesFrom py.diag_indices_from +func DiagIndicesFrom(arr *py.Object) *py.Object +// +// Return the derivative of the specified order of a polynomial. +// +// .. note:: +// This forms part of the old polynomial API. Since version 1.4, the +// new polynomial API defined in `numpy.polynomial` is preferred. +// A summary of the differences can be found in the +// :doc:`transition guide `. +// +// Parameters +// ---------- +// p : poly1d or sequence +// Polynomial to differentiate. +// A sequence is interpreted as polynomial coefficients, see `poly1d`. +// m : int, optional +// Order of differentiation (default: 1) +// +// Returns +// ------- +// der : poly1d +// A new polynomial representing the derivative. +// +// See Also +// -------- +// polyint : Anti-derivative of a polynomial. +// poly1d : Class for one-dimensional polynomials. +// +// Examples +// -------- +// The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is: +// +// >>> p = np.poly1d([1,1,1,1]) +// >>> p2 = np.polyder(p) +// >>> p2 +// poly1d([3, 2, 1]) +// +// which evaluates to: +// +// >>> p2(2.) +// 17.0 +// +// We can verify this, approximating the derivative with +// ``(f(x + h) - f(x))/h``: +// +// >>> (p(2. + 0.001) - p(2.)) / 0.001 +// 17.007000999997857 +// +// The fourth-order derivative of a 3rd-order polynomial is zero: +// +// >>> np.polyder(p, 2) +// poly1d([6, 2]) +// >>> np.polyder(p, 3) +// poly1d([6]) +// >>> np.polyder(p, 4) +// poly1d([0]) +// +// +// +//go:linkname Polyder py.polyder +func Polyder(p *py.Object, m *py.Object) *py.Object +// +// Find indices where elements should be inserted to maintain order. +// +// Find the indices into a sorted array `a` such that, if the +// corresponding elements in `v` were inserted before the indices, the +// order of `a` would be preserved. +// +// Assuming that `a` is sorted: +// +// ====== ============================ +// `side` returned index `i` satisfies +// ====== ============================ +// left ``a[i-1] < v <= a[i]`` +// right ``a[i-1] <= v < a[i]`` +// ====== ============================ +// +// Parameters +// ---------- +// a : 1-D array_like +// Input array. If `sorter` is None, then it must be sorted in +// ascending order, otherwise `sorter` must be an array of indices +// that sort it. +// v : array_like +// Values to insert into `a`. +// side : {'left', 'right'}, optional +// If 'left', the index of the first suitable location found is given. +// If 'right', return the last such index. If there is no suitable +// index, return either 0 or N (where N is the length of `a`). +// sorter : 1-D array_like, optional +// Optional array of integer indices that sort array a into ascending +// order. They are typically the result of argsort. +// +// .. versionadded:: 1.7.0 +// +// Returns +// ------- +// indices : int or array of ints +// Array of insertion points with the same shape as `v`, +// or an integer if `v` is a scalar. +// +// See Also +// -------- +// sort : Return a sorted copy of an array. +// histogram : Produce histogram from 1-D data. +// +// Notes +// ----- +// Binary search is used to find the required insertion points. +// +// As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing +// `nan` values. The enhanced sort order is documented in `sort`. +// +// This function uses the same algorithm as the builtin python `bisect.bisect_left` +// (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, +// which is also vectorized in the `v` argument. +// +// Examples +// -------- +// >>> np.searchsorted([1,2,3,4,5], 3) +// 2 +// >>> np.searchsorted([1,2,3,4,5], 3, side='right') +// 3 +// >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) +// array([0, 5, 1, 2]) +// +// +// +//go:linkname Searchsorted py.searchsorted +func Searchsorted(a *py.Object, v *py.Object, side *py.Object, sorter *py.Object) *py.Object +// +// Returns True if first argument is a typecode lower/equal in type hierarchy. +// +// This is like the builtin :func:`issubclass`, but for `dtype`\ s. +// +// Parameters +// ---------- +// arg1, arg2 : dtype_like +// `dtype` or object coercible to one +// +// Returns +// ------- +// out : bool +// +// See Also +// -------- +// :ref:`arrays.scalars` : Overview of the numpy type hierarchy. +// issubsctype, issubclass_ +// +// Examples +// -------- +// `issubdtype` can be used to check the type of arrays: +// +// >>> ints = np.array([1, 2, 3], dtype=np.int32) +// >>> np.issubdtype(ints.dtype, np.integer) +// True +// >>> np.issubdtype(ints.dtype, np.floating) +// False +// +// >>> floats = np.array([1, 2, 3], dtype=np.float32) +// >>> np.issubdtype(floats.dtype, np.integer) +// False +// >>> np.issubdtype(floats.dtype, np.floating) +// True +// +// Similar types of different sizes are not subdtypes of each other: +// +// >>> np.issubdtype(np.float64, np.float32) +// False +// >>> np.issubdtype(np.float32, np.float64) +// False +// +// but both are subtypes of `floating`: +// +// >>> np.issubdtype(np.float64, np.floating) +// True +// >>> np.issubdtype(np.float32, np.floating) +// True +// +// For convenience, dtype-like objects are allowed too: +// +// >>> np.issubdtype('S1', np.string_) +// True +// >>> np.issubdtype('i4', np.signedinteger) +// True +// +// +// +//go:linkname Issubdtype py.issubdtype +func Issubdtype(arg1 *py.Object, arg2 *py.Object) *py.Object +// +// unravel_index(indices, shape, order='C') +// +// Converts a flat index or array of flat indices into a tuple +// of coordinate arrays. +// +// Parameters +// ---------- +// indices : array_like +// An integer array whose elements are indices into the flattened +// version of an array of dimensions ``shape``. Before version 1.6.0, +// this function accepted just one index value. +// shape : tuple of ints +// The shape of the array to use for unraveling ``indices``. +// +// .. versionchanged:: 1.16.0 +// Renamed from ``dims`` to ``shape``. +// +// order : {'C', 'F'}, optional +// Determines whether the indices should be viewed as indexing in +// row-major (C-style) or column-major (Fortran-style) order. +// +// .. versionadded:: 1.6.0 +// +// Returns +// ------- +// unraveled_coords : tuple of ndarray +// Each array in the tuple has the same shape as the ``indices`` +// array. +// +// See Also +// -------- +// ravel_multi_index +// +// Examples +// -------- +// >>> np.unravel_index([22, 41, 37], (7,6)) +// (array([3, 6, 6]), array([4, 5, 1])) +// >>> np.unravel_index([31, 41, 13], (7,6), order='F') +// (array([3, 6, 6]), array([4, 5, 1])) +// +// >>> np.unravel_index(1621, (6,7,8,9)) +// (3, 1, 4, 1) +// +// +// +//go:linkname UnravelIndex py.unravel_index +func UnravelIndex(indices *py.Object, shape *py.Object, order *py.Object) *py.Object +// positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Numerical positive, element-wise. +// +// .. versionadded:: 1.13.0 +// +// Parameters +// ---------- +// x : array_like or scalar +// Input array. +// +// Returns +// ------- +// y : ndarray or scalar +// Returned array or scalar: `y = +x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// Equivalent to `x.copy()`, but only defined for types that support +// arithmetic. +// +// Examples +// -------- +// +// >>> x1 = np.array(([1., -1.])) +// >>> np.positive(x1) +// array([ 1., -1.]) +// +// The unary ``+`` operator can be used as a shorthand for ``np.positive`` on +// ndarrays. +// +// >>> x1 = np.array(([1., -1.])) +// >>> +x1 +// array([ 1., -1.]) +// +//go:linkname Positive py.positive +func Positive(x *py.Object, out *py.Object) *py.Object +// datetime_data(dtype, /) +// +// Get information about the step size of a date or time type. +// +// The returned tuple can be passed as the second argument of `numpy.datetime64` and +// `numpy.timedelta64`. +// +// Parameters +// ---------- +// dtype : dtype +// The dtype object, which must be a `datetime64` or `timedelta64` type. +// +// Returns +// ------- +// unit : str +// The :ref:`datetime unit ` on which this dtype +// is based. +// count : int +// The number of base units in a step. +// +// Examples +// -------- +// >>> dt_25s = np.dtype('timedelta64[25s]') +// >>> np.datetime_data(dt_25s) +// ('s', 25) +// >>> np.array(10, dt_25s).astype('timedelta64[s]') +// array(250, dtype='timedelta64[s]') +// +// The result can be used to construct a datetime that uses the same units +// as a timedelta +// +// >>> np.datetime64('2010', np.datetime_data(dt_25s)) +// numpy.datetime64('2010-01-01T00:00:00','25s') +// +//go:linkname DatetimeData py.datetime_data +func DatetimeData(dtype *py.Object) *py.Object +// +// Set a Python function to be used when pretty printing arrays. +// +// Parameters +// ---------- +// f : function or None +// Function to be used to pretty print arrays. The function should expect +// a single array argument and return a string of the representation of +// the array. If None, the function is reset to the default NumPy function +// to print arrays. +// repr : bool, optional +// If True (default), the function for pretty printing (``__repr__``) +// is set, if False the function that returns the default string +// representation (``__str__``) is set. +// +// See Also +// -------- +// set_printoptions, get_printoptions +// +// Examples +// -------- +// >>> def pprint(arr): +// ... return 'HA! - What are you going to do now?' +// ... +// >>> np.set_string_function(pprint) +// >>> a = np.arange(10) +// >>> a +// HA! - What are you going to do now? +// >>> _ = a +// >>> # [0 1 2 3 4 5 6 7 8 9] +// +// We can reset the function to the default: +// +// >>> np.set_string_function(None) +// >>> a +// array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) +// +// `repr` affects either pretty printing or normal string representation. +// Note that ``__repr__`` is still affected by setting ``__str__`` +// because the width of each array element in the returned string becomes +// equal to the length of the result of ``__str__()``. +// +// >>> x = np.arange(4) +// >>> np.set_string_function(lambda x:'random', repr=False) +// >>> x.__str__() +// 'random' +// >>> x.__repr__() +// 'array([0, 1, 2, 3])' +// +// +// +//go:linkname SetStringFunction py.set_string_function +func SetStringFunction(f *py.Object, repr *py.Object) *py.Object +// +// Compute the q-th percentile of the data along the specified axis. +// +// Returns the q-th percentile(s) of the array elements. +// +// Parameters +// ---------- +// a : array_like of real numbers +// Input array or object that can be converted to an array. +// q : array_like of float +// Percentage or sequence of percentages for the percentiles to compute. +// Values must be between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The +// default is to compute the percentile(s) along a flattened +// version of the array. +// +// .. versionchanged:: 1.9.0 +// A tuple of axes is supported +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output, +// but the type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by intermediate +// calculations, to save memory. In this case, the contents of the input +// `a` after this function completes is undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// .. versionadded:: 1.9.0 +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// mean +// median : equivalent to ``percentile(..., 50)`` +// nanpercentile +// quantile : equivalent to percentile, except q in the range [0, 1]. +// +// Notes +// ----- +// Given a vector ``V`` of length ``n``, the q-th percentile of ``V`` is +// the value ``q/100`` of the way from the minimum to the maximum in a +// sorted copy of ``V``. The values and distances of the two nearest +// neighbors as well as the `method` parameter will determine the +// percentile if the normalized ranking does not match the location of +// ``q`` exactly. This function is the same as the median if ``q=50``, the +// same as the minimum if ``q=0`` and the same as the maximum if +// ``q=100``. +// +// The optional `method` parameter specifies the method to use when the +// desired percentile lies between two indexes ``i`` and ``j = i + 1``. +// In that case, we first determine ``i + g``, a virtual index that lies +// between ``i`` and ``j``, where ``i`` is the floor and ``g`` is the +// fractional part of the index. The final result is, then, an interpolation +// of ``a[i]`` and ``a[j]`` based on ``g``. During the computation of ``g``, +// ``i`` and ``j`` are modified using correction constants ``alpha`` and +// ``beta`` whose choices depend on the ``method`` used. Finally, note that +// since Python uses 0-based indexing, the code subtracts another 1 from the +// index internally. +// +// The following formula determines the virtual index ``i + g``, the location +// of the percentile in the sorted sample: +// +// .. math:: +// i + g = (q / 100) * ( n - alpha - beta + 1 ) + alpha +// +// The different methods then work as follows +// +// inverted_cdf: +// method 1 of H&F [1]_. +// This method gives discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then take i +// +// averaged_inverted_cdf: +// method 2 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 ; then average between bounds +// +// closest_observation: +// method 3 of H&F [1]_. +// This method give discontinuous results: +// +// * if g > 0 ; then take j +// * if g = 0 and index is odd ; then take j +// * if g = 0 and index is even ; then take i +// +// interpolated_inverted_cdf: +// method 4 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 1 +// +// hazen: +// method 5 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1/2 +// * beta = 1/2 +// +// weibull: +// method 6 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 0 +// * beta = 0 +// +// linear: +// method 7 of H&F [1]_. +// This method give continuous results using: +// +// * alpha = 1 +// * beta = 1 +// +// median_unbiased: +// method 8 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is unknown (see reference). +// This method give continuous results using: +// +// * alpha = 1/3 +// * beta = 1/3 +// +// normal_unbiased: +// method 9 of H&F [1]_. +// This method is probably the best method if the sample +// distribution function is known to be normal. +// This method give continuous results using: +// +// * alpha = 3/8 +// * beta = 3/8 +// +// lower: +// NumPy method kept for backwards compatibility. +// Takes ``i`` as the interpolation point. +// +// higher: +// NumPy method kept for backwards compatibility. +// Takes ``j`` as the interpolation point. +// +// nearest: +// NumPy method kept for backwards compatibility. +// Takes ``i`` or ``j``, whichever is nearest. +// +// midpoint: +// NumPy method kept for backwards compatibility. +// Uses ``(i + j) / 2``. +// +// Examples +// -------- +// >>> a = np.array([[10, 7, 4], [3, 2, 1]]) +// >>> a +// array([[10, 7, 4], +// [ 3, 2, 1]]) +// >>> np.percentile(a, 50) +// 3.5 +// >>> np.percentile(a, 50, axis=0) +// array([6.5, 4.5, 2.5]) +// >>> np.percentile(a, 50, axis=1) +// array([7., 2.]) +// >>> np.percentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// +// >>> m = np.percentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.percentile(a, 50, axis=0, out=out) +// array([6.5, 4.5, 2.5]) +// >>> m +// array([6.5, 4.5, 2.5]) +// +// >>> b = a.copy() +// >>> np.percentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a == b) +// +// The different methods can be visualized graphically: +// +// .. plot:: +// +// import matplotlib.pyplot as plt +// +// a = np.arange(4) +// p = np.linspace(0, 100, 6001) +// ax = plt.gca() +// lines = [ +// ('linear', '-', 'C0'), +// ('inverted_cdf', ':', 'C1'), +// # Almost the same as `inverted_cdf`: +// ('averaged_inverted_cdf', '-.', 'C1'), +// ('closest_observation', ':', 'C2'), +// ('interpolated_inverted_cdf', '--', 'C1'), +// ('hazen', '--', 'C3'), +// ('weibull', '-.', 'C4'), +// ('median_unbiased', '--', 'C5'), +// ('normal_unbiased', '-.', 'C6'), +// ] +// for method, style, color in lines: +// ax.plot( +// p, np.percentile(a, p, method=method), +// label=method, linestyle=style, color=color) +// ax.set( +// title='Percentiles for different methods and data: ' + str(a), +// xlabel='Percentile', +// ylabel='Estimated percentile value', +// yticks=a) +// ax.legend(bbox_to_anchor=(1.03, 1)) +// plt.tight_layout() +// plt.show() +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Percentile py.percentile +func Percentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Calculate the n-th discrete difference along the given axis. +// +// The first difference is given by ``out[i] = a[i+1] - a[i]`` along +// the given axis, higher differences are calculated by using `diff` +// recursively. +// +// Parameters +// ---------- +// a : array_like +// Input array +// n : int, optional +// The number of times values are differenced. If zero, the input +// is returned as-is. +// axis : int, optional +// The axis along which the difference is taken, default is the +// last axis. +// prepend, append : array_like, optional +// Values to prepend or append to `a` along axis prior to +// performing the difference. Scalar values are expanded to +// arrays with length 1 in the direction of axis and the shape +// of the input array in along all other axes. Otherwise the +// dimension and shape must match `a` except along axis. +// +// .. versionadded:: 1.16.0 +// +// Returns +// ------- +// diff : ndarray +// The n-th differences. The shape of the output is the same as `a` +// except along `axis` where the dimension is smaller by `n`. The +// type of the output is the same as the type of the difference +// between any two elements of `a`. This is the same as the type of +// `a` in most cases. A notable exception is `datetime64`, which +// results in a `timedelta64` output array. +// +// See Also +// -------- +// gradient, ediff1d, cumsum +// +// Notes +// ----- +// Type is preserved for boolean arrays, so the result will contain +// `False` when consecutive elements are the same and `True` when they +// differ. +// +// For unsigned integer arrays, the results will also be unsigned. This +// should not be surprising, as the result is consistent with +// calculating the difference directly: +// +// >>> u8_arr = np.array([1, 0], dtype=np.uint8) +// >>> np.diff(u8_arr) +// array([255], dtype=uint8) +// >>> u8_arr[1,...] - u8_arr[0,...] +// 255 +// +// If this is not desirable, then the array should be cast to a larger +// integer type first: +// +// >>> i16_arr = u8_arr.astype(np.int16) +// >>> np.diff(i16_arr) +// array([-1], dtype=int16) +// +// Examples +// -------- +// >>> x = np.array([1, 2, 4, 7, 0]) +// >>> np.diff(x) +// array([ 1, 2, 3, -7]) +// >>> np.diff(x, n=2) +// array([ 1, 1, -10]) +// +// >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) +// >>> np.diff(x) +// array([[2, 3, 4], +// [5, 1, 2]]) +// >>> np.diff(x, axis=0) +// array([[-1, 2, 0, -2]]) +// +// >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) +// >>> np.diff(x) +// array([1, 1], dtype='timedelta64[D]') +// +// +// +//go:linkname Diff py.diff +func Diff(a *py.Object, n *py.Object, axis *py.Object, prepend *py.Object, append *py.Object) *py.Object +// +// Print the NumPy arrays in the given dictionary. +// +// If there is no dictionary passed in or `vardict` is None then returns +// NumPy arrays in the globals() dictionary (all NumPy arrays in the +// namespace). +// +// Parameters +// ---------- +// vardict : dict, optional +// A dictionary possibly containing ndarrays. Default is globals(). +// +// Returns +// ------- +// out : None +// Returns 'None'. +// +// Notes +// ----- +// Prints out the name, shape, bytes and type of all of the ndarrays +// present in `vardict`. +// +// Examples +// -------- +// >>> a = np.arange(10) +// >>> b = np.ones(20) +// >>> np.who() +// Name Shape Bytes Type +// =========================================================== +// a 10 80 int64 +// b 20 160 float64 +// Upper bound on total bytes = 240 +// +// >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', +// ... 'idx':5} +// >>> np.who(d) +// Name Shape Bytes Type +// =========================================================== +// x 2 16 float64 +// y 3 24 float64 +// Upper bound on total bytes = 40 +// +// +// +//go:linkname Who py.who +func Who(vardict *py.Object) *py.Object +// +// Find the unique elements of an array. +// +// Returns the sorted unique elements of an array. There are three optional +// outputs in addition to the unique elements: +// +// * the indices of the input array that give the unique values +// * the indices of the unique array that reconstruct the input array +// * the number of times each unique value comes up in the input array +// +// Parameters +// ---------- +// ar : array_like +// Input array. Unless `axis` is specified, this will be flattened if it +// is not already 1-D. +// return_index : bool, optional +// If True, also return the indices of `ar` (along the specified axis, +// if provided, or in the flattened array) that result in the unique array. +// return_inverse : bool, optional +// If True, also return the indices of the unique array (for the specified +// axis, if provided) that can be used to reconstruct `ar`. +// return_counts : bool, optional +// If True, also return the number of times each unique item appears +// in `ar`. +// axis : int or None, optional +// The axis to operate on. If None, `ar` will be flattened. If an integer, +// the subarrays indexed by the given axis will be flattened and treated +// as the elements of a 1-D array with the dimension of the given axis, +// see the notes for more details. Object arrays or structured arrays +// that contain objects are not supported if the `axis` kwarg is used. The +// default is None. +// +// .. versionadded:: 1.13.0 +// +// equal_nan : bool, optional +// If True, collapses multiple NaN values in the return array into one. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// unique : ndarray +// The sorted unique values. +// unique_indices : ndarray, optional +// The indices of the first occurrences of the unique values in the +// original array. Only provided if `return_index` is True. +// unique_inverse : ndarray, optional +// The indices to reconstruct the original array from the +// unique array. Only provided if `return_inverse` is True. +// unique_counts : ndarray, optional +// The number of times each of the unique values comes up in the +// original array. Only provided if `return_counts` is True. +// +// .. versionadded:: 1.9.0 +// +// See Also +// -------- +// numpy.lib.arraysetops : Module with a number of other functions for +// performing set operations on arrays. +// repeat : Repeat elements of an array. +// +// Notes +// ----- +// When an axis is specified the subarrays indexed by the axis are sorted. +// This is done by making the specified axis the first dimension of the array +// (move the axis to the first dimension to keep the order of the other axes) +// and then flattening the subarrays in C order. The flattened subarrays are +// then viewed as a structured type with each element given a label, with the +// effect that we end up with a 1-D array of structured types that can be +// treated in the same way as any other 1-D array. The result is that the +// flattened subarrays are sorted in lexicographic order starting with the +// first element. +// +// .. versionchanged: NumPy 1.21 +// If nan values are in the input array, a single nan is put +// to the end of the sorted unique values. +// +// Also for complex arrays all NaN values are considered equivalent +// (no matter whether the NaN is in the real or imaginary part). +// As the representant for the returned array the smallest one in the +// lexicographical order is chosen - see np.sort for how the lexicographical +// order is defined for complex arrays. +// +// Examples +// -------- +// >>> np.unique([1, 1, 2, 2, 3, 3]) +// array([1, 2, 3]) +// >>> a = np.array([[1, 1], [2, 3]]) +// >>> np.unique(a) +// array([1, 2, 3]) +// +// Return the unique rows of a 2D array +// +// >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) +// >>> np.unique(a, axis=0) +// array([[1, 0, 0], [2, 3, 4]]) +// +// Return the indices of the original array that give the unique values: +// +// >>> a = np.array(['a', 'b', 'b', 'c', 'a']) +// >>> u, indices = np.unique(a, return_index=True) +// >>> u +// array(['a', 'b', 'c'], dtype='>> indices +// array([0, 1, 3]) +// >>> a[indices] +// array(['a', 'b', 'c'], dtype='>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> u, indices = np.unique(a, return_inverse=True) +// >>> u +// array([1, 2, 3, 4, 6]) +// >>> indices +// array([0, 1, 4, 3, 1, 2, 1]) +// >>> u[indices] +// array([1, 2, 6, 4, 2, 3, 2]) +// +// Reconstruct the input values from the unique values and counts: +// +// >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) +// >>> values, counts = np.unique(a, return_counts=True) +// >>> values +// array([1, 2, 3, 4, 6]) +// >>> counts +// array([1, 3, 1, 1, 1]) +// >>> np.repeat(values, counts) +// array([1, 2, 2, 2, 3, 4, 6]) # original order not preserved +// +// +// +//go:linkname Unique py.unique +func Unique(ar *py.Object, returnIndex *py.Object, returnInverse *py.Object, returnCounts *py.Object, axis *py.Object) *py.Object +// +// Check for a complex type or an array of complex numbers. +// +// The type of the input is checked, not the value. Even if the input +// has an imaginary part equal to zero, `iscomplexobj` evaluates to True. +// +// Parameters +// ---------- +// x : any +// The input can be of any type and shape. +// +// Returns +// ------- +// iscomplexobj : bool +// The return value, True if `x` is of a complex type or has at least +// one complex element. +// +// See Also +// -------- +// isrealobj, iscomplex +// +// Examples +// -------- +// >>> np.iscomplexobj(1) +// False +// >>> np.iscomplexobj(1+0j) +// True +// >>> np.iscomplexobj([3, 1+0j, True]) +// True +// +// +// +//go:linkname Iscomplexobj py.iscomplexobj +func Iscomplexobj(x *py.Object) *py.Object +// +// If input is complex with all imaginary parts close to zero, return +// real parts. +// +// "Close to zero" is defined as `tol` * (machine epsilon of the type for +// `a`). +// +// Parameters +// ---------- +// a : array_like +// Input array. +// tol : float +// Tolerance in machine epsilons for the complex part of the elements +// in the array. If the tolerance is <=1, then the absolute tolerance +// is used. +// +// Returns +// ------- +// out : ndarray +// If `a` is real, the type of `a` is used for the output. If `a` +// has complex elements, the returned type is float. +// +// See Also +// -------- +// real, imag, angle +// +// Notes +// ----- +// Machine epsilon varies from machine to machine and between data types +// but Python floats on most platforms have a machine epsilon equal to +// 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print +// out the machine epsilon for floats. +// +// Examples +// -------- +// >>> np.finfo(float).eps +// 2.2204460492503131e-16 # may vary +// +// >>> np.real_if_close([2.1 + 4e-14j, 5.2 + 3e-15j], tol=1000) +// array([2.1, 5.2]) +// >>> np.real_if_close([2.1 + 4e-13j, 5.2 + 3e-15j], tol=1000) +// array([2.1+4.e-13j, 5.2 + 3e-15j]) +// +// +// +//go:linkname RealIfClose py.real_if_close +func RealIfClose(a *py.Object, tol *py.Object) *py.Object +// +// Split an array into multiple sub-arrays horizontally (column-wise). +// +// Please refer to the `split` documentation. `hsplit` is equivalent +// to `split` with ``axis=1``, the array is always split along the second +// axis except for 1-D arrays, where it is split at ``axis=0``. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(4, 4) +// >>> x +// array([[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.], +// [ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]) +// >>> np.hsplit(x, 2) +// [array([[ 0., 1.], +// [ 4., 5.], +// [ 8., 9.], +// [12., 13.]]), +// array([[ 2., 3.], +// [ 6., 7.], +// [10., 11.], +// [14., 15.]])] +// >>> np.hsplit(x, np.array([3, 6])) +// [array([[ 0., 1., 2.], +// [ 4., 5., 6.], +// [ 8., 9., 10.], +// [12., 13., 14.]]), +// array([[ 3.], +// [ 7.], +// [11.], +// [15.]]), +// array([], shape=(4, 0), dtype=float64)] +// +// With a higher dimensional array the split is still along the second axis. +// +// >>> x = np.arange(8.0).reshape(2, 2, 2) +// >>> x +// array([[[0., 1.], +// [2., 3.]], +// [[4., 5.], +// [6., 7.]]]) +// >>> np.hsplit(x, 2) +// [array([[[0., 1.]], +// [[4., 5.]]]), +// array([[[2., 3.]], +// [[6., 7.]]])] +// +// With a 1-D array, the split is along axis 0. +// +// >>> x = np.array([0, 1, 2, 3, 4, 5]) +// >>> np.hsplit(x, 2) +// [array([0, 1, 2]), array([3, 4, 5])] +// +// +// +//go:linkname Hsplit py.hsplit +func Hsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Return the cumulative product of array elements over a given axis treating Not a +// Numbers (NaNs) as one. The cumulative product does not change when NaNs are +// encountered and leading NaNs are replaced by ones. +// +// Ones are returned for slices that are all-NaN or empty. +// +// .. versionadded:: 1.12.0 +// +// Parameters +// ---------- +// a : array_like +// Input array. +// axis : int, optional +// Axis along which the cumulative product is computed. By default +// the input is flattened. +// dtype : dtype, optional +// Type of the returned array, as well as of the accumulator in which +// the elements are multiplied. If *dtype* is not specified, it +// defaults to the dtype of `a`, unless `a` has an integer dtype with +// a precision less than that of the default platform integer. In +// that case, the default platform integer is used instead. +// out : ndarray, optional +// Alternative output array in which to place the result. It must +// have the same shape and buffer length as the expected output +// but the type of the resulting values will be cast if necessary. +// +// Returns +// ------- +// nancumprod : ndarray +// A new array holding the result is returned unless `out` is +// specified, in which case it is returned. +// +// See Also +// -------- +// numpy.cumprod : Cumulative product across array propagating NaNs. +// isnan : Show which elements are NaN. +// +// Examples +// -------- +// >>> np.nancumprod(1) +// array([1]) +// >>> np.nancumprod([1]) +// array([1]) +// >>> np.nancumprod([1, np.nan]) +// array([1., 1.]) +// >>> a = np.array([[1, 2], [3, np.nan]]) +// >>> np.nancumprod(a) +// array([1., 2., 6., 6.]) +// >>> np.nancumprod(a, axis=0) +// array([[1., 2.], +// [3., 2.]]) +// >>> np.nancumprod(a, axis=1) +// array([[1., 2.], +// [3., 3.]]) +// +// +// +//go:linkname Nancumprod py.nancumprod +func Nancumprod(a *py.Object, axis *py.Object, dtype *py.Object, out *py.Object) *py.Object +// absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Calculate the absolute value element-wise. +// +// ``np.abs`` is a shorthand for this function. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// absolute : ndarray +// An ndarray containing the absolute value of +// each element in `x`. For complex input, ``a + ib``, the +// absolute value is :math:`\sqrt{ a^2 + b^2 }`. +// This is a scalar if `x` is a scalar. +// +// Examples +// -------- +// >>> x = np.array([-1.2, 1.2]) +// >>> np.absolute(x) +// array([ 1.2, 1.2]) +// >>> np.absolute(1.2 + 1j) +// 1.5620499351813308 +// +// Plot the function over ``[-10, 10]``: +// +// >>> import matplotlib.pyplot as plt +// +// >>> x = np.linspace(start=-10, stop=10, num=101) +// >>> plt.plot(x, np.absolute(x)) +// >>> plt.show() +// +// Plot the function over the complex plane: +// +// >>> xx = x + 1j * x[:, np.newaxis] +// >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') +// >>> plt.show() +// +// The `abs` function can be used as a shorthand for ``np.absolute`` on +// ndarrays. +// +// >>> x = np.array([-1.2, 1.2]) +// >>> abs(x) +// array([1.2, 1.2]) +// +//go:linkname Abs py.abs +func Abs(__llgo_va_list ...interface{}) *py.Object +// +// Returns the discrete, linear convolution of two one-dimensional sequences. +// +// The convolution operator is often seen in signal processing, where it +// models the effect of a linear time-invariant system on a signal [1]_. In +// probability theory, the sum of two independent random variables is +// distributed according to the convolution of their individual +// distributions. +// +// If `v` is longer than `a`, the arrays are swapped before computation. +// +// Parameters +// ---------- +// a : (N,) array_like +// First one-dimensional input array. +// v : (M,) array_like +// Second one-dimensional input array. +// mode : {'full', 'valid', 'same'}, optional +// 'full': +// By default, mode is 'full'. This returns the convolution +// at each point of overlap, with an output shape of (N+M-1,). At +// the end-points of the convolution, the signals do not overlap +// completely, and boundary effects may be seen. +// +// 'same': +// Mode 'same' returns output of length ``max(M, N)``. Boundary +// effects are still visible. +// +// 'valid': +// Mode 'valid' returns output of length +// ``max(M, N) - min(M, N) + 1``. The convolution product is only given +// for points where the signals overlap completely. Values outside +// the signal boundary have no effect. +// +// Returns +// ------- +// out : ndarray +// Discrete, linear convolution of `a` and `v`. +// +// See Also +// -------- +// scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier +// Transform. +// scipy.linalg.toeplitz : Used to construct the convolution operator. +// polymul : Polynomial multiplication. Same output as convolve, but also +// accepts poly1d objects as input. +// +// Notes +// ----- +// The discrete convolution operation is defined as +// +// .. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m} +// +// It can be shown that a convolution :math:`x(t) * y(t)` in time/space +// is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier +// domain, after appropriate padding (padding is necessary to prevent +// circular convolution). Since multiplication is more efficient (faster) +// than convolution, the function `scipy.signal.fftconvolve` exploits the +// FFT to calculate the convolution of large data-sets. +// +// References +// ---------- +// .. [1] Wikipedia, "Convolution", +// https://en.wikipedia.org/wiki/Convolution +// +// Examples +// -------- +// Note how the convolution operator flips the second array +// before "sliding" the two across one another: +// +// >>> np.convolve([1, 2, 3], [0, 1, 0.5]) +// array([0. , 1. , 2.5, 4. , 1.5]) +// +// Only return the middle values of the convolution. +// Contains boundary effects, where zeros are taken +// into account: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'same') +// array([1. , 2.5, 4. ]) +// +// The two arrays are of the same length, so there +// is only one position where they completely overlap: +// +// >>> np.convolve([1,2,3],[0,1,0.5], 'valid') +// array([2.5]) +// +// +// +//go:linkname Convolve py.convolve +func Convolve(a *py.Object, v *py.Object, mode *py.Object) *py.Object +// fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Element-wise minimum of array elements. +// +// Compare two arrays and return a new array containing the element-wise +// minima. If one of the elements being compared is a NaN, then the +// non-nan element is returned. If both elements are NaNs then the first +// is returned. The latter distinction is important for complex NaNs, +// which are defined as at least one of the real or imaginary parts being +// a NaN. The net effect is that NaNs are ignored when possible. +// +// Parameters +// ---------- +// x1, x2 : array_like +// The arrays holding the elements to be compared. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The minimum of `x1` and `x2`, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// fmax : +// Element-wise maximum of two arrays, ignores NaNs. +// minimum : +// Element-wise minimum of two arrays, propagates NaNs. +// amin : +// The minimum value of an array along a given axis, propagates NaNs. +// nanmin : +// The minimum value of an array along a given axis, ignores NaNs. +// +// maximum, amax, nanmax +// +// Notes +// ----- +// .. versionadded:: 1.3.0 +// +// The fmin is equivalent to ``np.where(x1 <= x2, x1, x2)`` when neither +// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. +// +// Examples +// -------- +// >>> np.fmin([2, 3, 4], [1, 5, 2]) +// array([1, 3, 2]) +// +// >>> np.fmin(np.eye(2), [0.5, 2]) +// array([[ 0.5, 0. ], +// [ 0. , 1. ]]) +// +// >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) +// array([ 0., 0., nan]) +// +//go:linkname Fmin py.fmin +func Fmin(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Returns x1 * 2**x2, element-wise. +// +// The mantissas `x1` and twos exponents `x2` are used to construct +// floating point numbers ``x1 * 2**x2``. +// +// Parameters +// ---------- +// x1 : array_like +// Array of multipliers. +// x2 : array_like, int +// Array of twos exponents. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The result of ``x1 * 2**x2``. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// frexp : Return (y1, y2) from ``x = y1 * 2**y2``, inverse to `ldexp`. +// +// Notes +// ----- +// Complex dtypes are not supported, they will raise a TypeError. +// +// `ldexp` is useful as the inverse of `frexp`, if used by itself it is +// more clear to simply use the expression ``x1 * 2**x2``. +// +// Examples +// -------- +// >>> np.ldexp(5, np.arange(4)) +// array([ 5., 10., 20., 40.], dtype=float16) +// +// >>> x = np.arange(6) +// >>> np.ldexp(*np.frexp(x)) +// array([ 0., 1., 2., 3., 4., 5.]) +// +//go:linkname Ldexp py.ldexp +func Ldexp(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the truth value of NOT x element-wise. +// +// Parameters +// ---------- +// x : array_like +// Logical NOT is applied to the elements of `x`. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool or ndarray of bool +// Boolean result with the same shape as `x` of the NOT operation +// on elements of `x`. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// logical_and, logical_or, logical_xor +// +// Examples +// -------- +// >>> np.logical_not(3) +// False +// >>> np.logical_not([True, False, 0, 1]) +// array([False, True, True, False]) +// +// >>> x = np.arange(5) +// >>> np.logical_not(x<3) +// array([False, False, False, True, True]) +// +//go:linkname LogicalNot py.logical_not +func LogicalNot(x *py.Object, out *py.Object) *py.Object +// modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Return the fractional and integral parts of an array, element-wise. +// +// The fractional and integral parts are negative if the given number is +// negative. +// +// Parameters +// ---------- +// x : array_like +// Input array. +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y1 : ndarray +// Fractional part of `x`. +// This is a scalar if `x` is a scalar. +// y2 : ndarray +// Integral part of `x`. +// This is a scalar if `x` is a scalar. +// +// Notes +// ----- +// For integer input the return values are floats. +// +// See Also +// -------- +// divmod : ``divmod(x, 1)`` is equivalent to ``modf`` with the return values +// switched, except it always has a positive remainder. +// +// Examples +// -------- +// >>> np.modf([0, 3.5]) +// (array([ 0. , 0.5]), array([ 0., 3.])) +// >>> np.modf(-0.5) +// (-0.5, -0) +// +//go:linkname Modf py.modf +func Modf(x *py.Object, out1 *py.Object, out2 *py.Object, out *py.Object) *py.Object +// +// Format a floating-point scalar as a decimal string in scientific notation. +// +// Provides control over rounding, trimming and padding. Uses and assumes +// IEEE unbiased rounding. Uses the "Dragon4" algorithm. +// +// Parameters +// ---------- +// x : python float or numpy floating scalar +// Value to format. +// precision : non-negative integer or None, optional +// Maximum number of digits to print. May be None if `unique` is +// `True`, but must be an integer if unique is `False`. +// unique : boolean, optional +// If `True`, use a digit-generation strategy which gives the shortest +// representation which uniquely identifies the floating-point number from +// other values of the same type, by judicious rounding. If `precision` +// is given fewer digits than necessary can be printed. If `min_digits` +// is given more can be printed, in which cases the last digit is rounded +// with unbiased rounding. +// If `False`, digits are generated as if printing an infinite-precision +// value and stopping after `precision` digits, rounding the remaining +// value with unbiased rounding +// trim : one of 'k', '.', '0', '-', optional +// Controls post-processing trimming of trailing digits, as follows: +// +// * 'k' : keep trailing zeros, keep decimal point (no trimming) +// * '.' : trim all trailing zeros, leave decimal point +// * '0' : trim all but the zero before the decimal point. Insert the +// zero if it is missing. +// * '-' : trim trailing zeros and any trailing decimal point +// sign : boolean, optional +// Whether to show the sign for positive values. +// pad_left : non-negative integer, optional +// Pad the left side of the string with whitespace until at least that +// many characters are to the left of the decimal point. +// exp_digits : non-negative integer, optional +// Pad the exponent with zeros until it contains at least this many digits. +// If omitted, the exponent will be at least 2 digits. +// min_digits : non-negative integer or None, optional +// Minimum number of digits to print. This only has an effect for +// `unique=True`. In that case more digits than necessary to uniquely +// identify the value may be printed and rounded unbiased. +// +// -- versionadded:: 1.21.0 +// +// Returns +// ------- +// rep : string +// The string representation of the floating point value +// +// See Also +// -------- +// format_float_positional +// +// Examples +// -------- +// >>> np.format_float_scientific(np.float32(np.pi)) +// '3.1415927e+00' +// >>> s = np.float32(1.23e24) +// >>> np.format_float_scientific(s, unique=False, precision=15) +// '1.230000071797338e+24' +// >>> np.format_float_scientific(s, exp_digits=4) +// '1.23e+0024' +// +// +//go:linkname FormatFloatScientific py.format_float_scientific +func FormatFloatScientific(x *py.Object, precision *py.Object, unique *py.Object, trim *py.Object, sign *py.Object, padLeft *py.Object, expDigits *py.Object, minDigits *py.Object) *py.Object +// +// Compute the qth percentile of the data along the specified axis, +// while ignoring nan values. +// +// Returns the qth percentile(s) of the array elements. +// +// .. versionadded:: 1.9.0 +// +// Parameters +// ---------- +// a : array_like +// Input array or object that can be converted to an array, containing +// nan values to be ignored. +// q : array_like of float +// Percentile or sequence of percentiles to compute, which must be +// between 0 and 100 inclusive. +// axis : {int, tuple of int, None}, optional +// Axis or axes along which the percentiles are computed. The default +// is to compute the percentile(s) along a flattened version of the +// array. +// out : ndarray, optional +// Alternative output array in which to place the result. It must have +// the same shape and buffer length as the expected output, but the +// type (of the output) will be cast if necessary. +// overwrite_input : bool, optional +// If True, then allow the input array `a` to be modified by +// intermediate calculations, to save memory. In this case, the +// contents of the input `a` after this function completes is +// undefined. +// method : str, optional +// This parameter specifies the method to use for estimating the +// percentile. There are many different methods, some unique to NumPy. +// See the notes for explanation. The options sorted by their R type +// as summarized in the H&F paper [1]_ are: +// +// 1. 'inverted_cdf' +// 2. 'averaged_inverted_cdf' +// 3. 'closest_observation' +// 4. 'interpolated_inverted_cdf' +// 5. 'hazen' +// 6. 'weibull' +// 7. 'linear' (default) +// 8. 'median_unbiased' +// 9. 'normal_unbiased' +// +// The first three methods are discontinuous. NumPy further defines the +// following discontinuous variations of the default 'linear' (7.) option: +// +// * 'lower' +// * 'higher', +// * 'midpoint' +// * 'nearest' +// +// .. versionchanged:: 1.22.0 +// This argument was previously called "interpolation" and only +// offered the "linear" default and last four options. +// +// keepdims : bool, optional +// If this is set to True, the axes which are reduced are left in +// the result as dimensions with size one. With this option, the +// result will broadcast correctly against the original array `a`. +// +// If this is anything but the default value it will be passed +// through (in the special case of an empty array) to the +// `mean` function of the underlying array. If the array is +// a sub-class and `mean` does not have the kwarg `keepdims` this +// will raise a RuntimeError. +// +// interpolation : str, optional +// Deprecated name for the method keyword argument. +// +// .. deprecated:: 1.22.0 +// +// Returns +// ------- +// percentile : scalar or ndarray +// If `q` is a single percentile and `axis=None`, then the result +// is a scalar. If multiple percentiles are given, first axis of +// the result corresponds to the percentiles. The other axes are +// the axes that remain after the reduction of `a`. If the input +// contains integers or floats smaller than ``float64``, the output +// data-type is ``float64``. Otherwise, the output data-type is the +// same as that of the input. If `out` is specified, that array is +// returned instead. +// +// See Also +// -------- +// nanmean +// nanmedian : equivalent to ``nanpercentile(..., 50)`` +// percentile, median, mean +// nanquantile : equivalent to nanpercentile, except q in range [0, 1]. +// +// Notes +// ----- +// For more information please see `numpy.percentile` +// +// Examples +// -------- +// >>> a = np.array([[10., 7., 4.], [3., 2., 1.]]) +// >>> a[0][1] = np.nan +// >>> a +// array([[10., nan, 4.], +// [ 3., 2., 1.]]) +// >>> np.percentile(a, 50) +// nan +// >>> np.nanpercentile(a, 50) +// 3.0 +// >>> np.nanpercentile(a, 50, axis=0) +// array([6.5, 2. , 2.5]) +// >>> np.nanpercentile(a, 50, axis=1, keepdims=True) +// array([[7.], +// [2.]]) +// >>> m = np.nanpercentile(a, 50, axis=0) +// >>> out = np.zeros_like(m) +// >>> np.nanpercentile(a, 50, axis=0, out=out) +// array([6.5, 2. , 2.5]) +// >>> m +// array([6.5, 2. , 2.5]) +// +// >>> b = a.copy() +// >>> np.nanpercentile(b, 50, axis=1, overwrite_input=True) +// array([7., 2.]) +// >>> assert not np.all(a==b) +// +// References +// ---------- +// .. [1] R. J. Hyndman and Y. Fan, +// "Sample quantiles in statistical packages," +// The American Statistician, 50(4), pp. 361-365, 1996 +// +// +// +//go:linkname Nanpercentile py.nanpercentile +func Nanpercentile(a *py.Object, q *py.Object, axis *py.Object, out *py.Object, overwriteInput *py.Object, method *py.Object, keepdims *py.Object) *py.Object +// +// Stack arrays in sequence horizontally (column wise). +// +// This is equivalent to concatenation along the second axis, except for 1-D +// arrays where it concatenates along the first axis. Rebuilds arrays divided +// by `hsplit`. +// +// This function makes most sense for arrays with up to 3 dimensions. For +// instance, for pixel-data with a height (first axis), width (second axis), +// and r/g/b channels (third axis). The functions `concatenate`, `stack` and +// `block` provide more general stacking and concatenation operations. +// +// Parameters +// ---------- +// tup : sequence of ndarrays +// The arrays must have the same shape along all but the second axis, +// except 1-D arrays which can be any length. +// +// dtype : str or dtype +// If provided, the destination array will have this dtype. Cannot be +// provided together with `out`. +// +// .. versionadded:: 1.24 +// +// casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional +// Controls what kind of data casting may occur. Defaults to 'same_kind'. +// +// .. versionadded:: 1.24 +// +// Returns +// ------- +// stacked : ndarray +// The array formed by stacking the given arrays. +// +// See Also +// -------- +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// block : Assemble an nd-array from nested lists of blocks. +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third axis). +// column_stack : Stack 1-D arrays as columns into a 2-D array. +// hsplit : Split an array into multiple sub-arrays horizontally (column-wise). +// +// Examples +// -------- +// >>> a = np.array((1,2,3)) +// >>> b = np.array((4,5,6)) +// >>> np.hstack((a,b)) +// array([1, 2, 3, 4, 5, 6]) +// >>> a = np.array([[1],[2],[3]]) +// >>> b = np.array([[4],[5],[6]]) +// >>> np.hstack((a,b)) +// array([[1, 4], +// [2, 5], +// [3, 6]]) +// +// +// +//go:linkname Hstack py.hstack +func Hstack(tup *py.Object) *py.Object +// +// Split an array into multiple sub-arrays as views into `ary`. +// +// Parameters +// ---------- +// ary : ndarray +// Array to be divided into sub-arrays. +// indices_or_sections : int or 1-D array +// If `indices_or_sections` is an integer, N, the array will be divided +// into N equal arrays along `axis`. If such a split is not possible, +// an error is raised. +// +// If `indices_or_sections` is a 1-D array of sorted integers, the entries +// indicate where along `axis` the array is split. For example, +// ``[2, 3]`` would, for ``axis=0``, result in +// +// - ary[:2] +// - ary[2:3] +// - ary[3:] +// +// If an index exceeds the dimension of the array along `axis`, +// an empty sub-array is returned correspondingly. +// axis : int, optional +// The axis along which to split, default is 0. +// +// Returns +// ------- +// sub-arrays : list of ndarrays +// A list of sub-arrays as views into `ary`. +// +// Raises +// ------ +// ValueError +// If `indices_or_sections` is given as an integer, but +// a split does not result in equal division. +// +// See Also +// -------- +// array_split : Split an array into multiple sub-arrays of equal or +// near-equal size. Does not raise an exception if +// an equal division cannot be made. +// hsplit : Split array into multiple sub-arrays horizontally (column-wise). +// vsplit : Split array into multiple sub-arrays vertically (row wise). +// dsplit : Split array into multiple sub-arrays along the 3rd axis (depth). +// concatenate : Join a sequence of arrays along an existing axis. +// stack : Join a sequence of arrays along a new axis. +// hstack : Stack arrays in sequence horizontally (column wise). +// vstack : Stack arrays in sequence vertically (row wise). +// dstack : Stack arrays in sequence depth wise (along third dimension). +// +// Examples +// -------- +// >>> x = np.arange(9.0) +// >>> np.split(x, 3) +// [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7., 8.])] +// +// >>> x = np.arange(8.0) +// >>> np.split(x, [3, 5, 6, 10]) +// [array([0., 1., 2.]), +// array([3., 4.]), +// array([5.]), +// array([6., 7.]), +// array([], dtype=float64)] +// +// +// +//go:linkname Split py.split +func Split(ary *py.Object, indicesOrSections *py.Object, axis *py.Object) *py.Object +// +// Apply a function to 1-D slices along the given axis. +// +// Execute `func1d(a, *args, **kwargs)` where `func1d` operates on 1-D arrays +// and `a` is a 1-D slice of `arr` along `axis`. +// +// This is equivalent to (but faster than) the following use of `ndindex` and +// `s_`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of indices:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// f = func1d(arr[ii + s_[:,] + kk]) +// Nj = f.shape +// for jj in ndindex(Nj): +// out[ii + jj + kk] = f[jj] +// +// Equivalently, eliminating the inner loop, this can be expressed as:: +// +// Ni, Nk = a.shape[:axis], a.shape[axis+1:] +// for ii in ndindex(Ni): +// for kk in ndindex(Nk): +// out[ii + s_[...,] + kk] = func1d(arr[ii + s_[:,] + kk]) +// +// Parameters +// ---------- +// func1d : function (M,) -> (Nj...) +// This function should accept 1-D arrays. It is applied to 1-D +// slices of `arr` along the specified axis. +// axis : integer +// Axis along which `arr` is sliced. +// arr : ndarray (Ni..., M, Nk...) +// Input array. +// args : any +// Additional arguments to `func1d`. +// kwargs : any +// Additional named arguments to `func1d`. +// +// .. versionadded:: 1.9.0 +// +// +// Returns +// ------- +// out : ndarray (Ni..., Nj..., Nk...) +// The output array. The shape of `out` is identical to the shape of +// `arr`, except along the `axis` dimension. This axis is removed, and +// replaced with new dimensions equal to the shape of the return value +// of `func1d`. So if `func1d` returns a scalar `out` will have one +// fewer dimensions than `arr`. +// +// See Also +// -------- +// apply_over_axes : Apply a function repeatedly over multiple axes. +// +// Examples +// -------- +// >>> def my_func(a): +// ... """Average first and last element of a 1-D array""" +// ... return (a[0] + a[-1]) * 0.5 +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(my_func, 0, b) +// array([4., 5., 6.]) +// >>> np.apply_along_axis(my_func, 1, b) +// array([2., 5., 8.]) +// +// For a function that returns a 1D array, the number of dimensions in +// `outarr` is the same as `arr`. +// +// >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]]) +// >>> np.apply_along_axis(sorted, 1, b) +// array([[1, 7, 8], +// [3, 4, 9], +// [2, 5, 6]]) +// +// For a function that returns a higher dimensional array, those dimensions +// are inserted in place of the `axis` dimension. +// +// >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]]) +// >>> np.apply_along_axis(np.diag, -1, b) +// array([[[1, 0, 0], +// [0, 2, 0], +// [0, 0, 3]], +// [[4, 0, 0], +// [0, 5, 0], +// [0, 0, 6]], +// [[7, 0, 0], +// [0, 8, 0], +// [0, 0, 9]]]) +// +// +//go:linkname ApplyAlongAxis py.apply_along_axis +func ApplyAlongAxis(func1d *py.Object, axis *py.Object, arr *py.Object, __llgo_va_list ...interface{}) *py.Object +// +// Do a keyword search on docstrings. +// +// A list of objects that matched the search is displayed, +// sorted by relevance. All given keywords need to be found in the +// docstring for it to be returned as a result, but the order does +// not matter. +// +// Parameters +// ---------- +// what : str +// String containing words to look for. +// module : str or list, optional +// Name of module(s) whose docstrings to go through. +// import_modules : bool, optional +// Whether to import sub-modules in packages. Default is True. +// regenerate : bool, optional +// Whether to re-generate the docstring cache. Default is False. +// output : file-like, optional +// File-like object to write the output to. If omitted, use a pager. +// +// See Also +// -------- +// source, info +// +// Notes +// ----- +// Relevance is determined only roughly, by checking if the keywords occur +// in the function name, at the start of a docstring, etc. +// +// Examples +// -------- +// >>> np.lookfor('binary representation') # doctest: +SKIP +// Search results for 'binary representation' +// ------------------------------------------ +// numpy.binary_repr +// Return the binary representation of the input number as a string. +// numpy.core.setup_common.long_double_representation +// Given a binary dump as given by GNU od -b, look for long double +// numpy.base_repr +// Return a string representation of a number in the given base system. +// ... +// +// +// +//go:linkname Lookfor py.lookfor +func Lookfor(what *py.Object, module *py.Object, importModules *py.Object, regenerate *py.Object, output *py.Object) *py.Object +// +// Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. +// +// .. warning:: Loading files that contain object arrays uses the ``pickle`` +// module, which is not secure against erroneous or maliciously +// constructed data. Consider passing ``allow_pickle=False`` to +// load data that is known not to contain object arrays for the +// safer handling of untrusted sources. +// +// Parameters +// ---------- +// file : file-like object, string, or pathlib.Path +// The file to read. File-like objects must support the +// ``seek()`` and ``read()`` methods and must always +// be opened in binary mode. Pickled files require that the +// file-like object support the ``readline()`` method as well. +// mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional +// If not None, then memory-map the file, using the given mode (see +// `numpy.memmap` for a detailed description of the modes). A +// memory-mapped array is kept on disk. However, it can be accessed +// and sliced like any ndarray. Memory mapping is especially useful +// for accessing small fragments of large files without reading the +// entire file into memory. +// allow_pickle : bool, optional +// Allow loading pickled object arrays stored in npy files. Reasons for +// disallowing pickles include security, as loading pickled data can +// execute arbitrary code. If pickles are disallowed, loading object +// arrays will fail. Default: False +// +// .. versionchanged:: 1.16.3 +// Made default False in response to CVE-2019-6446. +// +// fix_imports : bool, optional +// Only useful when loading Python 2 generated pickled files on Python 3, +// which includes npy/npz files containing object arrays. If `fix_imports` +// is True, pickle will try to map the old Python 2 names to the new names +// used in Python 3. +// encoding : str, optional +// What encoding to use when reading Python 2 strings. Only useful when +// loading Python 2 generated pickled files in Python 3, which includes +// npy/npz files containing object arrays. Values other than 'latin1', +// 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical +// data. Default: 'ASCII' +// max_header_size : int, optional +// Maximum allowed size of the header. Large headers may not be safe +// to load securely and thus require explicitly passing a larger value. +// See :py:func:`ast.literal_eval()` for details. +// This option is ignored when `allow_pickle` is passed. In that case +// the file is by definition trusted and the limit is unnecessary. +// +// Returns +// ------- +// result : array, tuple, dict, etc. +// Data stored in the file. For ``.npz`` files, the returned instance +// of NpzFile class must be closed to avoid leaking file descriptors. +// +// Raises +// ------ +// OSError +// If the input file does not exist or cannot be read. +// UnpicklingError +// If ``allow_pickle=True``, but the file cannot be loaded as a pickle. +// ValueError +// The file contains an object array, but ``allow_pickle=False`` given. +// EOFError +// When calling ``np.load`` multiple times on the same file handle, +// if all data has already been read +// +// See Also +// -------- +// save, savez, savez_compressed, loadtxt +// memmap : Create a memory-map to an array stored in a file on disk. +// lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file. +// +// Notes +// ----- +// - If the file contains pickle data, then whatever object is stored +// in the pickle is returned. +// - If the file is a ``.npy`` file, then a single array is returned. +// - If the file is a ``.npz`` file, then a dictionary-like object is +// returned, containing ``{filename: array}`` key-value pairs, one for +// each file in the archive. +// - If the file is a ``.npz`` file, the returned value supports the +// context manager protocol in a similar fashion to the open function:: +// +// with load('foo.npz') as data: +// a = data['a'] +// +// The underlying file descriptor is closed when exiting the 'with' +// block. +// +// Examples +// -------- +// Store data to disk, and load it again: +// +// >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]])) +// >>> np.load('/tmp/123.npy') +// array([[1, 2, 3], +// [4, 5, 6]]) +// +// Store compressed data to disk, and load it again: +// +// >>> a=np.array([[1, 2, 3], [4, 5, 6]]) +// >>> b=np.array([1, 2]) +// >>> np.savez('/tmp/123.npz', a=a, b=b) +// >>> data = np.load('/tmp/123.npz') +// >>> data['a'] +// array([[1, 2, 3], +// [4, 5, 6]]) +// >>> data['b'] +// array([1, 2]) +// >>> data.close() +// +// Mem-map the stored array, and then access the second row +// directly from disk: +// +// >>> X = np.load('/tmp/123.npy', mmap_mode='r') +// >>> X[1, :] +// memmap([4, 5, 6]) +// +// +// +//go:linkname Load py.load +func Load(file *py.Object, mmapMode *py.Object, allowPickle *py.Object, fixImports *py.Object, encoding *py.Object) *py.Object +// +// Compute the histogram of a dataset. +// +// Parameters +// ---------- +// a : array_like +// Input data. The histogram is computed over the flattened array. +// bins : int or sequence of scalars or str, optional +// If `bins` is an int, it defines the number of equal-width +// bins in the given range (10, by default). If `bins` is a +// sequence, it defines a monotonically increasing array of bin edges, +// including the rightmost edge, allowing for non-uniform bin widths. +// +// .. versionadded:: 1.11.0 +// +// If `bins` is a string, it defines the method used to calculate the +// optimal bin width, as defined by `histogram_bin_edges`. +// +// range : (float, float), optional +// The lower and upper range of the bins. If not provided, range +// is simply ``(a.min(), a.max())``. Values outside the range are +// ignored. The first element of the range must be less than or +// equal to the second. `range` affects the automatic bin +// computation as well. While bin width is computed to be optimal +// based on the actual data within `range`, the bin count will fill +// the entire range including portions containing no data. +// weights : array_like, optional +// An array of weights, of the same shape as `a`. Each value in +// `a` only contributes its associated weight towards the bin count +// (instead of 1). If `density` is True, the weights are +// normalized, so that the integral of the density over the range +// remains 1. +// density : bool, optional +// If ``False``, the result will contain the number of samples in +// each bin. If ``True``, the result is the value of the +// probability *density* function at the bin, normalized such that +// the *integral* over the range is 1. Note that the sum of the +// histogram values will not be equal to 1 unless bins of unity +// width are chosen; it is not a probability *mass* function. +// +// Returns +// ------- +// hist : array +// The values of the histogram. See `density` and `weights` for a +// description of the possible semantics. +// bin_edges : array of dtype float +// Return the bin edges ``(length(hist)+1)``. +// +// +// See Also +// -------- +// histogramdd, bincount, searchsorted, digitize, histogram_bin_edges +// +// Notes +// ----- +// All but the last (righthand-most) bin is half-open. In other words, +// if `bins` is:: +// +// [1, 2, 3, 4] +// +// then the first bin is ``[1, 2)`` (including 1, but excluding 2) and +// the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which +// *includes* 4. +// +// +// Examples +// -------- +// >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) +// (array([0, 2, 1]), array([0, 1, 2, 3])) +// >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) +// (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) +// >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) +// (array([1, 4, 1]), array([0, 1, 2, 3])) +// +// >>> a = np.arange(5) +// >>> hist, bin_edges = np.histogram(a, density=True) +// >>> hist +// array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) +// >>> hist.sum() +// 2.4999999999999996 +// >>> np.sum(hist * np.diff(bin_edges)) +// 1.0 +// +// .. versionadded:: 1.11.0 +// +// Automated Bin Selection Methods example, using 2 peak random data +// with 2000 points: +// +// >>> import matplotlib.pyplot as plt +// >>> rng = np.random.RandomState(10) # deterministic random data +// >>> a = np.hstack((rng.normal(size=1000), +// ... rng.normal(loc=5, scale=2, size=1000))) +// >>> _ = plt.hist(a, bins='auto') # arguments are passed to np.histogram +// >>> plt.title("Histogram with 'auto' bins") +// Text(0.5, 1.0, "Histogram with 'auto' bins") +// >>> plt.show() +// +// +// +//go:linkname Histogram py.histogram +func Histogram(a *py.Object, bins *py.Object, Range *py.Object, density *py.Object, weights *py.Object) *py.Object +// +// Roll array elements along a given axis. +// +// Elements that roll beyond the last position are re-introduced at +// the first. +// +// Parameters +// ---------- +// a : array_like +// Input array. +// shift : int or tuple of ints +// The number of places by which elements are shifted. If a tuple, +// then `axis` must be a tuple of the same size, and each of the +// given axes is shifted by the corresponding number. If an int +// while `axis` is a tuple of ints, then the same value is used for +// all given axes. +// axis : int or tuple of ints, optional +// Axis or axes along which elements are shifted. By default, the +// array is flattened before shifting, after which the original +// shape is restored. +// +// Returns +// ------- +// res : ndarray +// Output array, with the same shape as `a`. +// +// See Also +// -------- +// rollaxis : Roll the specified axis backwards, until it lies in a +// given position. +// +// Notes +// ----- +// .. versionadded:: 1.12.0 +// +// Supports rolling over multiple dimensions simultaneously. +// +// Examples +// -------- +// >>> x = np.arange(10) +// >>> np.roll(x, 2) +// array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) +// >>> np.roll(x, -2) +// array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) +// +// >>> x2 = np.reshape(x, (2, 5)) +// >>> x2 +// array([[0, 1, 2, 3, 4], +// [5, 6, 7, 8, 9]]) +// >>> np.roll(x2, 1) +// array([[9, 0, 1, 2, 3], +// [4, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1) +// array([[1, 2, 3, 4, 5], +// [6, 7, 8, 9, 0]]) +// >>> np.roll(x2, 1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, -1, axis=0) +// array([[5, 6, 7, 8, 9], +// [0, 1, 2, 3, 4]]) +// >>> np.roll(x2, 1, axis=1) +// array([[4, 0, 1, 2, 3], +// [9, 5, 6, 7, 8]]) +// >>> np.roll(x2, -1, axis=1) +// array([[1, 2, 3, 4, 0], +// [6, 7, 8, 9, 5]]) +// >>> np.roll(x2, (1, 1), axis=(1, 0)) +// array([[9, 5, 6, 7, 8], +// [4, 0, 1, 2, 3]]) +// >>> np.roll(x2, (2, 1), axis=(1, 0)) +// array([[8, 9, 5, 6, 7], +// [3, 4, 0, 1, 2]]) +// +// +// +//go:linkname Roll py.roll +func Roll(a *py.Object, shift *py.Object, axis *py.Object) *py.Object +// bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Compute the bit-wise XOR of two arrays element-wise. +// +// Computes the bit-wise XOR of the underlying binary representation of +// the integers in the input arrays. This ufunc implements the C/Python +// operator ``^``. +// +// Parameters +// ---------- +// x1, x2 : array_like +// Only integer and boolean types are handled. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// out : ndarray or scalar +// Result. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// logical_xor +// bitwise_and +// bitwise_or +// binary_repr : +// Return the binary representation of the input number as a string. +// +// Examples +// -------- +// The number 13 is represented by ``00001101``. Likewise, 17 is +// represented by ``00010001``. The bit-wise XOR of 13 and 17 is +// therefore ``00011100``, or 28: +// +// >>> np.bitwise_xor(13, 17) +// 28 +// >>> np.binary_repr(28) +// '11100' +// +// >>> np.bitwise_xor(31, 5) +// 26 +// >>> np.bitwise_xor([31,3], 5) +// array([26, 6]) +// +// >>> np.bitwise_xor([31,3], [5,6]) +// array([26, 5]) +// >>> np.bitwise_xor([True, True], [False, True]) +// array([ True, False]) +// +// The ``^`` operator can be used as a shorthand for ``np.bitwise_xor`` on +// ndarrays. +// +// >>> x1 = np.array([True, True]) +// >>> x2 = np.array([False, True]) +// >>> x1 ^ x2 +// array([ True, False]) +// +//go:linkname BitwiseXor py.bitwise_xor +func BitwiseXor(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Divide arguments element-wise. +// +// Parameters +// ---------- +// x1 : array_like +// Dividend array. +// x2 : array_like +// Divisor array. +// If ``x1.shape != x2.shape``, they must be broadcastable to a common +// shape (which becomes the shape of the output). +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : ndarray or scalar +// The quotient ``x1/x2``, element-wise. +// This is a scalar if both `x1` and `x2` are scalars. +// +// See Also +// -------- +// seterr : Set whether to raise or warn on overflow, underflow and +// division by zero. +// +// Notes +// ----- +// Equivalent to ``x1`` / ``x2`` in terms of array-broadcasting. +// +// The ``true_divide(x1, x2)`` function is an alias for +// ``divide(x1, x2)``. +// +// Examples +// -------- +// >>> np.divide(2.0, 4.0) +// 0.5 +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = np.arange(3.0) +// >>> np.divide(x1, x2) +// array([[nan, 1. , 1. ], +// [inf, 4. , 2.5], +// [inf, 7. , 4. ]]) +// +// The ``/`` operator can be used as a shorthand for ``np.divide`` on +// ndarrays. +// +// >>> x1 = np.arange(9.0).reshape((3, 3)) +// >>> x2 = 2 * np.ones(3) +// >>> x1 / x2 +// array([[0. , 0.5, 1. ], +// [1.5, 2. , 2.5], +// [3. , 3.5, 4. ]]) +// +//go:linkname Divide py.divide +func Divide(x1 *py.Object, x2 *py.Object, out *py.Object) *py.Object +// isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) +// +// Test element-wise for positive or negative infinity. +// +// Returns a boolean array of the same shape as `x`, True where ``x == +// +/-inf``, otherwise False. +// +// Parameters +// ---------- +// x : array_like +// Input values +// out : ndarray, None, or tuple of ndarray and None, optional +// A location into which the result is stored. If provided, it must have +// a shape that the inputs broadcast to. If not provided or None, +// a freshly-allocated array is returned. A tuple (possible only as a +// keyword argument) must have length equal to the number of outputs. +// where : array_like, optional +// This condition is broadcast over the input. At locations where the +// condition is True, the `out` array will be set to the ufunc result. +// Elsewhere, the `out` array will retain its original value. +// Note that if an uninitialized `out` array is created via the default +// ``out=None``, locations within it where the condition is False will +// remain uninitialized. +// **kwargs +// For other keyword-only arguments, see the +// :ref:`ufunc docs `. +// +// Returns +// ------- +// y : bool (scalar) or boolean ndarray +// True where ``x`` is positive or negative infinity, false otherwise. +// This is a scalar if `x` is a scalar. +// +// See Also +// -------- +// isneginf, isposinf, isnan, isfinite +// +// Notes +// ----- +// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic +// (IEEE 754). +// +// Errors result if the second argument is supplied when the first +// argument is a scalar, or if the first and second arguments have +// different shapes. +// +// Examples +// -------- +// >>> np.isinf(np.inf) +// True +// >>> np.isinf(np.nan) +// False +// >>> np.isinf(np.NINF) +// True +// >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) +// array([ True, True, False, False]) +// +// >>> x = np.array([-np.inf, 0., np.inf]) +// >>> y = np.array([2, 2, 2]) +// >>> np.isinf(x, y) +// array([1, 0, 1]) +// >>> y +// array([1, 0, 1]) +// +//go:linkname Isinf py.isinf +func Isinf(x *py.Object, out *py.Object) *py.Object +// +// Determines whether the given object represents a scalar data-type. +// +// Parameters +// ---------- +// rep : any +// If `rep` is an instance of a scalar dtype, True is returned. If not, +// False is returned. +// +// Returns +// ------- +// out : bool +// Boolean result of check whether `rep` is a scalar dtype. +// +// See Also +// -------- +// issubsctype, issubdtype, obj2sctype, sctype2char +// +// Examples +// -------- +// >>> np.issctype(np.int32) +// True +// >>> np.issctype(list) +// False +// >>> np.issctype(1.1) +// False +// +// Strings are also a scalar type: +// +// >>> np.issctype(np.dtype('str')) +// True +// +// +// +//go:linkname Issctype py.issctype +func Issctype(rep *py.Object) *py.Object +// +// Return a copy of an array sorted along the first axis. +// +// .. deprecated:: 1.24 +// +// msort is deprecated, use ``np.sort(a, axis=0)`` instead. +// +// Parameters +// ---------- +// a : array_like +// Array to be sorted. +// +// Returns +// ------- +// sorted_array : ndarray +// Array of the same type and shape as `a`. +// +// See Also +// -------- +// sort +// +// Notes +// ----- +// ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. +// +// Examples +// -------- +// >>> a = np.array([[1, 4], [3, 1]]) +// >>> np.msort(a) # sort along the first axis +// array([[1, 1], +// [3, 4]]) +// +// +// +//go:linkname Msort py.msort +func Msort(a *py.Object) *py.Object +// +// Split array into multiple sub-arrays along the 3rd axis (depth). +// +// Please refer to the `split` documentation. `dsplit` is equivalent +// to `split` with ``axis=2``, the array is always split along the third +// axis provided the array dimension is greater than or equal to 3. +// +// See Also +// -------- +// split : Split an array into multiple sub-arrays of equal size. +// +// Examples +// -------- +// >>> x = np.arange(16.0).reshape(2, 2, 4) +// >>> x +// array([[[ 0., 1., 2., 3.], +// [ 4., 5., 6., 7.]], +// [[ 8., 9., 10., 11.], +// [12., 13., 14., 15.]]]) +// >>> np.dsplit(x, 2) +// [array([[[ 0., 1.], +// [ 4., 5.]], +// [[ 8., 9.], +// [12., 13.]]]), array([[[ 2., 3.], +// [ 6., 7.]], +// [[10., 11.], +// [14., 15.]]])] +// >>> np.dsplit(x, np.array([3, 6])) +// [array([[[ 0., 1., 2.], +// [ 4., 5., 6.]], +// [[ 8., 9., 10.], +// [12., 13., 14.]]]), +// array([[[ 3.], +// [ 7.]], +// [[11.], +// [15.]]]), +// array([], shape=(2, 2, 0), dtype=float64)] +// +// +//go:linkname Dsplit py.dsplit +func Dsplit(ary *py.Object, indicesOrSections *py.Object) *py.Object +// +// Load data from a text file. +// +// Parameters +// ---------- +// fname : file, str, pathlib.Path, list of str, generator +// File, filename, list, or generator to read. If the filename +// extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note +// that generators must return bytes or strings. The strings +// in a list or produced by a generator are treated as lines. +// dtype : data-type, optional +// Data-type of the resulting array; default: float. If this is a +// structured data-type, the resulting array will be 1-dimensional, and +// each row will be interpreted as an element of the array. In this +// case, the number of columns used must match the number of fields in +// the data-type. +// comments : str or sequence of str or None, optional +// The characters or list of characters used to indicate the start of a +// comment. None implies no comments. For backwards compatibility, byte +// strings will be decoded as 'latin1'. The default is '#'. +// delimiter : str, optional +// The character used to separate the values. For backwards compatibility, +// byte strings will be decoded as 'latin1'. The default is whitespace. +// +// .. versionchanged:: 1.23.0 +// Only single character delimiters are supported. Newline characters +// cannot be used as the delimiter. +// +// converters : dict or callable, optional +// Converter functions to customize value parsing. If `converters` is +// callable, the function is applied to all columns, else it must be a +// dict that maps column number to a parser function. +// See examples for further details. +// Default: None. +// +// .. versionchanged:: 1.23.0 +// The ability to pass a single callable to be applied to all columns +// was added. +// +// skiprows : int, optional +// Skip the first `skiprows` lines, including comments; default: 0. +// usecols : int or sequence, optional +// Which columns to read, with 0 being the first. For example, +// ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. +// The default, None, results in all columns being read. +// +// .. versionchanged:: 1.11.0 +// When a single column has to be read it is possible to use +// an integer instead of a tuple. E.g ``usecols = 3`` reads the +// fourth column the same way as ``usecols = (3,)`` would. +// unpack : bool, optional +// If True, the returned array is transposed, so that arguments may be +// unpacked using ``x, y, z = loadtxt(...)``. When used with a +// structured data-type, arrays are returned for each field. +// Default is False. +// ndmin : int, optional +// The returned array will have at least `ndmin` dimensions. +// Otherwise mono-dimensional axes will be squeezed. +// Legal values: 0 (default), 1 or 2. +// +// .. versionadded:: 1.6.0 +// encoding : str, optional +// Encoding used to decode the inputfile. Does not apply to input streams. +// The special value 'bytes' enables backward compatibility workarounds +// that ensures you receive byte arrays as results if possible and passes +// 'latin1' encoded strings to converters. Override this value to receive +// unicode arrays and pass strings as input to converters. If set to None +// the system default is used. The default value is 'bytes'. +// +// .. versionadded:: 1.14.0 +// max_rows : int, optional +// Read `max_rows` rows of content after `skiprows` lines. The default is +// to read all the rows. Note that empty rows containing no data such as +// empty lines and comment lines are not counted towards `max_rows`, +// while such lines are counted in `skiprows`. +// +// .. versionadded:: 1.16.0 +// +// .. versionchanged:: 1.23.0 +// Lines containing no data, including comment lines (e.g., lines +// starting with '#' or as specified via `comments`) are not counted +// towards `max_rows`. +// quotechar : unicode character or None, optional +// The character used to denote the start and end of a quoted item. +// Occurrences of the delimiter or comment characters are ignored within +// a quoted item. The default value is ``quotechar=None``, which means +// quoting support is disabled. +// +// If two consecutive instances of `quotechar` are found within a quoted +// field, the first is treated as an escape character. See examples. +// +// .. versionadded:: 1.23.0 +// like : array_like, optional +// Reference object to allow the creation of arrays which are not +// NumPy arrays. If an array-like passed in as ``like`` supports +// the ``__array_function__`` protocol, the result will be defined +// by it. In this case, it ensures the creation of an array object +// compatible with that passed in via this argument. +// +// .. versionadded:: 1.20.0 +// +// Returns +// ------- +// out : ndarray +// Data read from the text file. +// +// See Also +// -------- +// load, fromstring, fromregex +// genfromtxt : Load data with missing values handled as specified. +// scipy.io.loadmat : reads MATLAB data files +// +// Notes +// ----- +// This function aims to be a fast reader for simply formatted files. The +// `genfromtxt` function provides more sophisticated handling of, e.g., +// lines with missing values. +// +// Each row in the input text file must have the same number of values to be +// able to read all values. If all rows do not have same number of values, a +// subset of up to n columns (where n is the least number of values present +// in all rows) can be read by specifying the columns via `usecols`. +// +// .. versionadded:: 1.10.0 +// +// The strings produced by the Python float.hex method can be used as +// input for floats. +// +// Examples +// -------- +// >>> from io import StringIO # StringIO behaves like a file object +// >>> c = StringIO("0 1\n2 3") +// >>> np.loadtxt(c) +// array([[0., 1.], +// [2., 3.]]) +// +// >>> d = StringIO("M 21 72\nF 35 58") +// >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), +// ... 'formats': ('S1', 'i4', 'f4')}) +// array([(b'M', 21, 72.), (b'F', 35, 58.)], +// dtype=[('gender', 'S1'), ('age', '>> c = StringIO("1,0,2\n3,0,4") +// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) +// >>> x +// array([1., 3.]) +// >>> y +// array([2., 4.]) +// +// The `converters` argument is used to specify functions to preprocess the +// text prior to parsing. `converters` can be a dictionary that maps +// preprocessing functions to each column: +// +// >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n") +// >>> conv = { +// ... 0: lambda x: np.floor(float(x)), # conversion fn for column 0 +// ... 1: lambda x: np.ceil(float(x)), # conversion fn for column 1 +// ... } +// >>> np.loadtxt(s, delimiter=",", converters=conv) +// array([[1., 3.], +// [3., 5.]]) +// +// `converters` can be a callable instead of a dictionary, in which case it +// is applied to all columns: +// +// >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE") +// >>> import functools +// >>> conv = functools.partial(int, base=16) +// >>> np.loadtxt(s, converters=conv) +// array([[222., 173.], +// [192., 222.]]) +// +// This example shows how `converters` can be used to convert a field +// with a trailing minus sign into a negative number. +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> def conv(fld): +// ... return -float(fld[:-1]) if fld.endswith(b'-') else float(fld) +// ... +// >>> np.loadtxt(s, converters=conv) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Using a callable as the converter can be particularly useful for handling +// values with different formatting, e.g. floats with underscores: +// +// >>> s = StringIO("1 2.7 100_000") +// >>> np.loadtxt(s, converters=float) +// array([1.e+00, 2.7e+00, 1.e+05]) +// +// This idea can be extended to automatically handle values specified in +// many different formats: +// +// >>> def conv(val): +// ... try: +// ... return float(val) +// ... except ValueError: +// ... return float.fromhex(val) +// >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2") +// >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None) +// array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00]) +// +// Note that with the default ``encoding="bytes"``, the inputs to the +// converter function are latin-1 encoded byte strings. To deactivate the +// implicit encoding prior to conversion, use ``encoding=None`` +// +// >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') +// >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) +// >>> np.loadtxt(s, converters=conv, encoding=None) +// array([[ 10.01, -31.25], +// [ 19.22, 64.31], +// [-17.57, 63.94]]) +// +// Support for quoted fields is enabled with the `quotechar` parameter. +// Comment and delimiter characters are ignored when they appear within a +// quoted item delineated by `quotechar`: +// +// >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"alpha, #42" 10.0\n"beta, #64" 2.0\n') +// >>> dtype = np.dtype([("label", "U12"), ("value", float)]) +// >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"') +// array([('alpha, #42', 10.), ('beta, #64', 2.)], +// dtype=[('label', '>> s = StringIO('"Hello, my name is ""Monty""!"') +// >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') +// array('Hello, my name is "Monty"!', dtype='>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20") +// >>> np.loadtxt(d, usecols=(0, 1)) +// array([[ 1., 2.], +// [ 2., 4.], +// [ 3., 9.], +// [ 4., 16.]]) +// +// +// +//go:linkname Loadtxt py.loadtxt +func Loadtxt(fname *py.Object, dtype *py.Object, comments *py.Object, delimiter *py.Object, converters *py.Object, skiprows *py.Object, usecols *py.Object, unpack *py.Object, ndmin *py.Object, encoding *py.Object, maxRows *py.Object) *py.Object